Rom*_*don 6 javascript android execution gradle react-native
我正在生成我使用 React Native 开发的项目的 apk。但是当我运行命令时./gradlew assembleRelease出现以下错误:
> Configure project :react-native-audio
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed in version 5.0 of the Android Gradle plugin.
For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.
> Task :app:generatePackageList FAILED
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\romer\ProjetoAP\Gravador\teste\Gravador_de_audio\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 131
* What went wrong:
Execution failed for task ':app:generatePackageList'.
> argument type mismatch
* 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 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 24s
1 actionable task: 1 executed
PS C:\users\romer\ProjetoAP\Gravador\teste\Gravador_de_audio\android>
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题呢?
sai*_*kit 17
使用 Gradle 版本 6.9
以下是此版本的亮点:
- 这是一个小型向后移植版本。
- 与Java工具链一起使用时可以使用Java 16进行编译
- 动态版本可以在插件声明中使用
- 对Apple Silicon 处理器的本机支持
使用 Gradle Wrapper 更改版本。
./gradlew wrapper --gradle-version 6.9
Run Code Online (Sandbox Code Playgroud)
小智 16
我没有降级,而是检查了reactNativeModule第 131 行提到的参数。
看起来ArrayList<HashMap<String, String>>[] packages = this.reactNativeModules,确实存在不匹配。
事实上,reactNativeModule他的声明中没有括号。
所以我改变了以下行native_modules.gradle:
ArrayList<HashMap<String, String>>[] packages = this.reactNativeModules
Run Code Online (Sandbox Code Playgroud)
到:
ArrayList<HashMap<String, String>> packages = this.reactNativeModules
Run Code Online (Sandbox Code Playgroud)
小智 9
我刚刚遇到了同样的问题,并且能够追踪它为什么在我的系统上发生。使用该--stacktrace标志有助于弄清楚发生了什么,最终指向react-native-community/cli包。
在扫描react-native-community/clirepo 中的问题和 PR 后,我发现了这个 PR https://github.com/react-native-community/cli/pull/1396,它增加了对 Gradle 7 的支持。
我的系统上有 Gradle 7 并降级到 Gradle 6,运行gradle wrapper,然后./gradlew clean让我继续前进。
希望这能解决您的问题,或者至少让您了解如何在您的系统上追踪它!
| 归档时间: |
|
| 查看次数: |
4116 次 |
| 最近记录: |