ReactNative問題隨記1 Exception in thread "main" java.lang.RuntimeException: gradle-2.14.1-all.zip


ReactNative問題隨記

想運行在真機上,在運行命令react-native run-android遇到錯誤如下:

Scanning 559 folders for symlinks in D:\AppData\Project\android\AwesomeProject\node_modules (46ms)
JS server already running.

Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: C:\Users\lipp\.gradle\wrapper\dists\gradle-2.14.1-all\8bnwg5hd3w55iofp58khbp6yv\gradle-2.14.1-all.zip
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:61)
at org.gradle.wrapper.Install.createDist(Install.java:46)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
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

截圖如下:

 去路徑上去找發現缺少文件,首次運行命令react-native run-android 會下載gradle編譯器,雖然設置了但一直失敗

解決方案:

1.直接去下:http://services.gradle.org/distributions/   找到文件對應版本的文件 gradle-2.14.1-all.zip 下載

打不開的可以去我網盤上下載:https://pan.baidu.com/s/1nvealoX  (gradle-2.14.1-all.zip)

下載后放到C:\Users\lipp\.gradle\wrapper\dists\gradle-2.14.1-all\8bnwg5hd3w55iofp58khbp6yv   下,然后右鍵該文件屬性,看是否被鎖定,如果鎖定點擊解除鎖定

注意文件路徑一般是:C:\Users\{你的賬號}\.gradle\wrapper\dists\gradle-2.14.1-all\{隨機文件夾}

 

出處:http://www.cnblogs.com/lipanpan/

本文版權歸作者,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接,否則保留追究法律責任的權利。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM