Reputation: 61
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.
Upvotes: 2
Views: 1135
Reputation: 61
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.....
Upvotes: 4
Reputation: 61
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.
Upvotes: 0