我有一个项目位于distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
但是我的本地Gradle版本是:
------------------------------------------------------------
Gradle 5.4.1
------------------------------------------------------------
Build time: 2019-04-26 08:14:42 UTC
Revision: 261d171646b36a6a28d5a19a69676cd098a4c19d
Kotlin: 1.3.21
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 1.8.0_201 (Oracle Corporation 25.201-b09)
OS: Mac OS X 10.13.6 x86_64
我认为这很简单,可以转到Android Studio,文件-> 项目结构,然后在其中更改Gradle版本,我将其从5.1.1更改为根据我在gradle-wrapper.properties
distributionUrl=https://services.gradle.org/distributions/gradle-4.10.1-all.zip
中得到的信息,获得了4.10.1,但随后出现错误:
错误“最低支持的Gradle版本为5.1.1。当前版本是 更新Android Studio后为4.10.1”
这是否意味着我只需要将5.1.1更新为最新? 如果是这样,什么是采取最佳步骤以使此旧式Gradle RN项目中的所有内容均达到5.1.1的速度? 此处记录的重大更改:https://docs.gradle.org/current/userguide/upgrading_version_4.html#changes_5.0#preamble
我希望所记录的内容正是我正在经历的事情,但这太容易了。
例如,这是我继续遇到的错误之一:
Task 'installDebug' not found in project ':app'. Some candidates are: 'installDevDebug', 'installQaDebug', 'installUaDebug'.
我进入android/
并运行gradle installDevDebug
,但最终遇到此错误:
Task :react-native-sentry:compileDebugJavaWithJavac FAILED
/Users/danale/Projects/engage-application.mobile/node_modules/react-native-sentry/android/src/main/java/io/sentry/RNSentryModule.java:252: error: incompatible types: ReadableArray cannot be converted to ReadableNativeArray
addExceptionInterface(eventBuilder, exception.getString("type"), exception.getString("value"), stacktrace.getArray("frames"));
^
Note: /Users/danale/Projects/engage-application.mobile/node_modules/react-native-sentry/android/src/main/java/io/sentry/RNSentryModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-sentry:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
我该如何解决?
答案 0 :(得分:0)
在运行命令时是否尝试使用--stacktrace选项?还是在ProjectBuilder.js中更改distributionUrl?
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-5.4.1-all.zip'; <<<<change to 4.10.1 here where the var is set.