我正在使用Google API,因此我将此脚本添加到 build.gradle 文件(在我的项目中的 app / 文件夹中)但我收到错误&# 34; 无法解决:com.google.apis : 请帮忙。
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.gmailquickstart"
minSdkVersion 11
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.google.android.gms:play-services:7.3.0'
compile 'com.google.api-client:google-api-client:1.20.0'
compile 'com.google.api-client:google-api-client-android:1.20.0'
compile 'com.google.api-client:google-api-client-gson:1.20.0'
compile 'com.google.apis:google-api-services-gmail:v1-rev29-1.20.0'
}
答案 0 :(得分:1)
您希望在build.gradle中使用此代码:
familyType <- function(relation, gender) {
polygamy = sum(relation == 2, na.rm = TRUE)
headgender = gender[relation == 1]
polygamy = as.integer(levels(polygamy))[polygamy]
headgender = as.integer(levels(headgender))[headgender]
if(polygamy == 0) {
if(headgender == 1){
return (1L)
} else {
return (2L)
}
} else if(polygamy == 1){
if(headgender == 1){
return (3L)
} else {
return (4L)
}
} else if(polygamy > 1) {
return (5L)
}
}
tbl[, type:=familyType(Relation.to.Head, Gender), by=Id]
参考:https://developers.google.com/api-client-library/java/apis/gmail/v1
编辑: 根据参考资料,你也可以在那里下载jar文件以避免引用maven,如果你愿意的话。