Android build falid (The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries)

The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[16.5.0,16.5.0], [16.4.0,16.4.0]], but resolves to 16.5.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

how can i fix it ?

9 Likes

I am having the same problem. Did you manage to resolve?

This works for me:

Steps:
1 - ionic cordova platform rm android
2 - Remove cordova-plugin-firebase with ionic cordova plugin rm cordova-plugin-firebase
3 - Install: ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue
4 - ionic cordova platform add android

14 Likes

+1 , the Ionic support team said:

For the moment, as dpa99c mentions in that PR, if you need to build, you’ll have to installed the fixed plugin from the fork mentioned in that issue. Should allow you to build again until the next version of the plugin is released.

Then, for now, this is the solution and it works for me

My terminal just hangs when running step 3. Any thoughts as to why? Looking at the github repo latest build appears to be broken.

I was having trouble as well earlier today but it worked for me now.

Hello everyone,

I followed the indications of @Uehara but I still can not build properly. I have this error:

* What went wrong:
In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[11.0.
1]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.

Dependency failing: com.google.android.gms:play-services-tagmanager-v4-impl:11.0.1 -> com.google.android.gms:play-servic
es-basement@[11.0.1], but play-services-basement version was 16.2.0.

The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.firebase:firebase-core@+
-- Project 'app' depends onto com.google.firebase:firebase-config@+
-- Project 'app' depends onto com.google.firebase:firebase-auth@+
-- Project 'app' depends onto com.google.firebase:firebase-perf@+
-- Project 'app' depends onto com.google.android.gms:play-services-analytics@11.0.1
-- Project 'app' depends onto com.google.firebase:firebase-messaging@+
-- Project 'app' depends onto com.google.android.gms:play-services-tagmanager@+

For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
uild.gradle file.

my ionic info :

Ionic:

   ionic (Ionic CLI)             : 4.12.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.4.2
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.0.0
   Cordova Plugins       : cordova-plugin-ionic 5.3.0, cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 9 other plugins)

System:

   ios-deploy : 1.9.2
   NodeJS     : v10.15.3 (/usr/local/bin/node)
   npm        : 6.9.0
   OS         : macOS High Sierra
   Xcode      : Xcode 10.1 Build version 10B61

and my platform/android/project-properties :

target=android-26
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.squareup.okhttp3:okhttp-urlconnection:3.10.0
cordova.gradle.include.1=cordova-plugin-firebase/app-build.gradle
cordova.system.library.2=com.google.android.gms:play-services-tagmanager:+
cordova.system.library.3=com.google.firebase:firebase-core:+
cordova.system.library.4=com.google.firebase:firebase-messaging:+
cordova.system.library.5=com.google.firebase:firebase-config:+
cordova.system.library.6=com.google.firebase:firebase-perf:+
cordova.system.library.7=com.google.android.gms:play-services-analytics:11.0.1
cordova.system.library.8=com.android.support:support-annotations:27.+

does anyone have a solution?
Thx a lot

1 Like

Has this been solved yet, or do I still have to use the workaround described by Uehara?

In your project-properties, try changing com.google.android.gms:play-services-analytics from 11.0.1 to 16.0.8.

Good luck.

1 Like

It works for debug build only.
On production it throws this error.

[13:29:25]  ionic-app-script task: "build"
[13:29:25]  Error: Metadata version mismatch for module
            [Local address]/node_modules/@ionic-native/google-analytics/index.d.ts,
            found version 4, expected 3
Error: Metadata version mismatch for module [Local address]/node_modules/@ionic-native/google-analytics/index.d.ts, found version 4, expected 3
    at StaticSymbolResolver.getModuleMetadata ([Local address]\node_modules\@angular\compiler\bundles\compiler.umd.js:24474:34)
    at StaticSymbolResolver._createSymbolsOf ([Local address]\node_modules\@angular\compiler\bundles\compiler.umd.js:24260:46)
    at StaticSymbolResolver.getSymbolsOf ([Local address]\node_modules\@angular\compiler\bundles\compiler.umd.js:24241:14)
    at [Local address]\node_modules\@angular\compiler\bundles\compiler.umd.js:23023:30
    at Array.forEach (<anonymous>)
    at extractProgramSymbols ([Local address]\node_modules\@angular\compiler\bundles\compiler.umd.js:23022:79)
    at AotCompiler.compileAll ([Local address]\node_modules\@angular\compiler\bundles\compiler.umd.js:22720:47)
    at CodeGenerator.codegen ([Local address]\node_modules\@angular\compiler-cli\src\codegen.js:30:14)
    at Function.NgTools_InternalApi_NG_2.codeGen ([Local address]\node_modules\@angular\compiler-cli\src\ngtools_api.js:61:30)
    at [Local address]\node_modules\@ionic\app-scripts\dist\aot\aot-compiler.js:182:73

Running Ionic 5.0.2 and Cordova 9.0.0 I edited my platforms/android/project.properties file and explicitly set the versions to:

cordova.system.library.4=com.google.firebase:firebase-core:16.0.8 
cordova.system.library.5=com.google.firebase:firebase-messaging:17.5.0 
cordova.system.library.6=com.google.firebase:firebase-config:16.4.1 
cordova.system.library.7=com.google.firebase:firebase-perf:16.2.4

This fixed the error and allowed me to build. Hope it helps others as well.

2 Likes

@Uehara 's Solution worked pertectly.

Today all of sudden I am facing new issue -

platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:9: error: cannot find symbol
import android.support.v4.app.NotificationManagerCompat;
followed by 16 more errors.

  • What went wrong:
    Execution failed for task ‘:app:compileDebugJavaWithJavac’.

Compilation failed; see the compiler error output for details.

The Build worked fine until last night. Any help or is someone also finding this issue ?

I’m having the same problem. Please help me!!!

This week a new library version has been released from firebase. It seems that there is a missmatch between used libraries from google play. I faced the same and other similar errors during build process.

I used with the same version ( #GH-1057-April-05-android-build-issue) and it worked lasth month (31 May) without problems - yesterday, without any change of the plugins by myself, the build failed (Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’.)

After trying several things I could build again after install additional Gradle-Plugins for define version of google-play and firebase.

Try to define which firebase library you are using with this plugin, e.g.:

cordova plugin add cordova-android-firebase-gradle-release --variable FIREBASE_VERSION=17.+ --save

Then define which version of google play services you are using with the sister-plugin, e.g.:

cordova plugin add cordova-android-play-services-gradle-release --variable PLAY_SERVICES_VERSION=16.+ --save

Check if you have additional google plugins which depends also on google play service, e.g. cordova-plugin-googlemaps where you could define PLAY_SERVICE_VERSION as well

In my case it worked with FIREBASE_VERSION=17.+ and PLAY_SERVICES_VERSION=16.+

Hope it helps

1 Like

with the work around @newcom360, build worked fine, but the APK when installed in device it says App stopped working, Could you please help anything on this

i’m getting this error when installing the second plugin with version 15.0.1

BUILD FAILED in 5s
25 actionable tasks: 23 executed, 2 up-to-date
/Users/ulises/ulises/indoor-geolocation-plugin-ionic1/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: /Users/ulises/ulises/indoor-geolocation-plugin-ionic1/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemCookieManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/Users/ulises/ulises/indoor-geolocation-plugin-ionic1/platforms/android/app/src/main/java/com/adobe/phonegap/push/PushInstanceIDListenerService.java:9: error: cannot find symbol
import com.google.firebase.iid.FirebaseInstanceIdService;
                              ^
  symbol:   class FirebaseInstanceIdService
  location: package com.google.firebase.iid
/Users/ulises/ulises/indoor-geolocation-plugin-ionic1/platforms/android/app/src/main/java/com/adobe/phonegap/push/PushInstanceIDListenerService.java:15: error: cannot find symbol
public class PushInstanceIDListenerService extends FirebaseInstanceIdService implements PushConstants {
                                                   ^
  symbol: class FirebaseInstanceIdService
/Users/ulises/ulises/indoor-geolocation-plugin-ionic1/platforms/android/app/src/main/java/com/adobe/phonegap/push/PushInstanceIDListenerService.java:18: error: method does not override or implement a method from a supertype
    @Override
    ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

The mine to. What you do to work?

The correct link is :
https://github.com/dpa99c/cordova-plugin-firebasex

instead of:
https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue

Thanks for that manual, but the plugin is outdated. Please update your answer to the official plugin:

ionic cordova plugin add cordova-plugin-firebase-lib@3.3.0 --save

( source: https://github.com/arnesson/cordova-plugin-firebase/issues/1057 )

This is working as expected in ionic 4 android platform.