I solved this issue by changing the version of below libraries to '16.1.0', in build.gradle file of react-native-push-notification.
com.google.android.gms:play-services-gcm --> '16.1.0' // default +
com.google.firebase:firebase-messaging --> '15.0.2' . // default +
thanks @engylemure for his easy solution.
My react-native-push-notification build.gradle file now looks like
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.library'
def DEFAULT_GOOGLE_PLAY_SERVICES_VERSION = "16.0.1"
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
android {
compileSdkVersion safeExtGet('compileSdkVersion', 28)
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 28)
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
def googlePlayServicesVersion = rootProject.hasProperty('googlePlayServicesVersion') ? rootProject.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation "com.android.support:appcompat-v7:${safeExtGet('supportLibVersion', '28.0.0')}"
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
implementation "com.google.android.gms:play-services-gcm:$googlePlayServicesVersion"
implementation 'me.leolin:ShortcutBadger:1.1.8@aar'
implementation "com.google.firebase:firebase-messaging:$googlePlayServicesVersion"
}
This issue is caused by breaking changes in latest version of google libraries where androidx and support libraries cannot coexist.
Hope it will work :)
Still doesn't work any other ideas?
@Webbgrey try this link to understand and solve the issue
@faisal3413 Still doesn't work. I tried all versions but seems like there is no hope.
@Webbgrey run below command
cd android && ./gradlew :app:dependencies
and saerch and find for 'androidx' to know which modules have been using androidx, then downgrade google libraries versions like
com.google.android.gms:play-services-gcm
com.google.firebase:firebase-messaging
@faisal3413 thanks, it worked for me. :)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.google.firebase:firebase-messaging:15.0.1.
Searched in the following locations:
- file:/C:/Users/KadakWeb-PC/.m2/repository/com/google/firebase/firebase-messaging/15.0.1/firebase-messaging-15.0.1.pom
- file:/C:/Users/KadakWeb-PC/.m2/repository/com/google/firebase/firebase-messaging/15.0.1/firebase-messaging-15.0.1.jar
- https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-messaging/15.0.1/firebase-messaging-15.0.1.pom
- https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-messaging/15.0.1/firebase-messaging-15.0.1.jar
- https://jcenter.bintray.com/com/google/firebase/firebase-messaging/15.0.1/firebase-messaging-15.0.1.pom
- https://jcenter.bintray.com/com/google/firebase/firebase-messaging/15.0.1/firebase-messaging-15.0.1.jar
- file:/C:/Users/KadakWeb-PC/Desktop/example/firebase/node_modules/react-native/android/com/google/firebase/firebase-messaging/15.0.1/firebase-messaging-15.0.1.pom
- file:/C:/Users/KadakWeb-PC/Desktop/example/firebase/node_modules/react-native/android/com/google/firebase/firebase-messaging/15.0.1/firebase-messaging-15.0.1.jar
Required by:
project :app > project :react-native-push-notification
I just getting this
@Webbgrey this is other issue, try to add
implementation 'com.google.firebase:firebase-messaging:15.0.2'
in dependencies of android/app/build.gradle file and try to sync with android studio.
@faisal3413 Oh my god what a problematic module
* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.google.android.gms:play-services-gcm:15.0.2.
Searched in the following locations:
- file:/C:/Users/KadakWeb-PC/.m2/repository/com/google/android/gms/play-services-gcm/15.0.2/play-services-gcm-15.0.2.pom
- file:/C:/Users/KadakWeb-PC/.m2/repository/com/google/android/gms/play-services-gcm/15.0.2/play-services-gcm-15.0.2.jar
- https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-gcm/15.0.2/play-services-gcm-15.0.2.pom
- https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-gcm/15.0.2/play-services-gcm-15.0.2.jar
- https://jcenter.bintray.com/com/google/android/gms/play-services-gcm/15.0.2/play-services-gcm-15.0.2.pom
- https://jcenter.bintray.com/com/google/android/gms/play-services-gcm/15.0.2/play-services-gcm-15.0.2.jar
- file:/C:/Users/KadakWeb-PC/Desktop/example/firebase/node_modules/react-native/android/com/google/android/gms/play-services-gcm/15.0.2/play-services-gcm-15.0.2.pom
- file:/C:/Users/KadakWeb-PC/Desktop/example/firebase/node_modules/react-native/android/com/google/android/gms/play-services-gcm/15.0.2/play-services-gcm-15.0.2.jar
Required by:
project :app > project :react-native-push-notification
For solving this issue i would recommend to define explicitly the version for the ext variables
at the android/build.gradle at your root project
ext {
googlePlayServicesVersion = "16.1.0" // default: "+"
firebaseVersion = "15.0.2" // default: "+"
// Other settings
compileSdkVersion = <Your compile SDK version> // default: 23
buildToolsVersion = "<Your build tools version>" // default: "23.0.1"
targetSdkVersion = <Your target SDK version> // default: 23
supportLibVersion = "<Your support lib version>" // default: 23.1.1
}
try this:
add these two lines into the file './android/gradle.properties':
android.useAndroidX=true
android.enableJetifier=true
and then:
npm install --save-dev jetifier
npx jetify
npx react-native run-android
edit: typo (npx jetifier to npx jetify)
@bhlshrf That's working for me, thank you.
thank you @engylemure you save my life
Published forked version with hardcoded (pre androidx) packages:
@capjavert/react-native-push-notification
Solved it like this because some other packages also depend on ext param googlePlayServicesVersion and I couldn't match versions to satisfy my build.
@capJavert @faisal3413 it works for me.
But, i don't change the com.facebook.react:react-native.
Thanks
thanks @engylemure sir, your solution worked for me
@faisal3413 Your solution works perfectly, Thank you :)
Very tricky.
In my case, I unlinked and uninstalled and then installed & linked again, but version 3.1.2 (that doesn't have androidX).
Then I followed @engylemure helpful advice. However, I also had a firebase-analytics version 17.0.2 that I had to lower to 15.0.2 to get it to work.
Hi,
when i changed the version of googlePlayServicesVersion and firebaseVersion , i can't build in android.
Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
Could not find com.google.android.gms:play-services-vision:16.1.0.
Searched in the following locations:
- file:/Users/mac/Library/Android/sdk/extras/m2repository/com/google/android/gms/play-services-vision/16.1.0/play-services-vision-16.1.0.pom
- file:/Users/mac/Library/Android/sdk/extras/m2repository/com/google/android/gms/play-services-vision/16.1.0/play-services-vision-16.1.0.jar
Hi,
when i changed the version of googlePlayServicesVersion and firebaseVersion , i can't build in android.
Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.Could not find com.google.android.gms:play-services-vision:16.1.0.
Searched in the following locations:
- file:/Users/mac/Library/Android/sdk/extras/m2repository/com/google/android/gms/play-services-vision/16.1.0/play-services-vision-16.1.0.pom
- file:/Users/mac/Library/Android/sdk/extras/m2repository/com/google/android/gms/play-services-vision/16.1.0/play-services-vision-16.1.0.jar
Same problem here
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.
Most helpful comment
For solving this issue i would recommend to define explicitly the version for the ext variables
at the
android/build.gradleat your root project