react-native run-android遇到问题总结

【1】、Task :react-native-fetch-blob:compileDebugJavaWithJavac FAILED
Putting task artifact state for task ':react-native-fetch-blob:compileDebugJavaWithJavac' into context took 0.0 secs.
file or directory 'F:\rn\GMP\node_modules\react-native-fetch-blob\android\src\debug\java', not found
Up-to-date check for task ':react-native-fetch-blob:compileDebugJavaWithJavac' took 0.057 secs. It is not up-to-date because:
  Task ':react-native-fetch-blob:compileDebugJavaWithJavac' class path has changed from 4d18537a3ca81329370d543419aae0e2 to b0f52611f5597d6cb85961d4dda0a22a.
All input files are considered out-of-date for incremental task ':react-native-fetch-blob:compileDebugJavaWithJavac'.
Compiling with source level 1.7 and target level 1.7.
:react-native-fetch-blob:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
file or directory 'F:\rn\GMP\node_modules\react-native-fetch-blob\android\src\debug\java', not found
Compiling with JDK Java compiler API.
错误: 读取F:\rn\GMP\node_modules\react-native-fetch-blob\android\build\generated\source\r\debug\org\webkit\android_jsc\R.java时出错; F:\rn\GMP\node_modules\react-native-fetch-blob\android\build\generated\source\r\debu
g\org\webkit\android_jsc\R.java (系统找不到指定的文件。)
-------------------------------------------------------------------------------------------------
* What went wrong:
Execution failed for task ':react-native-fetch-blob:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':react-native-fetch-blob:compileDebugJavaWithJavac'.

***********************************************************************
安装react-native-fetch-blob之后不报错了,应该是没有安装问题。
C:\Users\Administrator>npm install --save react-native-fetch-blob
***********************************************************************

 

 

【2】Error:Execution failed for task ':app:generateDebugBuildConfig'.
java.io.FileNotFoundException: ..\app\build\generated\source\buildConfig\..\BuildConfig.java
-------------------------------------------------------------------------------------------------
This problem might be caused by incorrect configuration of the daemon.  
For example, an unrecognized jvm option is used.  
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/4.4/userguide/gradle_daemon.html

***********************************************************************
可能是JDK版本问题,安装了最新版JDK、并且重装了android studio解决
***********************************************************************


【3】
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:
***********************************************************************
使用以下指令查看详细日志
gradlew compileDebug --stacktrace -info 

gradlew compileDebugSources --stacktrace -info
***********************************************************************


【4】
* Exception is:
org.gradle.execution.TaskSelectionException: Task 'compileDebug' is ambiguous in root project 'android'. Candidates are: 'compileDebugAidl', 'compileDebugAndroidTestAidl', 'compileDebugAndroidTestJavaWithJavac', 'comp
ileDebugAndroidTestNdk', 'compileDebugAndroidTestRenderscript', 'compileDebugAndroidTestShaders', 'compileDebugAndroidTestSources', 'compileDebugJavaWithJavac', 'compileDebugNdk', 'compileDebugRenderscript', 'compileD
ebugShaders', 'compileDebugSources', 'compileDebugUnitTestJavaWithJavac', 'compileDebugUnitTestSources'.
        at org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:116)
        at org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:81)
        at org.gradle.execution.commandline.CommandLineTaskParser.parseTasks(CommandLineTaskParser.java:42)
***********************************************************************
修改android/gradle.properties文件,增加下面配置
org.gradle.configureondemand=true
(##按需配置## 配置有一种方式是按需配置,目前还在试验孵化阶段,所以默认是关闭的,可以通过在gradle.properties加入这样一句来开启)
***********************************************************************

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值