我已经将本机版本从0.55.4升级到0.59.5,并将gradle版本2.2.1升级到3.3.2。 我们在项目中使用react-native-maps,因此已将其更新为最新版本0.25.1,因此当我构建项目时,在构建时会出现此错误。 通过谷歌搜索,我知道这是一个重复类问题,但在依赖关系中找不到重复类的地方。该如何解决?
我不想使用androidx,所以我正在使用Google Play服务版本16.1.0。 尝试将其排除以用于react-native-maps实现。 gradle文件中已包含googlePlayServicesVersion =“ 16.1.0”
我的android / app / build.gradle文件:
dependencies{
implementation project(':react-native-vector-icons')
implementation project(':react-native-svg')
// For Piwik
implementation project(':react-native-piwik')
implementation project(':react-native-webview')
implementation project(':react-native-orientation-locker')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation(project(':react-native-maps')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation "com.android.support:appcompat-v7:28.0.0"
implementation 'com.android.support:design:28.0.0'
implementation "com.facebook.react:react-native:0.59.5" // From node_modules
implementation 'com.facebook.soloader:soloader:0.6.0'
implementation ('com.google.android.gms:play-services-base:16.1.0'){ force = true }
implementation ('com.google.android.gms:play-services-places:16.1.0'){ force = true }
implementation ('com.google.android.gms:play-services-location:16.0.0'){ force = true }
implementation ('com.google.android.gms:play-services-gcm:16.1.0'){ force = true }
implementation ('com.google.android.gms:play-services-maps:16.1.0'){ force = true }
implementation ('com.google.android.gms:play-services-basement:16.2.0'){ force = true }
// For animated GIF support
implementation 'com.facebook.fresco:animated-base-support:1.3.0'
implementation 'com.facebook.fresco:animated-gif:1.3.0'
}
我的android build.gradle文件:
buildscript {
ext {
googlePlayServicesVersion = "16.1.0"
supportLibVersion = "28.0.0"
}
repositories {
jcenter{
url "http://jcenter.bintray.com/"
}
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
...
预计可正常构建,但会出现错误:程序类型已存在:com.airbnb.android.react.maps.AirMapCallout