google iosched示例项目:com.google.api.client.repackaged.com.google.common.base不存在

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了google iosched示例项目:com.google.api.client.repackaged.com.google.common.base不存在相关的知识,希望对你有一定的参考价值。

我已经下载了google iosched存储库并跟随build instructions,但是当我运行时

./gradlew clean assembleDebug

我收到此错误:

    Information:Gradle tasks [clean, :apk:generateMapEditorDebugSources, :apk:generateMapEditorDebugandroidTestSources, :apk:mockableAndroidJar, :apk:prepareMapEditorDebugUnitTestDependencies, :lib:generateMapEditorDebugSources, :lib:generateMapEditorDebugAndroidTestSources, :lib:mockableAndroidJar, :lib:prepareMapEditorDebugUnitTestDependencies]
Warning:[options] bootstrap class path not set in conjunction with -source 1.7
/home/mhmd/android_work/iosched/server/src/main/java/com/google/samples/apps/iosched/server/gcm/FcmRegistrationEndpoint.java
Error:(21, 63) error: package com.google.api.client.repackaged.com.google.common.base does not exist
/home/mhmd/android_work/iosched/server/src/main/java/com/google/samples/apps/iosched/server/registration/RegistrationEndpoint.java
Warning:(41, 52) Bool is internal proprietary API and may be removed in a future release
Warning:(41, 52) Bool is internal proprietary API and may be removed in a future release
Error:Execution failed for task ':server:compileJava'.
> Compilation failed; see the compiler error output for details.
Information:BUILD FAILED
Information:Total time: 7.497 secs
Information:2 errors
Information:3 warnings
Information:See complete output in console

误差线:Error:(21, 63) error: package com.google.api.client.repackaged.com.google.common.base does not exist

注意:我还没有对项目进行任何更改。我只是遵循这些指示。

答案

忘记他们的github页面中的构建指令。导入代码时,当android studio为您提供弹出窗口时,请不要升级gradle版本。该项目的gradle版本是2.3.1。保持这种方式。不要升级到3或4。

build.gradle文件的server文件中进行以下更改:

添加此依赖项:

compile group: 'com.google.api.client', name: 'google-api-client-repackaged-com-google-common-base', version: '1.2.3-alpha'

将此依赖关系更新到版本1.23.0:

compile 'com.google.api-client:google-api-client-appengine:1.23.0'

add googleClientVersion in endpoints:

appengine {
    // ...
    endpoints {
        googleClientVersion = '1.23.0'
        // ...
    }
}

不再对build.gradle文件进行更改。现在替换以下导入

import com.google.api.client.repackaged.com.google.common.base.Strings;

import com.google.appengine.repackaged.com.google.common.base.Strings;

com.google.samples.apps.iosched.server.gcm.FcmRegistrationEndpoint.java模块中的文件server中。

从您的Google Developer项目更新api_keys。

现在建立并运行!

编辑

相关的github问题:

#246

#241

以上是关于google iosched示例项目:com.google.api.client.repackaged.com.google.common.base不存在的主要内容,如果未能解决你的问题,请参考以下文章

Google iosched:com.android.dex.DexIndexOverflowException:方法 ID 不在

tapset::iosched

cannot find package "cloud.google.com/go/compute/metadata"

关于go get无法安装国内被墙软件解决办法

安装go环境

linux系统 go 语言安装