After ran:
yarn add react-native-onesignal
react-native link react-native-onesignal
when try to build the project got this error:
Error:Execution failed for task ':app:processDev19DebugManifest'. > Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.1) from [com.android.support:cardview-v7:26.0.1] AndroidManifest.xml:25:13-35 is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0). Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:23:9-25:38 to override.
Any help? How to solve it? thanks
paste my old onesignal build.gradle got it working.. please can anyone provide a good solution for that?
````
apply plugin: 'com.android.library'
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
android {
compileSdkVersion safeExtGet('compileSdkVersion', 23)
buildToolsVersion safeExtGet('buildToolsVersion', '23.0.1')
defaultConfig {
// Do NOT change these values here, set them in your android/app/build.gradle instead
manifestPlaceholders = [onesignal_app_id: '', onesignal_google_project_number: 'REMOTE']
minSdkVersion safeExtGet('minSdkVersion', 16)
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '25.0.0'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
compile('com.onesignal:OneSignal:3.8.3') {
// Exclude com.android.support(Android Support library) as the version range starts at 26.0.0
// This is due to compileSdkVersion defaulting to 23 which cant' be lower than the support library version
// And the fact that the default root project is missing the Google Maven repo required to pull down 26.0.0+
exclude group: 'com.android.support'
// Keeping com.google.android.gms(Google Play services library) as this version range starts at 10.2.1
}
testCompile 'junit:junit:4.12'
}
// Add the following to the top (Line 1) of your app/build.gradle if you run into any issues with duplicate classes.
// Such as the following error
// Error: more than one library with package name 'com.google.android.gms.license'
/*
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
*/
````
had a look at it the problem is this line.. maybe @arr is missing
compile('com.onesignal:OneSignal:3.8.3') {
// Exclude com.android.support(Android Support library) as the version range starts at 26.0.0
// This is due to compileSdkVersion defaulting to 23 which cant' be lower than the support library version
// And the fact that the default root project is missing the Google Maven repo required to pull down 26.0.0+
exclude group: 'com.android.support'
// Keeping com.google.android.gms(Google Play services library) as this version range starts at 10.2.1
}
what works for me was add @arr to com.onesignal:OneSignal:3.8.3
compile('com.onesignal:OneSignal:3.8.3@arr') {
// Exclude com.android.support(Android Support library) as the version range starts at 26.0.0
// This is due to compileSdkVersion defaulting to 23 which cant' be lower than the support library version
// And the fact that the default root project is missing the Google Maven repo required to pull down 26.0.0+
exclude group: 'com.android.support'
// Keeping com.google.android.gms(Google Play services library) as this version range starts at 10.2.1
}
can anyone validate the solution/workaround pls?
I just removed Dev19 flavor
@faustoct I get Could not find OneSignal.arr (com.onesignal:OneSignal:3.8.3) after I made the change according to you suggestion! Has it worked for anyone this? I am having trouble fixing onesignal with react native for two days, does anyone have any git version of react native detached with onesignal working?
this would be quite helpful
@Symyon does that mean by removing Dev19 solved this issue? I tried it didnt!
@faustoct @lulzimfazlija The error is due to a mixture of different com.android.support group versions being resolved. Can you try adding the following to the top of your app/build.gradle?
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.8.2, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
This Gradle plugin should align these modules to correct the issue.
@lulzimfazlija
My build.gradle (app) compile statement looks a little different. I have
compile(project(':react-native-onesignal')) {
exclude group: "com.google.android.gms"
}
the exclude part is because of the other conflict, so you should be good with only:
compile project(':react-native-onesignal')
I have one signal notification working. I am detached.
Another thing is that Android Studio will remove some of the projects saying
The modules below are not imported from Gradle anymore: react-native-onesignal~1
Open dialog to restore removed modules
The "Open" usually is clickable and you get a dialog to restore the project. All this is when you open for the first time the Android project (lets say after removing node_modules and installing them back). All subsequent opening of AS will not give you this notification and I have no idea how to restore a project from another menu. What I do, is remove the node_modules once again, install them once again, and be careful to not miss any of the notifications AS is giving me.
Glad to hear it's working for you, if you have any further issues @Symyon or @lulzimfazlija please feel free to ask.
Most helpful comment
@faustoct @lulzimfazlija The error is due to a mixture of different
com.android.supportgroup versions being resolved. Can you try adding the following to the top of yourapp/build.gradle?This Gradle plugin should align these modules to correct the issue.