2

I am using ionic 4 and trying to run on an android device after adding FCM(https://beta.ionicframework.com/docs/native/fcm) to the app to support push notification. However, I am not able to get a successful build as soon as I added the FCM native plugin to the app. it gave me the following error.

Could not find com.android.tools:common:25.5.0-alpha-preview-02. Searched in the following locations: https://jcenter.bintray.com/com/android/tools/common/25.5.0-alpha-preview-02/common-25.5.0-alpha-preview-02.pom https://jcenter.bintray.com/com/android/tools/common/25.5.0-alpha-preview-02/common-25.5.0-alpha-preview-02.jar https://repo.maven.apache.org/maven2/com/android/tools/common/25.5.0-alpha-preview-02/common-25.5.0-alpha-preview-02.pom https://repo.maven.apache.org/maven2/com/android/tools/common/25.5.0-alpha-preview-02/common-25.5.0-alpha-preview-02.jar Required by: unspecified:unspecified:unspecified > com.android.tools.build:gradle:2.5.0-alpha-preview-02 > com.android.tools.build:gradle-core:2.5.0-alpha-preview-02 > com.android.tools.build:builder:2.5.0-alpha-preview-02 unspecified:unspecified:unspecified > com.android.tools.build:gradle:2.5.0-alpha-preview-02 > com.android.tools.build:gradle-core:2.5.0-alpha-preview-02 > com.android.tools.build:builder:2.5.0-alpha-preview-02 > com.android.tools.build:manifest-merger:25.5.0-alpha-preview-02 unspecified:unspecified:unspecified > com.android.tools.build:gradle:2.5.0-alpha-preview-02 > com.android.tools.build:gradle-core:2.5.0-alpha-preview-02 > com.android.tools.build:builder:2.5.0-alpha-preview-02 > com.android.tools.ddms:ddmlib:25.5.0-alpha-preview-02 unspecified:unspecified:unspecified > com.android.tools.build:gradle:2.5.0-alpha-preview-02 > com.android.tools.build:gradle-core:2.5.0-alpha-preview-02 > com.android.tools.build:builder:2.5.0-alpha-preview-02 > com.android.tools.analytics-library:shared:25.5.0-alpha-preview-02 unspecified:unspecified:unspecified > com.android.tools.build:gradle:2.5.0-alpha-preview-02 > com.android.tools.build:gradle-core:2.5.0-alpha-preview-02 > com.android.tools.build:builder:2.5.0-alpha-preview-02 > com.android.tools.analytics-library:tracker:25.5.0-alpha-preview-02 unspecified:unspecified:unspecified > com.android.tools.build:gradle:2.5.0-alpha-preview-02 > com.android.tools.build:gradle-core:2.5.0-alpha-preview-02 > com.android.tools.build:builder:2.5.0-alpha-preview-02 > com.android.tools:sdklib:25.5.0-alpha-preview-02 > com.android.tools.layoutlib:layoutlib-api:25.5.0-alpha-preview-02 unspecified:unspecified:unspecified > com.android.tools.build:gradle:2.5.0-alpha-preview-02 > com.android.tools.build:gradle-core:2.5.0-alpha-preview-02 > com.android.tools.build:builder:2.5.0-alpha-preview-02 > com.android.tools:sdklib:25.5.0-alpha-preview-02 > com.android.tools:dvlib:25.5.0-alpha-preview-02 unspecified:unspecified:unspecified > com.android.tools.build:gradle:2.5.0-alpha-preview-02 > com.android.tools.build:gradle-core:2.5.0-alpha-preview-02 > com.android.tools.build:builder:2.5.0-alpha-preview-02 > com.android.tools:sdklib:25.5.0-alpha-preview-02 > com.android.tools:repository:25.5.0-alpha-preview-02

I have been searching for an answer for the past 2 days and have tried changing parameters in the build.gradle (Cannot run existing Android Project com.android.tools:common:25.3.3) but have no success. Please help if any one here have any idea how to resolve it. Thanks a lot.

2 Answers 2

4

Thank God, I found a solution, go to platforms/android/cordova-plugin-firebase/***.gradle... then change

this.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:+'
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

to

buildscript {
    repositories {
        maven { url "https://maven.google.com" }
        jcenter()
        mavenLocal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:+'
        classpath 'com.google.gms:google-services:+'
    }
}

I hope that it helps you, tell me if it works.....

Sign up to request clarification or add additional context in comments.

9 Comments

make, cordova clean and cordova prepare before cordova build android
Good for you. However, It didn't work for me. I am still getting the same error. This drives me crazy. Thank you again for your help.
Hi, this answer did fix it for me aswell. What you could maybe try still @Bochey1314 is to first do "ionic cordova platform remove android", then add it back with "ionic cordova platform add android", then make the edits suggested. Just to make sure there is nothing stale in the android build.
i am using cordova 8.. try to change your build:gradle version, go to android/build.gradle and change by classpath 'com.android.tools.build:gradle:3.2.1'
@MarcBorni Nope. didn't work. I tried to downgraded to 7.1.0 but it was changed back to 7.1.4 as soon as I did a build again.
|
0

Finally, I was able to fix this issue with Christian rodrigue's solution using a fresh copy of the ionic4 template. It was a bit tedious and troublesome. But at least it is working now. So basically, I use ionic start to get a new copy of the template and then added this plugin right away to see if it works. After I confirm that it is working, I then moved all the business logic to the new copy. Something is acting up in my old copy. I don't know what the exact cause is. Hope this help if you got into a similar situation like mine.

One thing I noticed that this error comes back if I upgrade the gradle in Android studio. So avoid upgrading if it prompt for now.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.