我在Java中有一个Maven Google App Engine端点API。我按照这些instructions编译了JAR。
我最近从Eclipse过渡到Android工作室。我正在尝试将JAR导入Android Studio。我将此行添加到build.gradle:
compile files('./libs/warAPI-v1-1.19.1-SNAPSHOT.jar')
我还需要向build.gradle添加哪些其他依赖项?我似乎无法在任何地方找到列表。
答案 0 :(得分:2)
点击按钮Sync Project With Gradle Files
可以解决您的问题:
工具 - > Android - >使用Gradle文件同步项目
如果失败,请尝试运行Rebuild project
:
构建 - >重建项目
答案 1 :(得分:0)
这些是我最后添加的依赖项:
的build.gradle
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile(group: 'com.google.api-client', name: 'google-api-client', version: '1.18.0-rc') {
// Exclude artifacts that the Android SDK/Runtime provides.
exclude(group: 'xpp3', module: 'xpp3')
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
exclude(group: 'junit', module: 'junit')
exclude(group: 'com.google.android', module: 'android')
}
compile(group: 'com.google.api-client', name: 'google-api-client-android',
version: '1.18.0-rc') {
exclude(group: 'com.google.android.google-play-services', module: 'google-play-services')
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
}
compile(group: 'com.google.api-client', name: 'google-api-client-gson', version: '1.18.0-rc') {
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
}
compile(group: 'com.google.http-client', name: 'google-http-client-android',
version: '1.18.0-rc') {
exclude(group: 'com.google.android', module: 'android')
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
}
compile files('./libs/warAPI-v1-1.19.1-SNAPSHOT.jar')
compile(group: 'com.google.guava', name: 'guava', version: '18.0-rc2')
}