Get a build error after installing Google maps native plugin


#1

I can’t build my app every time I install the google maps native plugin, I get this error! (pic below)
the strange thing is this error appears yesterday for the first time after 3 months of developing the app without any problems.
I tried to remove nodejs and reinstall it, Also, I did the same thing with the ionic/cordova but still getting the same error !
I really don’t know what to do.
someone can help plz ?


#2

The versions of two Google Play Services SDKs, one is requested from the Google Maps native plugin, and other one is requested from another plugin, are conflicted.
You need to modify those conflict by yourself.

Please check out here for example how to fix this error.


#3

Hi @wf9a5m75 , thanks for you reply
I tried to change project.properties but still getting the same error

this is my project.properties file

# This file was originally created by the Android Tools, but is now
# used by cordova-android to manage the state of the various third party
# libraries used in your application

# This is the Library Module that contains the Cordova Library, this is not
# required when using an AAR

# This is the application project.  This is only required for Android Studio Gradle projects

# Project target.
target=android-26
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.system.library.2=com.android.support:support-v4:24.1.1+
cordova.gradle.include.1=cordova-plugin-firebase/starter-build.gradle
cordova.system.library.3=com.google.gms:google-services:+
cordova.system.library.4=com.google.android.gms:play-services-tagmanager:+
cordova.system.library.5=com.google.firebase:firebase-core:+
cordova.system.library.6=com.google.firebase:firebase-messaging:+
cordova.system.library.7=com.google.firebase:firebase-crash:+
cordova.system.library.8=com.google.firebase:firebase-config:+
cordova.system.library.9=com.google.firebase:firebase-perf:+
cordova.gradle.include.2=cordova-plugin-googlemaps/starter-build-extras.gradle
cordova.gradle.include.3=cordova-plugin-googlemaps/starter-tbxml-android.gradle
cordova.system.library.10=com.google.android.gms:play-services-maps:12.0.1
cordova.system.library.11=com.google.android.gms:play-services-location:12.0.1
cordova.system.library.12=com.android.support:support-core-utils:24.1.0

and this is the build.gradle file

/* Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
*/

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
    dependencies {

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.android.tools.build:gradle:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
    //This replaces project.properties w.r.t. build settings
    project.ext {
      defaultBuildToolsVersion="25.0.2" //String
      defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
      defaultTargetSdkVersion=26 //Integer - We ALWAYS target the latest by default
      defaultCompileSdkVersion=26 //Integer - We ALWAYS compile with the latest by default
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

any suggestions ?


#4

target=android-26
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.gradle.include.1=cordova-plugin-firebase/starter-build.gradle
cordova.system.library.4=com.google.android.gms:play-services-tagmanager:12.0.1
cordova.system.library.5=com.google.firebase:firebase-core:12.0.1
cordova.system.library.6=com.google.firebase:firebase-messaging:12.0.1
cordova.system.library.7=com.google.firebase:firebase-crash:12.0.1
cordova.system.library.8=com.google.firebase:firebase-config:12.0.1
cordova.system.library.9=com.google.firebase:firebase-perf:12.0.1
cordova.gradle.include.2=cordova-plugin-googlemaps/starter-build-extras.gradle
cordova.gradle.include.3=cordova-plugin-googlemaps/starter-tbxml-android.gradle
cordova.system.library.10=com.google.android.gms:play-services-maps:12.0.1
cordova.system.library.11=com.google.android.gms:play-services-location:12.0.1
cordova.system.library.12=com.android.support:support-core-utils:27.1.0

#5

@wf9a5m75 Okey, now the error became different
in the messaging service I think.

BUILD FAILED
 in 3s
38 actionable tasks: 36 executed, 2 up-to-date

(node:4035) UnhandledPromiseRejectionWarning: Error: /home/belkacemi/Modèles/HCH-PROTECTION/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/home/belkacemi/Modèles/HCH-PROTECTION/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java:49: error: cannot access zzbgl
        Map<String, String> data = remoteMessage.getData();
                                                ^
  class file for com.google.android.gms.internal.zzbgl not found
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.
1 error


#6

Please ask to the developer of the firebase plugin.


#7

@wf9a5m75 okey I will try,
thanks so much for ur time :slight_smile:


#8

Hey @wf9a5m75, I just solved the problem by this way

target=android-26
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.system.library.2=com.android.support:support-v4:24.1.1+
cordova.gradle.include.1=cordova-plugin-firebase/starter-build.gradle
cordova.system.library.3=com.google.gms:google-services:+
cordova.system.library.4=com.google.android.gms:play-services-tagmanager:+
cordova.system.library.5=com.google.firebase:firebase-core:+
cordova.system.library.6=com.google.firebase:firebase-messaging:+
cordova.system.library.7=com.google.firebase:firebase-crash:+
cordova.system.library.8=com.google.firebase:firebase-config:+
cordova.system.library.9=com.google.firebase:firebase-perf:+
cordova.gradle.include.2=cordova-plugin-googlemaps/starter-build-extras.gradle
cordova.gradle.include.3=cordova-plugin-googlemaps/starter-tbxml-android.gradle
cordova.system.library.10=com.google.android.gms:play-services-maps:+
cordova.system.library.11=com.google.android.gms:play-services-location:+
cordova.system.library.12=com.android.support:support-core-utils:24.1.0
cordova.system.library.13=com.google.android.gms:play-services-location:11.+

everything works fine now, Can this affect the application’s plugins in the future?


#9

Special keyword (library):+ is useful but kind of dangerous.

When you specify (library):+, the gradle tries to install the latest version at the time.
This means the most cases are fine, but sometime this might cause unexpected errors, conflicting with another plugins, or code does not work in the future.
And because the Gradle checks the latest version everytime, the building time takes longer than you specified particular version.

Which one is better is depends on your opinion.