Android Question Compile error with Firebase Admob Library [SOLVED]

Discussion in 'Android Questions' started by Computersmith64, Jul 8, 2016.

  1. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    To cut a long story short, I'm trying to get one of the Google Play Games Services wrappers to work with the latest version of Google Play Services (v9.2.0) so that I can use it in the same app as the Firebase AdMob wrapper. I have successfully updated the Google Play wrapper to work with v9.2.0 & can compile & run the app & confirm that the leaderboard, achievement, etc... functionality works fine. I can also compile the app with the FirebaseAdMob wrapper & confirm that it serves ads - however if I try to compile the app with both the FirebaseAdMob wrapper & the Google Play Games Services wrapper, I get the following error:

    There's not really much else I can add that's of any use, except that v9.2.0 of Google Play Services has been broken down into multiple .aar files (which the .jar files can be extracted from) - each one containing a different part of the functionality that used to be in that one big google-play-services.jar. To get the wrapper to work with the Google Play Games Services wrapper, I had to use 7 of those "sub-jars" & put an @DependsOn clause in the java code for all of them. It appears that the error is coming from the play-services-basement-9.2.0 jar file.

    Any ideas on how I can get around this?

    Thanks - Colin.
     
  2. DonManfred

    DonManfred Expert Licensed User

    how does the dependson directive in your wrapper looks like?
    Do you use any #AdditionalJar in your project?
     
  3. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    Hi DonManfred - it looks like this:

    Code:
    @DependsOn(values = { "android-support-v4""google-play-services-auth-base""google-play-services-base""google-play-services-games""play-services-auth""play-services-basement""play-services-drive""play-services-nearby" })
    I thought that maybe putting "com.google.firebase" in the -b4aignore field in SLC might help, but it doesn't seem to make a difference.

    - Colin.
     
  4. corwin42

    corwin42 Expert Licensed User

    You should change the @DependsOn annotation in your library to the new maven repository.

    Code:
    @DependsOn(values = { "com.android.support:support-v4""com.google.android.gms:play-services-games"})
    This may be enough.

    The Android Studio example projects include these libraries:

    Code:
    compile "com.android.support:appcompat-v7:${appcompat_library_version}"
        compile 
    "com.android.support:support-v4:${support_library_version}"
        compile 
    "com.google.android.gms:play-services-games:${gms_library_version}"
        compile 
    "com.google.android.gms:play-services-plus:${gms_library_version}"
    I don't know, if you need appcompat-v7 and play-services-plus. You should start to try without them.

    Just extract the .jar files to compile your library wrapper. Do NOT include the jar files in your additional libs folder for B4A. Use the maven repositories with B4A with the DependsOn line provided above.

    For test purposes you can even delete the complete DependsOn line from your library and add the maven repository with #AdditionalJar in B4A like:

    Code:
    #AdditionalJar: com.android.support:support-v4
    #AdditionalJar: com.google.android.gms:play-services-games
    If you get "NoClassDefFound" errors you can try to add additional entries: For a full list of all possible modules see here
     
    Computersmith64 likes this.
  5. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    Hah! I guess we must have been thinking along the same lines, because before you posted I tried exactly what you said. The problem I then had was that the dexer process would time out, even when I extended the time to 120 seconds. So to fix it, I changed the @DependsOn clause to this:

    Code:
    @DependsOn(values = { "
    com.android.support:appcompat-v7", "com.google.android.gms:play-services-auth-base", "com.google.android.gms:play-services-base", "com.google.android.gms:play-services-games", "com.google.android.gms:play-services-auth", "com.google.android.gms:play-services-basement", "com.google.android.gms:play-services-drive", "com.google.android.gms:play-services-nearby" })
    & now it compiles & runs. I have run the app & confirmed that the Play Services Games & AdMob functionality is working as expected, however I'll do some more testing before I break out the champagne. The beauty of this approach is that it directly references the libraries downloaded using the Android SDK Manager (I think), so you don't need to copy libraries into the B4A libraries or additional libraries folder(s).

    Thanks for the suggestions Corwin - you would have pointed me in the right direction if I hadn't figured it out!

    - Colin.
     
  6. corwin42

    corwin42 Expert Licensed User

    This is one of the big advantages of the maven repositories. The other big one is that you don't have to include additional resources with #AdditionalRes: lines.

    Congratulations on getting it done. I think adding support for the maven repositories was a big step for B4A which will make using complex libraries much more simple in the future.
     
    Computersmith64 likes this.
  7. tpakis

    tpakis Active Member Licensed User

    @Computersmith64 Would you share the new Google play game services wrapper that works together with firebase admob?
     
  8. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    I need to do some more testing on it & also check with Informatix (it's his wrapper that I recompiled with v9.2.0 of Google Play Services) first.
     
  9. tpakis

    tpakis Active Member Licensed User

    Great!! Hope it works out because it is really useful.
     
  10. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    I have posted the recompiled library here.
     
  11. tpakis

    tpakis Active Member Licensed User

    Thank you!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice