react-native build release android BUILD FAILED duplicate entry zza.class - react-native

My react-native app use react-native-fcm and react-native-maps, it work well on debug but FAILED when assembleRelease
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/common/api/zza.class
my android/app/build.gradle
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.xxx.xxx"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
multiDexEnabled true
}
dependencies {
compile project(':react-native-maps')
compile project(':react-native-fcm')
compile project(':react-native-camera')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
and android/build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
Any solution please.

I found the solution: go to node_modules/react-native-maps/android/build.gradle and edit version to :+ and its work :D
dependencies {
compile 'com.facebook.react:react-native:+'
compile "com.google.android.gms:play-services-base:+"
compile 'com.google.android.gms:play-services-maps:+'
}

Related

Build failed with an exception in react-native-navigation package

I have added react-navigation library. I have installed Package and add dependencies too in app/build.gradle and android/setting.gradle. But after configuring about 66 i got error
" Task :app:preDebugBuild FAILED
FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
Could not find com.android.support:appcompatv7:28.0.0.
Required by:
project :app"
Add/replace the following code on build.gragle (project):
buildscript {
repositories {
google()
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google()
mavenCentral()
mavenLocal()
jcenter()
maven {
url "$rootDir/../node_modules/react-native/android"
}
maven { url 'https://jitpack.io' }
}
}
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 19
compileSdkVersion = 26
targetSdkVersion = 26
supportLibVersion = "26.1.0"
}
Update project dependencies in android/app/build.gradle:
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.yourproject"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+"
implementation project(':react-native-navigation')
}
And after that run:
cd android && ./gradlew clean
Finally come back to your project and:
react-native run-android

React Native : Task :react-native-maps:compileDebugRenderscript FAILED

I am trying to implement React Native MapView for Android. I did follow github installation instruction but i am facing compilation error when i try to run using react-native run-android command.
Task :react-native-maps:compileDebugRenderscript FAILED
FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all files for configuration ':react-native-maps:debugCompileClasspath'.
Could not resolve com.android.support:support-compat:26.1.0.
Required by:
project :react-native-maps
Cannot find a version of 'com.android.support:support-compat' that satisfies the version constraints:
Dependency path 'MapViewDemo:react-native-maps:unspecified' --> 'com.facebook.react:react-native:0.59.0' --> 'com.android.support:appcompat-v7:28.0.0' -
-> 'com.android.support:support-compat:28.0.0'
Dependency path 'MapViewDemo:react-native-maps:unspecified' --> 'com.facebook.react:react-native:0.59.0' --> 'com.android.support:appcompat-v7:28.0.0' -
-> 'com.android.support:support-core-utils:28.0.0' --> 'com.android.support:support-compat:28.0.0'
Dependency path 'MapViewDemo:react-native-maps:unspecified' --> 'com.facebook.react:react-native:0.59.0' --> 'com.android.support:appcompat-v7:28.0.0' -
-> 'com.android.support:support-fragment:28.0.0' --> 'com.android.support:support-compat:28.0.0'
Dependency path 'MapViewDemo:react-native-maps:unspecified' --> 'com.facebook.react:react-native:0.59.0' --> 'com.android.support:appcompat-v7:28.0.0' -
-> 'com.android.support:support-vector-drawable:28.0.0' --> 'com.android.support:support-compat:28.0.0'
Dependency path 'MapViewDemo:react-native-maps:unspecified' --> 'com.google.android.gms:play-services-base:16.0.1' --> 'com.google.android.gms:play-serv
ices-basement:16.0.1' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-compat:26.1.0'
Dependency path 'MapViewDemo:react-native-maps:unspecified' --> 'com.facebook.react:react-native:0.59.0' --> 'com.android.support:appcompat-v7:28.0.0' -
-> 'com.android.support:support-core-utils:28.0.0' --> 'com.android.support:loader:28.0.0' --> 'com.android.support:support-compat:28.0.0'
'com.android.support:support-annotations' strictly '26.1.0' because of the following rea
son: debugRuntimeClasspath uses version 26.1.0
Constraint path 'MapViewDemo:react-native-maps:unspecified' --> 'com.android.support:support-annotations' strictly '26.1.0' because of the following rea
son: debugRuntimeClasspath uses version 26.1.0
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 5s
8 actionable tasks: 8 executed
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug
App level gradle
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.mapviewdemo"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86-64"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86-64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation project(':react-native-maps')
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-maps')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:28.0.0'
force 'com.android.support:appcompat-v7:28.0.0'
}
}
Project level gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 20
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
Package.json
{
"name": "MapViewDemo",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.8.3",
"react-native": "0.59.0",
"react-native-maps": "^0.23.0"
},
"devDependencies": {
"#babel/core": "7.3.4",
"#babel/runtime": "7.3.4",
"babel-jest": "24.5.0",
"jest": "24.5.0",
"metro-react-native-babel-preset": "0.53.0",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
}
After two day's of struggling i find my solution by my self.The real issue is my project using compileSdkVersion = 28 and react-native-maps node_module using different version of compileSdkVersion.
To solve this issue need to update react-native-maps node_module compileSdkVersion version.
project_name>node_modules>react-native-maps>lib>android>build.gradle
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 20
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
Module compile SDK version and support library version should be same as project compile SDK version and support library version.
this also worked for me.
Modify android/build.gradle as follows
1) Add google() inside repositories
buildscript {
repositories {
jcenter()
// add google() here
google()
2) Update com.android.tools.build.gradle to 3.1.0
buildscript {
repositories {
jcenter()
google()
}
dependencies {
// classpath 'com.android.tools.build:gradle:2.2.3'
// update from 2.2.3 to 3.1.0
classpath 'com.android.tools.build:gradle:3.1.0'
3) Add google() inside repositories after dependencies :
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
}
allprojects {
repositories {
mavenLocal()
jcenter()
// add googgle() here
google()
4) Add android.enableAapt2=false to android/gradle.properties
android.enableAapt2=false // < --- add here
android.useDeprecatedNdk=true
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
5) Update gradle version in android/gradle/wrapper/gradle-wrapper.properties :
// from version 2.14.1
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
// change to 4.10.1
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
6) Run react-native run-android
did you able to make it work ?. i found another solution. in my case, this happens because of the version of react-native (0.59.0). so i change my react-native version in my package.json file form 0.59.0 to ^0.58.6. and the react-native-maps version to ^0.23.0. here are the other steps.
1) in app level settings.gradle, include this
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
2) in project level gradle, remove or comment
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 20
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
(inside buildscript{})
3) also in project level gradle,
change the classpath. build.gradle version to 3.1.1
classpath 'com.android.tools.build:gradle:3.1.1'
also add another url inside maven{} (inside allprojects{})
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "https://maven.google.com"
url "$rootDir/../node_modules/react-native/android"
}
4) now change app level gradle as follows
first, change compileSdkVersion to 28 and add new buildToolVersion
compileSdkVersion 28
buildToolsVersion "27.0.3"
then, change min and target SdkVersion as follows (inside defaultConfig)
defaultConfig {
applicationId "com.mapviewdemo"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
5) in your AndroidManifest.xml,
first add this code. this is to give permission to access location on your device. add this before <aplication> tag.
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
then you have to add your meta-data before </application> tag.
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyBTSDBtI7_dfdfBeYkNAtdQ8sT67HiOuO0VU"/>
(add your own API key for android:value)
6) then run npm install and try whether this working or not. if this isn't working, you have to download Android SDK from android studio. in my case, i downloaded Android 7.0 and 6.0
i solved this problem using this npm install — save “react-native-maps#jerolimov/react-native-maps#fix-rn59rc-compile-issues”
from: https://github.com/react-native-community/react-native-maps/pull/2702
the problem is with React native 0.59+ that compile with compileSdkVersion 28 and maps use 26
After 2 days I found the problem in my project.
I changed the values of compileSdkVersion, supportLibVersion and playServicesVersion in
android/build.gradle and android/app/build.gradle files to the same values as in node_modules/react-native-maps/lib/android/build.gradle and node_modules/react-native-maps/build.gradle files, this worked for me.
Values of compileSdkVersion, supportLibVersion and playServicesVersion are same in all the below files.
in android/build.gradle file:
...
ext {
compileSdkVersion = 28
targetSdkVersion = 27
buildToolsVersion = "28.0.3"
minSdkVersion = 16
supportLibVersion = "28.0.0"
playServicesVersion = "16.1.0" // or set latest version
androidMapsUtilsVersion = "0.5+"
}
...
in android/app/build.gradle file:
...
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.reactnativeapp2"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
...
...
}
...
dependencies {
...
...
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
}
...
in node_modules/react-native-maps/lib/android/build.gradle file:
...
android {
compileSdkVersion safeExtGet('compileSdkVersion', 28)
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 27)
}
}
dependencies {
...
implementation "com.android.support:appcompat-v7:${safeExtGet('supportLibVersion', '28.0.0')}"
implementation "com.google.android.gms:play-services-base:${safeExtGet('playServicesVersion', '16.1.0')}"
implementation "com.google.android.gms:play-services-maps:${safeExtGet('playServicesVersion', '16.1.0')}"
implementation 'com.google.maps.android:android-maps-utils:0.5'
}
...
in node_modules/react-native-maps/build.gradle file:
...
ext {
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = '28.0.0'
playServicesVersion = '16.1.0'
}
...

Error when running app with react-native-maps, Execution failed for task: ':app:transformClassesWithInstantRunForDebug'

I'm trying to add the package 'react-native-maps' to my app.
I started by following the installation guide till I got to the point where I could run the app on my device, but with the map showing only a blank white background and a red border around it. then I looked up those issues: #118 and #684 but I had no luck.
I tried to reset my local repo and redo it using this guide. and I ended up having the following error for which I found no clue yet:
Error:FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: java.io.IOException: Failed to find byte code for com/google/android/gms/maps/GoogleMap$OnPoiClickListener
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 7s
my android/build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.android.tools.build:gradle:3.1.0'
//classpath 'com.android.tools.build:gradle:2.3.3'
//classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}}
allprojects {
repositories {
mavenLocal()
jcenter()
google()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
my android/app/build.gradle:
...
...
android {
compileSdkVersion 23
buildToolsVersion "25.0.0"
dexOptions {
jumboMode true
}
defaultConfig {
applicationId "com.friendture"
minSdkVersion 16
targetSdkVersion 25
versionCode 19
versionName "1.9"
ndk {
abiFilters "armeabi-v7a", "x86"
}
multiDexEnabled true
}
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile project(':react-native-fs')
compile project(':react-native-vector-icons')
compile project(':react-native-restart')
compile project(':react-native-appsee')
compile project(':react-native-contacts')
compile project(':react-native-fbsdk')
compile project(':react-native-fetch-blob')
compile project(':react-native-image-picker')
compile project(':react-native-image-crop-picker')
compile fileTree(dir: "libs", include: ["*.jar"])
compile project(':react-native-fabric')
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile 'com.android.support:multidex:1.0.0'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true
}
compile(project(":react-native-google-signin")){
exclude group: "com.google.android.gms" // very important
}
compile 'com.google.android.gms:play-services-auth:9.0.0' // should be at least 9.0.0
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.google.android.gms:play-services-base:9.0.0'
implementation 'com.google.android.gms:play-services-maps:9.0.0'
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
UPDATE:
I reached the point where the app loads the packager %99.9 then crashes, here's the log I get on the crash:
FATAL EXCEPTION: Thread-6
Process: com.friendture, PID: 7497
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/maps/GoogleMap$OnPoiClickListener;
at com.airbnb.android.react.maps.MapsPackage.createViewManagers(MapsPackage.java:39)
at com.facebook.react.ReactInstanceManager.createAllViewManagers(ReactInstanceManager.java:660)
at com.facebook.react.CoreModulesPackage.createUIManager(CoreModulesPackage.java:220)
at com.facebook.react.CoreModulesPackage.access$200(CoreModulesPackage.java:75)
at com.facebook.react.CoreModulesPackage$8.get(CoreModulesPackage.java:152)
at com.facebook.react.CoreModulesPackage$8.get(CoreModulesPackage.java:149)
at com.facebook.react.LazyReactPackage.createNativeModules(LazyReactPackage.java:81)
at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:106)
at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1009)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:933)
at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:109)
at com.facebook.react.ReactInstanceManager$4.run(ReactInstanceManager.java:743)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.GoogleMap$OnPoiClickListener" on path: DexPathList[[zip file "/data/app/com.friendture-SzJNEe1uEBVylMi5o8IdBQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.friendture-SzJNEe1uEBVylMi5o8IdBQ==/lib/x86, /data/app/com.friendture-SzJNEe1uEBVylMi5o8IdBQ==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.airbnb.android.react.maps.MapsPackage.createViewManagers(MapsPackage.java:39) 
at com.facebook.react.ReactInstanceManager.createAllViewManagers(ReactInstanceManager.java:660) 
at com.facebook.react.CoreModulesPackage.createUIManager(CoreModulesPackage.java:220) 
at com.facebook.react.CoreModulesPackage.access$200(CoreModulesPackage.java:75) 
at com.facebook.react.CoreModulesPackage$8.get(CoreModulesPackage.java:152) 
at com.facebook.react.CoreModulesPackage$8.get(CoreModulesPackage.java:149) 
at com.facebook.react.LazyReactPackage.createNativeModules(LazyReactPackage.java:81) 
at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:106) 
at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1009) 
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:933) 
at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:109) 
at com.facebook.react.ReactInstanceManager$4.run(ReactInstanceManager.java:743) 
at java.lang.Thread.run(Thread.java:764)
Please feel free to ask for any other related information.
Majority of the time the issue is related to version of the various services being installed. As of today I used the latest ver for this service " implementation 'com.google.android.gms:play-services-maps:16.1.0", ie '16.1.0' and the error is gone and build successful

react-native-fbsdk error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'

In my react-native project in android/app/build.gradle i have
...
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "..."
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
...
dependencies {
compile project(':react-native-fbsdk')
compile project(':react-native-vector-icons')
compile project(':react-native-splash-screen')
compile project(':react-native-spinkit')
compile project(':react-native-orientation')
compile project(':react-native-maps')
compile project(':react-native-android-sms-listener')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:26+"
compile "com.android.support:design:26+"
compile "com.android.support:recyclerview-v7:26+"
compile "com.android.support:cardview-v7:26+"
compile "com.facebook.react:react-native:+" // From node_modules
compile("com.crashlytics.sdk.android:crashlytics:2.8.0#aar") {
transitive = true;
}
}
...
but I always get
<mypath> .../node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:15:21-54: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
<mypath> .../node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:15: error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
:react-native-fbsdk:processReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-fbsdk:processReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
Go to React-Native Project : android/build.gradle file and restrict fbsdk Version to 4.28.0.
allprojects {
repositories {
...
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.28.0'
}
}
}
}
If you have another error like below:
Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'`.
You can try:
allprojects {
repositories {
...
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.22.1'
}
}
}
}
Source: rafaesc
you go to YOUR_PROJECT/node_modules/react-native-fbsdk/android/build.gradle
looking for line 19:
dependencies {
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.facebook.react:react-native:+' // support react-native-v0.22-rc+
compile('com.facebook.android:facebook-android-sdk:4.+')
}
change compile('com.facebook.android:facebook-android-sdk:4+') to compile('com.facebook.android:facebook-android-sdk:4.28.0')
It work for me

transformClassesWithJarMergingForDebug TransformException

After updating to android studio 2.1 and while i tried to use new gradle my project started crashing with kinda that:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.>
com.android.build.api.transform.TransformException: java.util.zip.ZipException: >duplicate entry: org/objectweb/asm/tree/AbstractInsnNode.class
Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "application.id.is.here"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding
{
enabled = true
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = true
}
}
repositories {
mavenCentral()
}
dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.mikepenz:materialdrawer:4.6.4#aar') {
transitive = true
}
compile 'com.android.support:multidex:1.0.1+'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.android.support:design:23.1.1'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.vk:androidsdk:+'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.tools.build:gradle:2.1.0+'
compile ('com.google.android.gms:play-services-maps:8.3.0'){
exclude group: 'com.android.support', module: 'support-v4'
}
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.7.2+'
}
configurations {
all*.exclude group: 'commons-logging', module: 'commons-logging'
}
and Top-level build:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0-alpha1'
}
}
allprojects {
repositories {
jcenter()
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
If you have any ideas - please help. None of solvations i found for this problem worked out for me.
Igor's answer worked for me. I had the exact same issue (after getting all those exclusions in there). Kind of a pain getting Android Studio 2.1 running.
Quit Android Studio then clear caches:
cd ~/.gradle/caches
rm -r *
Restart Android Studio and now it should work.