2017-01-03 45 views
1

最近我構建使用react-native init新鮮的應用程序。陣營本地新鮮的生成錯誤的編譯到Android設備

運行react-native run-android後,我得到這個錯誤:

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':app:preDexDebug'. 
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_112\bin\java.exe'' finished with non-zero exit value 1 

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

BUILD FAILED 

Total time: 19.52 secs 
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 

(node:3632) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read property 'message' of undefined 
(node:3632) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 

我已經嘗試運行gradlew clean在我的android文件夾,但仍沒有運氣。

任何解決方案?

+0

看看這個問題(http://stackoverflow.com/questions/23847482/error-gradle-execution-failed-for-task-apppredexdebug)和[this one](http:// stackoverflow。 COM /問題/ 25529155/Android的工作室gradle這個錯誤,predexdebug) – martinarroyo

回答

0

有同樣的問題,很多故障排除後,我發現了Android項目已損壞。以下是我固定的礦:

從項目文件夾:

  1. rm -rf android
  2. react-native upgrade

注:只是運行反應本地升級,而不刪除Android文件夾似乎不工作。