反应本机错误:重复资源,资产进入某些屏幕,而不是在Android发布APK中的其他人

反应本机错误:重复资源,资产进入某些屏幕,而不是在Android发布APK中的其他人,第1张

概述我正在使用Gradle版本3.2.0和compileSdkVersion28在Android中构建我的ReactNative应用程序的发布APK.我正在运行以下命令:react-nativebundle--platformandroid--devfalse--entry-fileindex.js--bundle-outputandroid/app/src/main/assets/index.android.bundle--asse

我正在使用Gradle版本3.2.0和compileSdkVersion 28在Android中构建我的React Native应用程序的发布APK.我正在运行以下命令:

react-native bundle --platform androID --dev false --entry-file index.Js --bundle-output androID/app/src/main/assets/index.androID.bundle --assets-dest androID/app/src/main/res/cd androID && ./gradlew clean && ./gradlew assembleRelease && ./gradlew installrelease

我的文件夹结构是:

我的package.Json是:

{  "name": "App",  "version": "2.0.0",  "private": true,  "scripts": {    "start": "node node_modules/react-native/local-cli/cli.Js start",    "test": "jest"  },  "dependencIEs": {    "axios": "^0.18.0",    "native-base": "^2.8.0",    "prop-types": "^15.6.2",    "qs": "^6.5.2",    "react": "^16.5.2",    "react-native": "0.57.0",    "react-native-animatable": "^1.3.0",    "react-native-animated-icons": "^1.0.5",    "react-native-appsee": "^2.4.14",    "react-native-blur": "^3.2.2",    "react-native-cast-Chrome": "1.0.0",    "react-native-cast-ui": "1.0.0",    "react-native-device-info": "^0.22.3",    "react-native-dialog": "^5.1.0",    "react-native-elements": "^0.19.1",    "react-native-email": "^1.0.1",    "react-native-fast-image": "^5.0.3",    "react-native-fbsdk": "^0.8.0",    "react-native-flurry-analytics": "^3.0.2",    "react-native-grIDvIEw": "^0.1.2",    "react-native-iap": "^2.2.1",    "react-native-iphone-x-helper": "^1.0.3",    "react-native-keyboard-aware-scroll-vIEw": "^0.7.0",    "react-native-kochava-tracker": "^1.0.0",    "react-native-linear-gradIEnt": "^2.4.0",    "react-native-material-dropdown": "^0.11.1",    "react-native-modal": "^6.5.0",    "react-native-orIEntation": "^3.1.3",    "react-native-photo-upload": "^1.3.0",    "react-native-scrollable-tab-vIEw": "^0.8.0",    "react-native-snap-carousel": "^3.7.4",    "react-native-tab-vIEw": "^1.2.0",    "react-native-underline-tabbar": "^1.3.6",    "react-native-vector-icons": "^5.0.0",    "react-native-vIDeo": "^3.2.1",    "react-native-vIDeo-controls": "^2.2.3",    "react-navigation": "^2.11.2",    "react-navigation-backhandler": "^1.1.1",    "react-redux": "^5.0.7",    "redux": "^4.0.0",    "redux-logger": "^3.0.6",    "redux-thunk": "^2.3.0"  },  "devDependencIEs": {    "@babel/plugin-external-helpers": "^7.0.0",    "ajv": "^6.5.2",    "babel-eslint": "^9.0.0",    "babel-jest": "23.4.2",    "babel-plugin-transform-remove-console": "^6.9.4",    "eslint": "^5.3.0",    "eslint-config-airbnb": "^17.1.0",    "eslint-plugin-import": "^2.14.0",    "eslint-plugin-Jsx-a11y": "^6.1.1",    "eslint-plugin-react": "^7.11.0",    "jest": "23.4.2",    "metro-react-native-babel-preset": "^0.45.4",    "react-test-renderer": "16.4.1",    "schedule": "^0.4.0"  },  "jest": {    "preset": "react-native"  }}

在运行命令时,我在任务上遇到错误:app:mergeReleaseResources Failed with Error:我的所有资产都有重复的资源.从我的可绘制文件夹中删除资产时,应用程序会构建.

但是在运行发布APK时,有些图像根本没有出现,而其他图像则没有出现.此外,相同的图像出现在某些地方而不出现在其他地方.从Js服务器运行调试应用程序时,这些问题都不会发生.这个问题在iOS中没有发生.

我该如何解决这个问题?

解决方法:

根据RN 0.57更改日志:

AndroID tooling has been updated to match newer configuration
requirements (SDK 27, gradle 4.4, and support library 27); building
with AndroID plugin 3.2 doesn’t work due to the gradle scripts, so
please stay on AndroID Studio 3.1 for Now

1)尝试根据RN更改日志设置

com.androID.tools.build:gradle:3.1.4应该可行

2)尝试删除androID构建文件夹并运行./gradlew assembleRelease而不进行任何捆绑

我也使用RN 0.57并且生成apk而不用捆绑也适合我.

如果您仍有问题并想使用捆绑尝试检查:

React Native Android Duplicate file error when generating apk

这些答案应该解决这个问题:

https://stackoverflow.com/a/52750886/1979861

https://stackoverflow.com/a/50876742/1979861

有关0.57 androID更新的更多信息:

https://github.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md

总结

以上是内存溢出为你收集整理的反应本机错误:重复资源,资产进入某些屏幕,而不是在Android发布APK中的其他人全部内容,希望文章能够帮你解决反应本机错误:重复资源,资产进入某些屏幕,而不是在Android发布APK中的其他人所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1099466.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存