【问题标题】:Generating Maven GAE Endpoints library and importing it into Android Studio生成 Maven GAE Endpoints 库并将其导入 Android Studio
【发布时间】:2015-02-18 04:14:21
【问题描述】:

我有一个 Java 中的 Maven Google App Engine Endpoints API。我按照这些instructions 编译了JAR。

我最近从 Eclipse 过渡到 Android Studios。我正在尝试将 JAR 导入 Android Studio。我在 build.gradle 中添加了这一行:

compile files('./libs/warAPI-v1-1.19.1-SNAPSHOT.jar')

我还需要向 build.gradle 添加哪些其他依赖项?我似乎在任何地方都找不到清单。

【问题讨论】:

  • 我不了解 maven,但您是否在外部以及您的 libs 文件夹中添加了 warAPI-v1-1.19.1-SNAPSHOT.jar。
  • 问题不在于将其导入 Android Studios,问题在于 Maven 生成的 GAE 端点 JAR 需要额外的依赖项

标签: android google-app-engine maven android-studio google-cloud-endpoints


【解决方案1】:

点击按钮Sync Project With Gradle Files 应该可以解决您的问题:

工具 -> Android -> 使用 Gradle 文件同步项目

如果失败,请尝试运行Rebuild project

构建 -> 重建项目

【讨论】:

  • 问题不在于将其导入 Android Studios,问题在于 Maven 生成的 GAE 端点 JAR 需要额外的依赖项
【解决方案2】:

这些是我最终添加的依赖项:

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')
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-06
    • 1970-01-01
    • 2014-02-24
    • 1970-01-01
    • 2013-08-05
    • 1970-01-01
    • 2013-09-15
    相关资源
    最近更新 更多