Yas*_*nth 10 android gradle reactjs react-native
我已将我的 ReactNative 项目从0.59升级到 0.61.2 iOS 构建良好,但在 android 中我面临@react-native-community/cli-platform-android模块中的问题。
我的settings.gradle文件
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
Run Code Online (Sandbox Code Playgroud)
我的build.gradle文件
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
Run Code Online (Sandbox Code Playgroud)
构建应用程序时出现以下错误。
> Task :app:generatePackageList FAILED
FAILURE: Build failed with an exception.
* Where:
Script '/Users/yashwanth_c/Documents/projects/MobileApp/node_modules/@react-native-community/cli-platform-android
/native_modules.gradle' line: 130
* What went wrong:
Execution failed for task ':app:generatePackageList'.
> ReactNativeModules$_generatePackagesFile_closure3
* 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.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 5m 21s
4 actionable tasks: 4 executed
Run Code Online (Sandbox Code Playgroud)
和往常一样,我清理了缓存并删除了 node_module 文件夹,尝试了很多次但没有运气。也用谷歌搜索了一个多星期,但仍然无法找到解决办法,任何建议表示赞赏。
rad*_*huq 12
我在 monorepo 工作。该文件存在,但它位于我的项目根目录中node_modules/@react-native-community,而不是包中node_modules。
为了解决这个问题,我更新了路径
/android/settings.gradle : Line 2
apply from: file("../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
Run Code Online (Sandbox Code Playgroud)
/android/app/build.gradle : Line 225
apply from: file("../../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
Run Code Online (Sandbox Code Playgroud)
我在 React Native 0.61.0 中遇到了同样的问题。我尝试了以下解决方案:-
./gradlew --stop (in MacOS)./gradlew cleanBuildCache (in MacOS)对于窗户:-
gradlew --stopgradlew cleanBuildCache检查以下链接以获取更多参考https://github.com/react-native-community/cli/issues/591
我遇到了同样的问题,然后我尝试了下面的命令。它对我有用。这意味着,手动安装 android cli 包。
npm i @react-native-community/cli-platform-android
Run Code Online (Sandbox Code Playgroud)
如果有人知道另一种解决方案,请在此处分享。
我也面临同样的问题。我不知道,但由于某种原因,node_modules cli-platform-android包文件夹中没有显示。
然后我按照以下步骤来解决问题。
-> Remove `node_modules` folder
-> Remove `package-lock.json` file
-> Then install all the package again using `npm install`
-> Then `Rebuild the project in android studio`. That is how my issue was solved.
Run Code Online (Sandbox Code Playgroud)
删除“node_modules”、“packagelock.json”文件夹,然后
yarn add @react-native-community/cli-platform-android@3.0.3
cd android && gradlew clean
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16358 次 |
| 最近记录: |