[英]Running react-native run-android shows “build failed with an exception”
Yesterday I could run android app perfectly but I don't know why, this morning I did react-native run-android like all days I work and it threw me BUILD FAILED with: 昨天我可以完美地运行android应用,但我不知道为什么,今天早上我像所有工作一样都在做本机运行android,这使我的构建失败:
- What went wrong: A problem occurred configuring project ':app'.
出了什么问题:配置项目':app'时发生问题。
Could not resolve all dependencies for configuration ':app:_debugApk'.
无法解析配置':app:_debugApk'的所有依赖项。 A problem occurred configuring project ':react-native-device-info'.
配置项目':react-native-device-info'时发生问题。 Could not find runtime.jar (android.arch.lifecycle:runtime:1.0.0).
找不到runtime.jar(android.arch.lifecycle:runtime:1.0.0)。 Searched in the following locations: https://jcenter.bintray.com/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.jar
在以下位置搜索: https : //jcenter.bintray.com/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.jar
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
确保已运行Android模拟器或已连接设备,并已设置Android开发环境: https : //facebook.github.io/react-native/docs/getting-started.html
I have been searching solutions to the error but they doesn't works. 我一直在寻找错误的解决方案,但它们不起作用。 One of the things I tried was this but with no solution:
我尝试过的其中一件事情是但没有解决方案:
chmod 755 android/gradlew
chmod 755安卓/ gradlew
I emphasize that yesterday was working normaly, is a project with so much time ago. 我强调昨天工作正常,是一个时间很久的项目。 I think could be something related with the sdk but I don't move very well with it.
我认为可能与sdk有关,但是我对此并不满意。 Someone know what could be?
有人知道会是什么吗? In IOS works perfectly.
在IOS中完美运行。
Same problem here today. 今天在这里同样的问题。 I just clean gradle cache and got the same exception.
我只是清理gradle缓存,并得到相同的异常。
$ ./gradlew clean Incremental java compilation is an incubating feature. $ ./gradlew clean增量Java编译是一个令人兴奋的功能。
FAILURE: Build failed with an exception. 失败:构建失败,发生异常。
Could not resolve all dependencies for configuration ':app:_debugApk'.
无法解析配置':app:_debugApk'的所有依赖项。 A problem occurred configuring project ':react-native-device-info'.
配置项目':react-native-device-info'时发生问题。 Could not find runtime.jar (android.arch.lifecycle:runtime:1.0.0).
找不到runtime.jar(android.arch.lifecycle:runtime:1.0.0)。 Searched in the following locations: https://jcenter.bintray.com/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.jar
在以下位置搜索: https : //jcenter.bintray.com/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.jar
The file is missing here : https://jcenter.bintray.com/android/arch/lifecycle/runtime/1.0.0/ 该文件在此处丢失: https : //jcenter.bintray.com/android/arch/lifecycle/runtime/1.0.0/
// Update solution found here //更新解决方案在这里
Just set on project buikd.gradle : 只需在项目buikd.gradle上设置:
maven { url 'https://maven.google.com' }
Before the jcenter() and everything is OK. 在 jcenter() 之前 ,一切正常。
allprojects { repositories { mavenLocal() maven { url 'https://maven.google.com' } jcenter() maven { url "$rootDir/../node_modules/react-native/android" } } }
from https://github.com/rebeccahughes/react-native-device-info/issues/414 来自https://github.com/rebeccahughes/react-native-device-info/issues/414
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.