Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New error on android build since 06-05-2019 #1057

Open
clanglois421 opened this issue May 6, 2019 · 187 comments

Comments

Projects
None yet
@clanglois421
Copy link

commented May 6, 2019

Describe the bug
Were having a new error on cordova build android since about 3 hours ago (06-05-2019 16:00:00). On a same build that passed this noon..

To Reproduce
Steps to reproduce the behavior:
Using these depency :

"dependencies": {
"@vimeo/player": "^2.8.2",
"android-versions": "^1.4.0",
"autoprefixer": "^9.5.1",
"aws-sdk": "^2.446.0",
"browser-sync": "^2.26.4",
"cordova-browser": "^6.0.0",
"cordova-ios": "^5.0.1",
"cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-customconfigparameters": "^3.0.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-downloader": "^0.4.0",
"cordova-plugin-file-md5": "^0.3.3",
"cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-firebase": "git+https://github.com/arnesson/cordova-plugin-firebase.git",
"cordova-plugin-inappbrowser": "^3.0.0",
"cordova-plugin-network-information": "^2.0.1",
"cordova-plugin-splashscreen": "git+https://github.com/apache/cordova-plugin-splashscreen.git",
"cordova-plugin-statusbar": "git+https://github.com/apache/cordova-plugin-statusbar.git",
"cordova-plugin-streaming-media": "^2.2.0",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-plugin-zip": "^3.1.0",
"cordova-support-google-services": "^1.1.0",
"del": "^4.1.0",
"express": "^4.16.4",
"gameanalytics": "^3.1.2",
"graceful-fs": "^4.1.15",
"gulp-concat": "^2.6.1",
"gulp-copy": "^4.0.1",
"gulp-eslint": "^5.0.0",
"gulp-install": "^1.1.0",
"gulp-kit": "^0.3.0",
"gulp-postcss": "^8.0.0",
"gulp-rename": "^1.4.0",
"gulp-sass": "^4.0.2",
"gulp-sourcemaps": "^2.6.5",
"gulp-uglify": "^3.0.2",
"nativescript-gameanalytics": "^2.1.2",
"node-properties-parser": "0.0.2",
"phonegap-plugin-multidex": "^1.0.0",
"properties-parser": "^0.3.1",
"sqli-cordova-disk-space-plugin": "~1.0.2",
"vimeo": "^2.1.1"
},

Run Cordova build android and we get an error.

**Console Logs**
Task :app:compileReleaseJavaWithJavac
/builds/MGAEntertainment/lol-video-star/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginInstanceIDService.java:6: error: cannot find symbol
import com.google.firebase.iid.FirebaseInstanceIdService;
                              ^
  symbol:   class FirebaseInstanceIdService
  location: package com.google.firebase.iid
/builds/MGAEntertainment/lol-video-star/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginInstanceIDService.java:8: error: cannot find symbol
public class FirebasePluginInstanceIDService extends FirebaseInstanceIdService {
                                                     ^
  symbol: class FirebaseInstanceIdService
/builds/MGAEntertainment/lol-video-star/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:610: error: method getByteArray in class FirebaseRemoteConfig cannot be applied to given types;
                        : FirebaseRemoteConfig.getInstance().getByteArray(key, namespace);
                                                            ^
  required: String
  found: String,String
  reason: actual and formal argument lists differ in length
/builds/MGAEntertainment/lol-video-star/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:629: error: method getValue in class FirebaseRemoteConfig cannot be applied to given types;
                        : FirebaseRemoteConfig.getInstance().getValue(key, namespace);
                                                            ^
  required: String
  found: String,String
  reason: actual and formal argument lists differ in length
/builds/MGAEntertainment/lol-video-star/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:686: error: no suitable method found for setDefaults(Map<String,Object>,String)
                        FirebaseRemoteConfig.getInstance().setDefaults(defaultsToMap(defaults), namespace);
                                                          ^
    method FirebaseRemoteConfig.setDefaults(Map<String,Object>) is not applicable
      (actual and formal argument lists differ in length)
    method FirebaseRemoteConfig.setDefaults(int) is not applicable
      (actual and formal argument lists differ in length)
/builds/MGAEntertainment/lol-video-star/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePlugin.java:885: error: cannot find symbol
                        myTrace.incrementCounter(counterNamed);
                               ^
  symbol:   method incrementCounter(String)
  location: variable myTrace of type Trace
/builds/MGAEntertainment/lol-video-star/platforms/android/app/src/main/java/org/apache/cordova/firebase/FirebasePluginInstanceIDService.java:17: 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.
7 errors

FAILURE: Build failed with an exception.

Desktop (please complete the following information):

  • OS: Android
  • Version API 28 Revision 6
@rodriguezmanu

This comment has been minimized.

Copy link

commented May 7, 2019

+1

@gartorware

This comment has been minimized.

Copy link

commented May 7, 2019

Same here. Tried to use cordova-play-services-gradle-release plugin (with + and 15.+) without success.

@jordanorc

This comment has been minimized.

Copy link

commented May 7, 2019

+1 Same problem here.. any suggestion?

@ejlodero

This comment has been minimized.

Copy link

commented May 7, 2019

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.

i think this error is related to this.

@sahyun1

This comment has been minimized.

Copy link

commented May 7, 2019

@ejlodero I get the same error. I wonder why this is happening as this plugin is not updated since last year

@pbejarano

This comment has been minimized.

Copy link

commented May 7, 2019

@ejlodero I get the same error, I am looking in my graddle but I dont see that dependencies, some body found something?

@urjunior87

This comment has been minimized.

Copy link

commented May 7, 2019

Same here, when trying to build android.

After a search at google I found following answer:
https://medium.com/android-school/firebaseinstanceidservice-is-deprecated-50651f17a148

as the FirebaseInstanceIdService deprecated.

@jcruzrg

This comment has been minimized.

Copy link

commented May 7, 2019

Hi, i have the same problem

@nystsam

This comment has been minimized.

Copy link

commented May 7, 2019

+1

3 similar comments
@munkyukim

This comment has been minimized.

Copy link

commented May 7, 2019

+1

@emilwang

This comment has been minimized.

Copy link

commented May 7, 2019

+1

@hcassar93

This comment has been minimized.

Copy link

commented May 7, 2019

+1

@syagawa

This comment has been minimized.

Copy link

commented May 7, 2019

i have the same problem....

@BrunoTMartins

This comment has been minimized.

Copy link

commented May 7, 2019

Same issue here, any hint?

@corrrso

This comment has been minimized.

Copy link

commented May 7, 2019

Same problem.

@raiyanihiren

This comment has been minimized.

Copy link

commented May 7, 2019

Same problem

@Julianlopsoda

This comment has been minimized.

Copy link

commented May 7, 2019

same problem

2 similar comments
@syedmaqbool

This comment has been minimized.

Copy link

commented May 7, 2019

same problem

@eosj

This comment has been minimized.

Copy link

commented May 7, 2019

same problem

@pluckannfeel

This comment has been minimized.

Copy link

commented May 7, 2019

have the same problem

@cd11103

This comment has been minimized.

Copy link

commented May 7, 2019

Here is a quick fix if you guys can't wait for new plugin update release.
https://forum.ionicframework.com/t/ionic-4-cordova-run-android-firebase-error-all-of-a-sudden/163204/23

@pvillaverde

This comment has been minimized.

Copy link

commented May 7, 2019

Same problem here

@fjckls

This comment has been minimized.

Copy link

commented May 7, 2019

This is due to the firebase updates on April 05. Here https://firebase.google.com/support/release-notes/android#update_-_april_02_2019, I found the last working versions and adjusted my project.properties accordingly like so

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

Here all dependencies are locked to the specific version (Update - April 02, 2019) instead of +, which would get you the latest version thus breaking the build process.

Now I can build successfully! Hope it helps!

@pluckannfeel

This comment has been minimized.

Copy link

commented May 7, 2019

This is due to the firebase updates on April 05. Here https://firebase.google.com/support/release-notes/android#update_-_april_02_2019, I found the last working versions and adjusted my project.properties accordingly like so

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

Here all dependencies are locked to the specific version (Update - April 02, 2019) instead of +, which would get you the latest version thus breaking the build process.

Now I can build successfully! Hope it helps!

where will you find project.properties

@pvillaverde

This comment has been minimized.

Copy link

commented May 7, 2019

Thanks @fjckls , it worked!!
@pluckannfeel you can find it on platforms/android/project.properties

@hellkith

This comment has been minimized.

Copy link

commented May 7, 2019

@fjckls I've tried your fix, and the Gradle sync will work but building the app still throws the errors for as given by topic starter where it cannot find the methods from Firebase.

@syagawa

This comment has been minimized.

Copy link

commented May 7, 2019

This is due to the firebase updates on April 05. Here https://firebase.google.com/support/release-notes/android#update_-_april_02_2019, I found the last working versions and adjusted my project.properties accordingly like so

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

Here all dependencies are locked to the specific version (Update - April 02, 2019) instead of +, which would get you the latest version thus breaking the build process.

Now I can build successfully! Hope it helps!

I succeeded in rewrite platforms/android/app/build.gradle and platforms/android/project.properties by @fjckls's method.

@pluckannfeel

This comment has been minimized.

Copy link

commented May 7, 2019

i got two errors,

Failed to resolve: com.google.firebase:firebase-messaging:17.5
Failed to resolve: com.google.firebase:firebase-config:16.4

i got two errors,
Failed to resolve: com.google.firebase:firebase-messaging:17.5
Failed to resolve: com.google.firebase:firebase-config:16.4

you forgot to add the final bit of it.
messaging = 17.5.0
config = 16.4.1

exactly, my reply was wrong but yeah thats what i put, still error

@hellkith

This comment has been minimized.

Copy link

commented May 7, 2019

i got two errors,

Failed to resolve: com.google.firebase:firebase-messaging:17.5
Failed to resolve: com.google.firebase:firebase-config:16.4

you forgot to add the final bit of it.
messaging = 17.5.0
config = 16.4.1

@jetwitaussi

This comment has been minimized.

Copy link

commented May 7, 2019

Using ionic v1 you can update:

plugins/cordova-plugin-firebase/plugin.xml

<framework src="com.google.android.gms:play-services-tagmanager:15.+" />
<framework src="com.google.firebase:firebase-core:15.+" />
<framework src="com.google.firebase:firebase-messaging:15.+" />
<framework src="com.google.firebase:firebase-config:15.+" />
<framework src="com.google.firebase:firebase-perf:15.+" />

(add "15." before "+")

and file plugins/cordova-plugin-firebase/src/android/build.gradle

compile 'com.google.firebase:firebase-auth:15.+'

(same add "15." before "+")

then remove android platform and readd it

i'm not convinced it's the best fix so i won't do a PR, but at least it fixes the problem for now, hope it helps!

@fatenHd

This comment has been minimized.

Copy link

commented May 18, 2019

@sagrawal31 i just tried your fork and still getting: unknown error verifying phone number Error instance: com.google.firebase.auth.FirebaseAuthException

@ahmedragabshaban

This comment has been minimized.

Copy link

commented May 19, 2019

ok,this what works for me

"cordova-plugin-firebase": "2.0.5",

project.properties file

cordova.system.library.6=com.google.android.gms:play-services-tagmanager:16+ cordova.system.library.7=com.google.firebase:firebase-core:16.0.9 cordova.system.library.8=com.google.firebase:firebase-messaging:17+ cordova.system.library.9=com.google.firebase:firebase-config:16+ cordova.system.library.10=com.google.firebase:firebase-perf:16.2.4

build.gradle file

buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://maven.google.com"
}
maven {
url 'https://maven.fabric.io/public'
} }
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.1'
    classpath 'com.google.gms:google-services:4.2.0' // google-services dependency from cordova-plugin-firebase
    classpath 'io.fabric.tools:gradle:1.25.4' // fabric dependency from cordova-plugin-firebase
}

}

allprojects {
repositories {
google()// add it to top instead of bottom or somewhere in middle
mavenLocal()
mavenCentral()
maven {
url 'https://maven.google.com'
}

    jcenter()
}
//This replaces project.properties w.r.t. build settings
project.ext {
  defaultBuildToolsVersion="27.0.1" //String
  defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
  defaultTargetSdkVersion=27 //Integer - We ALWAYS target the latest by default
  defaultCompileSdkVersion=27 //Integer - We ALWAYS compile with the latest by default
}

}

@phattranky

This comment has been minimized.

Copy link

commented May 19, 2019

@phattranky still the same issue

Don't know. It's woring well on my Cordova App. I'm merge the fix to my fork at https://github.com/phattranky/cordova-plugin-firebase

@punksta

This comment has been minimized.

Copy link

commented May 20, 2019

We can change gradle dependencies without forking project using gradle scripting. check "build-extras.gradle" docs https://cordova.apache.org/docs/en/latest/guide/platforms/android/#extending-buildgradle

build-extras.gradle

def dependencyMap = [
        "com.google.firebase:firebase-core" : "16.0.8",
        "com.google.firebase:firebase-perf": "16.2.4",
        "com.google.firebase:firebase-messaging": "17.5.0",
        "com.google.firebase:firebase-config": "16.4.1"
]

allprojects {
    repositories {
            google()
            jcenter()
            mavenLocal()
    }

    configurations.all {

        resolutionStrategy {

            eachDependency { DependencyResolveDetails details ->
                def group = details.requested.group
                def name = details.requested.name
                def fullName =  group + ":" + name
                print fullName
                if (dependencyMap.containsKey(fullName)) {
                    details.useVersion dependencyMap[fullName]
                }
            }
        }
    }

}

copy_build_extra.js

#!/usr/bin/env node

const fs = require('fs')

fs.copyFileSync("./build-extras.gradle", "./platforms/android/build-extras.gradle");

add new hook to config.xml's <android> tag. https://cordova.apache.org/docs/en/9.x/guide/appdev/hooks/index.html#page-toc-source

 <hook type="before_build" src="copy_build_extra.js" />

jfougere pushed a commit to jfougere/cordova-plugin-firebase that referenced this issue May 21, 2019

jfougere pushed a commit to jfougere/cordova-plugin-firebase that referenced this issue May 21, 2019

jfougere pushed a commit to jfougere/cordova-plugin-firebase that referenced this issue May 21, 2019

jfougere pushed a commit to jfougere/cordova-plugin-firebase that referenced this issue May 21, 2019

terkill added a commit to Monsenso/cordova-plugin-firebase that referenced this issue May 21, 2019

smalluban pushed a commit to surgeventures/cordova-plugin-firebase that referenced this issue May 22, 2019

@hvallenilla

This comment has been minimized.

Copy link

commented May 24, 2019

Hi guys,

I followed the steps of @ahmedragabshaban and the apk is generated with success, but when I install in my phone, the app after splash screen, display white screen

Someone with this issue?

@harshkhandelwalcs

This comment has been minimized.

Copy link

commented May 24, 2019

Hi @hvallenilla

I have faced this issue.
Are you running cordova build android command or ionic cordova build android ?
I think you are running only cordova build android , if you are running only cordova build android then build is succefull but if you are trying to build using ionic cordova build android then your build is not succeccfull, some scripts are not compatible with you current version, so please downgrade or upgrade your dependencies according to your requirements.

@hvallenilla

This comment has been minimized.

Copy link

commented May 24, 2019

HI @harshkhandelwalcs thanks for u reply.

I'm running ionic cordoba build android --prod

I will take your suggestions and will test again

Thanks

@YehudaK

This comment has been minimized.

Copy link

commented May 25, 2019

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

For whom it does not work... please try many times and at the end it will work. In my case I removed and added android several times but it did not help. However, when I updated android "cordova platform add android@6.3.0", then did "cordova clean", and also set fixed version for "play-services-tagmanager:16.0.8" it worked. Please note that I also had AdMob so I had to set "play-services-ads:16.0.+" and "play-services-base:16.0.+". No other changes were made. I hope this will help someone... however I personally wasted over 5 hours.

@wahidung

This comment has been minimized.

Copy link

commented May 29, 2019

Working with cordova@9.0.0 the version of @dpa99c works wonderful.

So use:
cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase#GH-1057-April-05-android-build-issue

I removed and added the android platform:
cordova platform rm android
cordova platform add android

and everything works like charm

Many thanks from my side

this work for me , thanks

@fatenHd

This comment has been minimized.

Copy link

commented May 29, 2019

i have an issue with this plugin that notification data is not received in bacground, any idea how to let it work? in forground data is received well

@devHamza

This comment has been minimized.

Copy link

commented Jun 3, 2019

We can change gradle dependencies without forking project using gradle scripting. check "build-extras.gradle" docs https://cordova.apache.org/docs/en/latest/guide/platforms/android/#extending-buildgradle

build-extras.gradle

def dependencyMap = [
        "com.google.firebase:firebase-core" : "16.0.8",
        "com.google.firebase:firebase-perf": "16.2.4",
        "com.google.firebase:firebase-messaging": "17.5.0",
        "com.google.firebase:firebase-config": "16.4.1"
]

allprojects {
    repositories {
            google()
            jcenter()
            mavenLocal()
    }

    configurations.all {

        resolutionStrategy {

            eachDependency { DependencyResolveDetails details ->
                def group = details.requested.group
                def name = details.requested.name
                def fullName =  group + ":" + name
                print fullName
                if (dependencyMap.containsKey(fullName)) {
                    details.useVersion dependencyMap[fullName]
                }
            }
        }
    }

}

copy_build_extra.js

#!/usr/bin/env node

const fs = require('fs')

fs.copyFileSync("./build-extras.gradle", "./platforms/android/build-extras.gradle");

add new hook to config.xml's <android> tag. https://cordova.apache.org/docs/en/9.x/guide/appdev/hooks/index.html#page-toc-source

 <hook type="before_build" src="copy_build_extra.js" />

You can use resolutionStrategy.force to force dependencies versions :

configurations.all {
  resolutionStrategy {
    // force certain versions of dependencies (including transitive)
    force "com.google.firebase:firebase-core:16.0.8", "com.google.firebase:firebase-perf:16.2.4", "com.google.firebase:firebase-messaging:17.5.0", "com.google.firebase:firebase-config:16.4.1"
  }
}

Thanks for the tip, it works for me

kprigel pushed a commit to KDPInnovations/cordova-plugin-firebase that referenced this issue Jun 3, 2019

@nsksaisaravana

This comment has been minimized.

Copy link

commented Jun 12, 2019

@fjckls You saved my day, your solution works like charm.

@levibn123

This comment has been minimized.

Copy link

commented Jun 17, 2019

We can change gradle dependencies without forking project using gradle scripting. check "build-extras.gradle" docs https://cordova.apache.org/docs/en/latest/guide/platforms/android/#extending-buildgradle

build-extras.gradle

def dependencyMap = [
        "com.google.firebase:firebase-core" : "16.0.8",
        "com.google.firebase:firebase-perf": "16.2.4",
        "com.google.firebase:firebase-messaging": "17.5.0",
        "com.google.firebase:firebase-config": "16.4.1"
]

allprojects {
    repositories {
            google()
            jcenter()
            mavenLocal()
    }

    configurations.all {

        resolutionStrategy {

            eachDependency { DependencyResolveDetails details ->
                def group = details.requested.group
                def name = details.requested.name
                def fullName =  group + ":" + name
                print fullName
                if (dependencyMap.containsKey(fullName)) {
                    details.useVersion dependencyMap[fullName]
                }
            }
        }
    }

}

copy_build_extra.js

#!/usr/bin/env node

const fs = require('fs')

fs.copyFileSync("./build-extras.gradle", "./platforms/android/build-extras.gradle");

add new hook to config.xml's <android> tag. https://cordova.apache.org/docs/en/9.x/guide/appdev/hooks/index.html#page-toc-source

 <hook type="before_build" src="copy_build_extra.js" />

Best solution. Save my day!!

@Infrauser

This comment has been minimized.

Copy link

commented Jun 19, 2019

cordova build failing getting below error
The library com.google.firebase:firebase-iid is being requested by various other libraries at [[17.1.1,17.1.1]], but resolves to 19.0.0.

@dpa99c

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2019

See #1081

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.