EDIT by @kelset:
TL;DR:
:+
form in their gradle configuration:+
gradlew app:dependencies
and searching the output for androidx
(more details here)Please refer to this comment (and the follow ups) for more details on how to fix - in particular, for debugging, read this comment.
React Native version: 0.58.0
Platform : android
Here are android version:
buildToolsVersion = "27.0.3"
minSdkVersion = 19
compileSdkVersion = 26
targetSdkVersion = 26
supportLibVersion = "26.1.0"
Building app on android before today is working fine.
and suddenly got this issue in android manifest file
.......\android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:46:
AAPT: No resource identifier found for attribute 'appComponentFactory' in package 'android'
1.
2.
Describe what you expected to happen:
Snack, code example, or link to a repository:
getting same issue
i am getting same issue
com.android.build.api.transform.TransformException: Error while generating the main dex list:
Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy
I am facing same issue. screenshot attached.
Environment -
react native - 0.57.8
node - 11.4.0
npm - 6.4.1
OS - windows 10
my build.gradle file -
build.txt
I also follow link mentioned below but no success -
https://github.com/facebook/react-native/commit/8e39451512b6c61e97c44b8c3091d97d62027fec
getting same issue...
how to resovle it?
@MR03web any idea how to resolve this ?
Same issue. This happened a few hours ago. RN version 0.59.8
Getting same issue. Yesterday it worked good.
+1 same issue
I am update all dependencies (skip react and react-native). It working for me.
Same issue!!
What happened?
../../../.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/500aadd2483a9fea57affdc292d0d8fc/res/values/values.xml |
-- | --
error: resource android:attr/ttcIndex not found. |
same issue
I need help!
I guess the problem is google play service and firebase just released
https://developers.google.com/android/guides/releases
update:
The root cause is related to androidx, google play service...
try upgrade project to androidx
This problem seems to be triggered by the version of react-native-device-info?
2.1.2 constrain play services dependency to pre-AndroidX 16.1.0
react-native-device-info
yarn upgrade [email protected]
cd android && gradlew clean
react-native run-android
It working for me.
This works for me.
Upgrade your project to androidx
https://developer.android.com/jetpack/androidx/migrate
And you need to update your dependencies to androidx as well.
Here's a gist to update all dependencies automatically to androidx
https://gist.github.com/janicduplessis/df9b5e3c2b2e23bbae713255bdb99f3c
@richieroldan cheers mate
after making changes suggested by @richieroldan i am getting another issues
node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessagingService.java:51: error: cannot find symbol
This works for me.
Upgrade your project to androidx
https://developer.android.com/jetpack/androidx/migrateAnd you need to update your dependencies to androidx as well.
Here's a gist to update all dependencies automatically to androidx
https://gist.github.com/janicduplessis/df9b5e3c2b2e23bbae713255bdb99f3c
How did you upgrade to androidx by refactoring on androis studio or setting
android.useAndroidX=true
android.enableJetifier=true
in gradle.properties ?
after making changes suggested by @richieroldan i am getting another issues
node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/messaging/RNFirebaseMessagingService.java:51: error: cannot find symbol
What's in RNFirebaseMessagingService.java:51 ?
sorry I'm not using firebase right now.
@cosivox Both
How to solve this without migrating to AndroidX?
@richieroldan yes i am using firebase, it was working very well till yesterday
@Chi-AnTai referred to this earlier and this is the answer. Just follow steps on google dev website. Confirmed working for us now.
https://developers.google.com/android/guides/releases
Happy building.
OK, thanks @MR03web
What solve my problem is first upgrade [email protected] follow @MR03web
then change android build.gradle
compileSdkVersion to 28
buildToolsVersion to 28.0.3
change gradle-wrapper.properties
https\://services.gradle.org/distributions/gradle-4.4-all.zip to 4.6
upgrade Android Studio and from Android Studio Refator => Migrate to AndroidX (before AS upgrade the migration said my android version is not 28 even though my build.gradle is really 28, after upgrade the AS ask me to configure project and the configuration window said my android version is a variable instead of a real number so I change it to 28 and finally I can migrate)
I am not sure every step is necessary, I just list what I have done and hope this can help someone.
The process is very similar to https://developers.google.com/android/guides/releases, I guess I fail this at first because my Android Studio is not upgrade.
@matthiasleitner
How to solve this without migrating to AndroidX?
I fixed it via https://github.com/facebook/react-native/issues/25292#issuecomment-502998885
update:
The root cause is related to androidx, google play service...
try upgrade project to androidxThis problem seems to be triggered by the version of react-native-device-info?
2.1.2 constrain play services dependency to pre-AndroidX 16.1.0
react-native-device-infoyarn upgrade [email protected]
cd android && gradlew clean
react-native run-android
It working for me.https://github.com/facebook/react-native/issues/25293#issuecomment-503008149 !
Thanks https://github.com/MR03web that solved my problem!
Without the need to migrate to AndroidX!
[email protected]
use com.google.android.gms:play-services-gcm:+
library triggered my problem.
Update app/build.gradle
:
implementation(project(":react-native-device-info"), {
exclude group: "com.google.android.gms"
})
implementation "com.google.android.gms:play-services-gcm:16.0.0"
React Native version: 0.57.5
Platform : android
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
How to solve this without migrating to AndroidX?
See: https://github.com/facebook/react-native/issues/25293#issuecomment-503035236
Same happens to projects that don't make use of 'react-native-device-info'
hey @nodece thanks for the investigation, that seems to be the root cause!
It seems that google released a new version of their Play Services, and in particular com.google.android.gms:play-services-gcm
- so if you are depending on latest (via something like com.google.android.gms:play-services-gcm:+
) then you need to change it to instead rely on the previous version, in the example 16.0.0
.
So you may have to do something like
implementation(project(":react-native-device-info"), {
exclude group: "com.google.android.gms"
})
implementation "com.google.android.gms:play-services-gcm:16.0.0"
I'm going to close this, as it seems to be caused by third-party libraries and not react native per-se - if something else pops up please comment ahead!
EDIT: if you are still experiencing the issue, it's likely one of these two reasons:
1) you have other libraries (not device-info) that depend on latest, and you need to debug/find out which ones
2) you need to clean the gradle cache, you can use this: ./gradlew cleanBuildCache
& ./gradlew clean
from the /android folder
If it's neither because of these, please provide a repro so that it can be investigated.
@kelset I follow the same steps but no success. I still getting same error.
Same problem introduced by latest firebase (see https://firebase.google.com/support/release-notes/android#update_-_june_17_2019)
I ended up using previous version as a workaround
implementation "com.google.android.gms:play-services-gcm:16.0.0"
implementation "com.google.firebase:firebase-messaging:17.0.0"
react-native-push-notifications library allows to set these versions in gradle.properties as
googlePlayServicesVersion=16.0.0
firebaseVersion=17.0.0
In other cases you may need exclude from above
same issue with:
React Native version: 0.55.4
Platform : android
Here are android version:
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
Building app on android before today is working fine.
and suddenly got this issue in android manifest file
.......\android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:66: AAPT: No resource identifier found for attribute 'appComponentFactory' in package 'android'
For those who have installed the react-native-video package in their project, you must also fix the version of googlePlayServicesVisionVersion.
googlePlayServicesVisionVersion=15.0.2
@Otik133040040 Use the previous versions as suggested..I did the following changes:
implementation(project(":react-native-device-info"), {
exclude group: "com.google.android.gms"
})
implementation(project(":react-native-push-notification"), {
exclude group: "com.google.android.gms"
exclude group: "com.google.firebase"
})
implementation "com.google.firebase:firebase-messaging:17.0.0"
implementation "com.google.android.gms:play-services-gcm:16.0.0"
Hey everyone, please check the build.gradle in the third-party dependencies if you still get same error.
In general google updated their gms package, so whichever third party libraries are using it should also update. So update your libraries.
` implementation project(':react-native-firebase')
implementation (project(':react-native-google-analytics-bridge')) {
exclude group: 'com.google.android.gms'
}
implementation project(':react-native-firebase-analytics')
// Firebase dependencies
implementation "com.google.android.gms:play-services-base:15.0.1"
implementation "com.google.firebase:firebase-core:16.0.3"
implementation "com.google.firebase:firebase-analytics:16.0.1"
// compile project(':react-native-google-analytics-bridge')
implementation project(':react-native-vector-icons')
implementation project(':react-native-image-picker')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation(project(':react-native-fbsdk')) {
exclude(group: 'com.facebook.android', module: 'facebook-android-sdk')
}
implementation('com.facebook.android:facebook-android-sdk:4.22.1')
implementation "com.google.firebase:firebase-auth:16.0.2"
implementation project(':react-native-image-crop-picker')
implementation project(':react-native-onesignal')
// compile project(':react-native-fcm')
implementation 'com.google.firebase:firebase-messaging:17.6.0'
implementation 'com.android.support:multidex:1.0.1'
implementation project(':react-native-appsflyer')
implementation project(':react-native-app-auth')
}`
@mihaidaviddev my depedencies, what should i change for this depedencies?
depedencies: https://pastebin.com/XZXbppJZ
@alebedev @mihaidaviddev Can you please share more details of downgrading firebase messaging?
Just changing
implementation 'com.google.firebase:firebase-messaging:17.0.0
doesnt work as it results in
The library com.google.firebase:firebase-iid is being requested by various other libraries at [[19.0.0,19.0.0], [16.0.0,16.0.0]], but resolves to 19.0.0
for me.
Can you please post your dependencies list? Want to check if you also have
'implementation 'com.google.firebase:firebase-core'
@quarryman the versions are wrong..find out why com.google.firebase:firebase-iid requested version is 19.0.0.. this is the latest version as of yesterdays update.. https://developers.google.com/android/guides/releases
Here you can see the dependencies of firebase-messaging 17.0.0. (firebase-iid 16.0.0)
https://mvnrepository.com/artifact/com.google.firebase/firebase-messaging/17.0.0
@Otik133040040 I would look in every plugin in node_modules android/build.gradle and find if the plugin is using a new version listed in the release note..then I would make the changes suggested by nodece and kelset
I hope it helps..
As the current maintainer of react-native-device-info we did have a loose ('+') dependency in our build.gradle, but it also checked if you specified a version in android/build.gradle first. You should ALWAYS specify your versions like that in android/build.gradle so that you are not subject to 3rd party module defaults (which may either be loose ('+') or just some incompatible version.
Hope everyone gets their gradle files sorted out and has successful builds today
dependencies {
implementation "com.google.firebase:firebase-messaging:17.0.0"
implementation("com.google.android.gms:play-services-gcm:16.0.0") {
exclude group: "com.google.android.gms"
}
implementation project(':react-native-device-info'), {
exclude group: "com.google.android.gms"
}
implementation project(':react-native-exception-handler')
implementation project(':react-native-image-picker')
implementation project(':react-native-image-crop-picker')
implementation project(':react-native-android-location-enabler')
implementation project(':react-native-svg')
implementation project(':react-native-push-notification'), {
exclude group: "com.google.android.gms"
exclude group: "com.google.firebase"
}
implementation project(':@react-native-community_async-storage')
implementation project(':react-native-vector-icons')
implementation project(':react-native-maps')
implementation project(':react-native-gesture-handler')
implementation fileTree(dir: "libs", include: [".jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation fileTree(dir: "libs", include: [".jar"])
implementation project(':react-native-navigation')
implementation project(':react-native-contacts')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-geocoder')
implementation(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation 'com.facebook.fresco:animated-gif:1.10.0'
implementation project(':react-native-image-picker')
}
my dependencies and still have this issue
update:
The root cause is related to androidx, google play service...
try upgrade project to androidxThis problem seems to be triggered by the version of react-native-device-info?
2.1.2 constrain play services dependency to pre-AndroidX 16.1.0
react-native-device-infoyarn upgrade [email protected] cd android && gradlew clean react-native run-android
It working for me.
It working for me after upgrade react-native-device-info
to 2.1.2
I have been solving this for hours
The most successful solution was to migrate to AndroidX, other solution was headache because of using many dependencies
This is really a problem for someone needs to send a new update urgently and every thing was working fine then suddenly nothing works
A better way to fix asap is to fix google dependencies versions.
The issue come from your project dependencies. They may implement google dependencies with a :+
.
This lead to add some AndroidX dependencies. Your app can only implement support or androidx. Since new versions are compatible androidx, it create issues.
Search in your node_modules if a package implement things like com.google.android.gms:play-services-gcm:+
.
See : https://developers.google.com/android/guides/releases
I use react-native-device-info
and react-native-google-analytics-bridge
and both check a googlePlayServicesVersion
variable for a version.
I add googlePlayServicesVersion = '16.+'
in android/build.gradle
:
buildscript {
ext {
googlePlayServicesVersion = '16.+'
And it works for me.
Is it possible to overwrite some dependencies from the root project?
react-native-device-info version is 2.1.2
It seems related to another dependency.
@adnkh, how to migrate to AndroidX ?
Nothing seems to work to me.
Tried all above and none worked.
If using zo0r/react-native-push-notification
,
specify exact versions in android/build.gradle
:
buildscript {
ext {
...
googlePlayServicesVersion = "16.1.0"
firebaseVersion = "17.3.4"
...
}
}
@thodubois
buildscript {
ext {
googlePlayServicesVersion = '16.+'
And it works for me.
Not working in my case.
Here is my project dependencies -
dependencies {
implementation 'com.android.support:design:27.1.0'
compile project(':react-native-code-push')
compile project(':appcenter')
compile project(':appcenter-analytics')
compile project(':appcenter-crashes')
compile project(':react-native-smart-splashscreen')
compile (project(':react-native-device-info')) {
exclude group: "com.google.android.gms"
}
compile project(':react-native-background-timer')
compile project(':react-native-tts')
compile project(':react-native-fetch-blob')
compile project(':react-native-background-job')
compile project(':react-native-ble-plx')
compile fileTree(dir: "libs", include: ["*.jar"])
compile 'com.android.support:appcompat-v7:23.0.1'
compile "com.facebook.react:react-native:+" // From node_modules
compile project(':react-native-sqlite-storage')
compile project(':react-native-push-notification')
compile project(':react-native-fabric')
compile project(':react-native-preference')
compile project(':react-native-localization')
compile project(':react-native-android-location-services-dialog-box')
compile project(':react-native-bluetooth-status')
implementation project(':react-native-charts-wrapper')
compile project(':react-native-android-wifi')
compile project(':react-native-vector-icons')
compile project(':react-native-fs')
compile('com.crashlytics.sdk.android:crashlytics:2.9.7@aar') {
transitive = true;
}
compile project(':react-native-nordic-dfu')
compile project(':react-native-barcode-scanner-google')
implementation 'com.google.android.gms:play-services-vision:15.0.2'
implementation 'com.android.support:multidex:1.0.3'
compile project(':@merryjs/photo-viewer')
compile project(':react-native-zip-archive')
compile project(':react-native-navigation')
compile project(':react-native-exception-handler')
compile ('com.android.support:exifinterface:26.+') {
exclude group: "com.android.support"
}
compile (project(':react-native-camera')) {
exclude group: "com.google.android.gms"
exclude group: "com.android.support"
compile ('com.google.android.gms:play-services-vision:15.0.2') {
force = true
}
}
compile(project(':react-native-maps')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
compile 'com.google.android.gms:play-services-base:+'
compile 'com.google.android.gms:play-services-maps:+'
}
getting same issue
same issue here
try change in your android/build.gradle file
buildscript {
ext {
...
googlePlayServicesVersion = "16.0.0"
firebaseVersion = "17.3.4"
...
}
}
@hrachqyutukyan Migrate to AndroidX is too expensive, [email protected]
is work.
@divyanshupathak94
compile 'com.google.android.gms:play-services-base:+'
compile 'com.google.android.gms:play-services-maps:+'
Change to the following, any version that is not the latest 17.0.0
compile 'com.google.android.gms:play-services-base:16.1.0'
compile 'com.google.android.gms:play-services-maps:16.1.0'
@nodece Are you using compileSdkVersion 28?
Anyone there is using react-native-navigation
when I try to downgrade to compileSdkVersion 27
it gives me an error:
Could not get unknown property 'mergeResourcesProvider' for object of type com.android.build.gradle.internal.api.ApplicationVariantImpl.
@hrachqyutukyan Migrate to AndroidX is too expensive,
[email protected]
is work.
@nodece
but when you have a lot of deps, it will be very difficult
@nodece Are you using compileSdkVersion 28?
Android ENV
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 27
targetSdkVersion = 26
supportLibVersion = "27.1.1"
@nodece
Anyone there is using
react-native-navigation
when I try to downgrade tocompileSdkVersion 27
it gives me an error:Could not get unknown property 'mergeResourcesProvider' for object of type com.android.build.gradle.internal.api.ApplicationVariantImpl.```
@nodece what version of react-native are you using? I'm on 0.59.9 and getting the above error.
:/
@hrachqyutukyan Migrate to AndroidX is too expensive,
[email protected]
is work.@nodece
but when you have a lot of deps, it will be very difficult
Migrating AndroidX is the same.
@nodece
Anyone there is using
react-native-navigation
when I try to downgrade tocompileSdkVersion 27
it gives me an error:Could not get unknown property 'mergeResourcesProvider' for object of type com.android.build.gradle.internal.api.ApplicationVariantImpl.```
@nodece what version of react-native are you using? I'm on 0.59.9 and getting the above error.
:/
RN: 0.57.5
@nodece could you show us your app/build.gradle
please?
For me it's just impossible to build this sh...t!!
// REMOVED BUILD GRADLE - @kelset
I know it's too big, but thanks in advance if someone can help me.
Google service upgrade seems to be the root cause, I suggest that check build.gradle
in node_module.
@kelset Thanks for the workaround! For anyone else that is still having issues, please pay special attention to kelset's comment above:
you have other libraries (not device-info) that depend on latest, and you need to debug/find out which ones
I had another third-party dependency (react-native-google-analytics-bridge
) which specified in its build.gradle
file the following: com.google.android.gms:play-services-analytics:+
. Taking a look over at the Google Android APIs release notes page, there were breaking updates to the whole com.google.android.gms group of APIs on 17th June 2019. To fix my issue, I added the following to my android/app/build.gradle
file:
implementation(project(":react-native-google-analytics-bridge`"), {
exclude group: "com.google.android.gms"
})
implementation "com.google.android.gms:play-services-analytics:16.0.8"
Make sure to check through all your third-party dependency android/build.gradle
files and to look in particular for any com.google.android.gms:<API-name>:+
patterns, which will be pulling the latest APIs. Then head over to the Google APIs release notes page and find the latest 16.x.x update, which should hopefully fix any issues.
Thanks @bonesyblue for the write up, it's way more clear than mine 😅🙇♂️
Given that this issue sort of spinned out of control a bit, I'll lock it for now to keep your comment as the one people will land on 👍
Most helpful comment
hey @nodece thanks for the investigation, that seems to be the root cause!
It seems that google released a new version of their Play Services, and in particular
com.google.android.gms:play-services-gcm
- so if you are depending on latest (via something likecom.google.android.gms:play-services-gcm:+
) then you need to change it to instead rely on the previous version, in the example16.0.0
.So you may have to do something like
I'm going to close this, as it seems to be caused by third-party libraries and not react native per-se - if something else pops up please comment ahead!
EDIT: if you are still experiencing the issue, it's likely one of these two reasons:
1) you have other libraries (not device-info) that depend on latest, and you need to debug/find out which ones
2) you need to clean the gradle cache, you can use this:
./gradlew cleanBuildCache
&./gradlew clean
from the /android folderIf it's neither because of these, please provide a repro so that it can be investigated.