我们有一个React原生应用程序,在升级到Android Studio 3.6.1和Gradle plugin 3.6.1后,我们看到了以下编译错误:

Type androidx.appcompat.resources.R$dimen is defined multiple times: /Users/andrew/Software/project/android/app/build/intermediates/project_dex_archive/productionRelease/out/androidx/appcompat/resources/R$dimen.dex, /Users/andrew/Software/project/android/app/build/intermediates/project_dex_archive/productionRelease/out/15bdf8225afad69777cd7f9bd328ab094900c8289014e0107b56c5c62099dfea_3.jar:classes.dex

以下是我们的依赖关系:

"dependencies": {
    "@dblackker/cameraroll": "^1.3.4",
    "@react-native-community/async-storage": "^1.7.1",
    "@react-native-community/geolocation": "^2.0.2",
    "@react-native-community/netinfo": "^4.4.0",
    "@react-native-community/push-notification-ios": "^1.0.6",
    "@react-native-firebase/analytics": "^6.2.0",
    "@react-native-firebase/app": "^6.2.0",
    "@react-native-firebase/crashlytics": "^6.2.0",
    "@react-native-firebase/perf": "^6.2.0",
    "appcenter": "^2.6.1",
    "appcenter-analytics": "^2.6.1",
    "appcenter-crashes": "^2.6.1",
    "axios": "^0.18.0",
    "clone": "^2.1.2",
    "immutability-helper": "^2.8.1",
    "lodash": "^4.17.14",
    "memoize-one": "^5.1.1",
    "moment": "^2.22.2",
    "prop-types": "^15.7.2",
    "react": "16.9.0",
    "react-custom-validation": "^0.5.7",
    "react-native": "0.61.5",
    "react-native-add-calendar-event": "^3.0.0",
    "react-native-app-intro-slider": "^3.0.0",
    "react-native-appearance": "^0.3.1",
    "react-native-camera": "^3.8.0",
    "react-native-contacts": "^5.0.6",
    "react-native-device-info": "^4.0.1",
    "react-native-gesture-handler": "^1.4.1",
    "react-native-heic-converter": "^1.3.0",
    "react-native-image-crop-picker": "^0.26.1",
    "react-native-image-resizer": "^1.0.1",
    "react-native-inappbrowser-reborn": "^3.1.0",
    "react-native-iphone-x-helper": "^1.2.1",
    "react-native-keyboard-aware-scroll-view": "^0.7.4",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-maps": "0.26.1",
    "react-native-modal": "^7.0.2",
    "react-native-modal-datetime-picker": "^7.6.1",
    "react-native-parsed-text": "^0.0.21",
    "react-native-permissions": "^2.0.9",
    "react-native-push-notification": "^3.1.9",
    "react-native-reanimated": "^1.3.0",
    "react-native-section-list-get-item-layout": "^2.2.3",
    "react-native-shadow": "^1.2.2",
    "react-native-share": "^2.0.0",
    "react-native-svg": "^9.12.0",
    "react-native-svg-uri": "^1.2.3",
    "react-native-tab-view": "^2.3.0",
    "react-native-version-number": "^0.3.6",
    "react-navigation": "3.12.0",
    "react-navigation-tabs": "^2.1.2",
    "react-redux": "^5.0.7",
    "redux": "^4.0.4",
    "redux-thunk": "^2.3.0",
    "rn-fetch-blob": "^0.11.2",
    "validator": "^10.8.0"
  }

有人能帮我们弄清楚问题是什么吗?我们将来如何调试这类问题?非常感谢.

推荐答案

Igor Montella对我的问题的 comments 修复了这个问题——降级到gradle plugin 3.5.0.

React-native相关问答推荐

React Navigation—从标题按钮打开模式

复制__自持props

React Native在同一页面上使用多个不同的导航器

React Native 组件中两次使用map的问题

TypeError:未定义不是对象(判断'theme.spacing [radius]')

_react2.default.PropTypes.function 未定义

withNavigation 只能用于导航器的视图层次 struct

最近 react-native 版本中的Unable to resolve moduledebuggerWorker 错误

React-Native Packager 失败:重复的模块名称

Xcode 设备不可用,未找到运行时配置文件

背景图像在react中不起作用

使用 WSL2 运行时如何将手机连接到 expo

使用 React Navigation 导航堆栈时重新渲染组件

在 React 中调用 getDerivedStateFromProps 中的方法

react-native:多色文本视图

如何在 React Native 上隐藏 createStackNavigator 的标题?

React 本机矢量图标在当前版本 0.60 上不起作用

React Native 中的 CSS 三角形

react-native 开始给出 Invalid 正则表达式无效错误

将 Picker 绑定到 React Native 中的 Picker.Item 列表