Home » Android » android – google iosched sample project : com.google.api.client.repackaged.com.google.common.base does not exist

android – google iosched sample project : com.google.api.client.repackaged.com.google.common.base does not exist

Posted by: admin June 15, 2020 Leave a comment

Questions:

I have downloaded google iosched repository and followed the build instructions but when I run

./gradlew clean assembleDebug

I get this error :

    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

the line of error :
Error:(21, 63) error: package com.google.api.client.repackaged.com.google.common.base does not exist

note : I haven’t done any changes to the project yet. I simply followed these instructions.

How to&Answers:

Forget about the build instructions from their github page. When you import the code, don’t upgrade the gradle version when android studio gives you the popup. This project’s gradle version is 2.3.1. Keep it that way. Don’t upgrade to 3 or 4.

Make the following changes in the build.gradle file for the server module:

add this dependency:

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

update this dependency to version 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'
        // ...
    }
}

No more changes to the build.gradle file. Now replace the following import

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

with

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

in the file com.google.samples.apps.iosched.server.gcm.FcmRegistrationEndpoint.java in server module.

Update the api_keys from your Google Developer project.

Now build and run!

Edit

Related github issues:

#246

#241