简体   繁体   中英

ReactNative Unable to build for android. react-native-maps:debugRuntimeClasspath

I'm noob using ReactNative, I've cloned a react-native project from bitbucket, I'm getting this error related with react-native-maps.

it having Android emulator running, also sdk configured in local.properties file.

react-native run-android

output this

Task :app:processDebugGoogleServices Parsing json file: C:\\Project\\android\\app\\google-services.json

FAILURE: Build failed with an exception.

  • What went wrong: Could not resolve all files for configuration ':react-native-maps:debugRuntimeClasspath'.

    Failed to transform file 'c1ff7541912b40d9b50e133b545d5364' to match attributes {artifactType=android-symbol-with-package-name} using transform LibrarySymbolTableTransform java.io.IOException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; El contenido no estß permitido en el pr¾logo. Failed to transform file 'c1ff7541912b40d9b50e133b545d5364' to match attributes {artifactType=android-symbol-with-package-name} using transform LibrarySymbolTableTransform java.io.IOException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; El contenido no estß permitido en el pr¾logo.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s 61 actionable tasks: 7 executed, 54 up-to-date 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/android-setup.html

versions I use.

yarn -v
1.5.1

npm -v
5.6.0

node -v
v9.8.0

react-native -version
react-native-cli: 2.0.1
react-native: 0.51.0

gradle dependencies:

dependencies {
    compile project(':react-native-sentry')
    compile project(':react-native-vector-icons')
    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 'com.google.firebase:firebase-core:11.8.0'
    compile 'com.google.firebase:firebase-messaging:11.8.0'
    compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
    compile 'com.squareup.retrofit2:converter-jackson:2.0.0-beta4'
    compile "me.leolin:ShortcutBadger:1.1.21@aar"
    compile project(':react-native-maps')
    compile project(':RCTTwilioChat')
    compile 'com.google.android.gms:play-services-base:11.8.0'
    compile 'com.google.android.gms:play-services-maps:11.8.0'
}

I've tryed react-native link , but it stucks.

If someone could to guide me about how fix this, it would be great. Thank you in advance.

If anyone has the same problem. the problem was some kind of conflict between firebase and react-native-maps's google maps library included. I had to test multiple times removing, changing each version of google play services, but it was not working.

this was my solution:

from android studio I've changed in gradle project file this:

    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.google.gms:google-services:3.2.0'

to

    classpath 'com.android.tools.build:gradle:2.2.3'
    classpath 'com.google.gms:google-services:3.0.0'

I've removed also the jcenter() methods inside repositories{} beccause those are not included in this version.

after that

build > sync
build > clean
build > rebuild

then from powershell

react-native run-android

First make sure your internet connection is working. Sometimes react native apps can't build without internet facility.

If it works run the following command to clean gradle cash.

gradlew clean

Then try it again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM