当前位置: 首页 > 知识库问答 >
问题:

在此版本中使用了不推荐使用的Gradle功能,使其与Gradle 6.0不兼容。-本机反应

史昱
2023-03-14

安装React Native WebView时

安装后运行react-native run-android时显示错误

任务:应用程序:TransformDexArchiveWithDexMergerForDebug失败

此生成中使用了不推荐使用的gradle功能,使其与gradle6.0不兼容。使用'--warning-mode all‘显示单个弃用警告。参见https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings 163个可操作任务:28个已执行,135个最新

package.json

"@react-native-community/async-storage": "^1.8.1",
"@react-native-community/masked-view": "^0.1.7",
"@react-navigation/native": "^5.1.3",
"native-base": "^2.13.12",
"npm-check-updates": "^4.1.0",
"react": "16.13.1",
"react-native": "0.62.0",
"react-native-gesture-handler": "^1.6.1",
"react-native-media-controls": "^1.1.1",
"react-native-paper": "^3.6.0",
"react-native-reanimated": "^1.7.1",
"react-native-safe-area-context": "^0.7.3",
"react-native-screens": "^2.4.0",
"react-native-track-player": "^1.2.2",
"react-native-video": "^5.1.0-alpha6",
"react-native-webview": "^9.0.2",
"react-navigation": "^4.3.5",
"react-navigation-drawer": "^2.4.9",
"react-navigation-stack": "^2.3.9",
"react-navigation-tabs": "^2.8.9",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-persist": "^6.0.0"

共有2个答案

钮瀚
2023-03-14

恢复上次添加的包或资产文件(例如:有时图像损坏&运行时出错React-native run-android)

郎诚
2023-03-14

也许你的app有64K或者更多的方法。您可以在android/app/build.gradle中添加此内容

android{
defaultConfig{
  .......
 multiDexEnabled true 
  }
}

dependencies {
    ...
    def multidex_version = "2.0.1"
    implementation 'androidx.multidex:multidex:$multidex_version'
}

MainApplication.java

public class MainApplication extends MultiDexApplication implements ReactApplication {
 类似资料: