简体   繁体   English

ReactNative无法为Android构建。 react-native-maps:debugRuntimeClasspath

[英]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. 我不是使用ReactNative的菜鸟,我已经从bitbucket克隆了一个react-native项目,我收到了与react-native-maps相关的错误。

it having Android emulator running, also sdk configured in local.properties file. 它运行的是Android模拟器,也在local.properties文件中配置了sdk。

react-native run-android

output this 输出这个

Task :app:processDebugGoogleServices Parsing json file: C:\\Project\\android\\app\\google-services.json 任务:app:processDebugGoogleServices解析json文件: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'. 出了什么问题:无法解析配置':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; 使用转换LibrarySymbolTableTransform java.io.IOException:无法转换文件'c1ff7541912b40d9b50e133b545d5364'以匹配属性{artifactType = android-symbol-with-package-name}:org.xml.sax.SAXParseException; lineNumber: 1; lineNumber:1; columnNumber: 1; columnNumber:1; El contenido no estß permitido en el pr¾logo. El contenido noestßallowido en elpr¾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; 使用转换LibrarySymbolTableTransform java.io.IOException:无法转换文件'c1ff7541912b40d9b50e133b545d5364'以匹配属性{artifactType = android-symbol-with-package-name}:org.xml.sax.SAXParseException; lineNumber: 1; lineNumber:1; columnNumber: 1; columnNumber:1; El contenido no estß permitido en el pr¾logo. El contenido noestßallowido en elpr¾logo。

  • Try: Run with --stacktrace option to get the stack trace. 尝试:使用--stacktrace选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output. 使用--info或--debug选项运行以获取更多日志输出。

  • Get more help at https://help.gradle.org 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. 1秒内失败,执行61项可执行的任务:执行7项,更新54项无法在设备上安装该应用程序,有关详细信息,请阅读上面的错误。 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 确保已运行Android模拟器或已连接设备,并已设置Android开发环境: 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: gradle依赖项:

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. 我尝试了react-native link ,但是卡住了。

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. 问题是firebase和react-native-maps的google maps库之间存在某种冲突。 I had to test multiple times removing, changing each version of google play services, but it was not working. 我不得不测试多次,删除,更改每个版本的Google Play服务,但均无法正常工作。

this was my solution: 这是我的解决方案:

from android studio I've changed in gradle project file this: 从android studio我更改了gradle项目文件,如下所示:

    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. 我还删除了存储库{}中的jcenter()方法,因为这些版本未包含在其中。

after that 之后

build > sync
build > clean
build > rebuild

then from powershell 然后从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. 如果可行,请运行以下命令清除gradle cash。

gradlew clean

Then try it again. 然后再试一次。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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