我正在尝试创建一个月前创建的旧的react native项目的新版本,但出现此错误
此应用使用 Google Maps API 正常工作。当我一个月前构建它并能够创建签名的apk时,它运行良好。但是现在我必须更改API密钥,因为旧密钥无法正常工作,需要创建一个新版本。我没有对代码进行任何更改。我刚刚更改了AndroidManifest.xml
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vas">
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme">
<!-- Other tags -->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="MY_API_KEY"/>
</application>
</manifest>
build.gradle
buildscript {
ext {
buildToolsVersion = "27.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "27.1.1"
googlePlayServicesVersion = "11.8.0"
androidMapsUtilsVersion = "0.5+"
}
// other stuff
}
settings.gradle
rootProject.name = 'vas'
include ':react-native-push-notification'
project(':react-native-push-notification').projectDir = new File('../node_modules/react-native-push-notification/android')
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
include ':app'
app / build.gradle
// other stuff
dependencies {
compile project(':react-native-push-notification')
compile project(':react-native-vector-icons')
compile project(':react-native-gesture-handler')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation(project(':react-native-maps'))
implementation("com.google.android.gms:play-services-base:16.0.1"){
force = true
}
implementation("com.google.android.gms:play-services-basement:16.0.1"){
force = true
}
implementation("com.google.android.gms:play-services-tasks:16.0.1"){
force = true
}
compile "com.google.android.gms:play-services-maps:16.0.0"
}
// other stuff
该构建应该可以像以前一样正常工作,并且我从未对AndroidManifest.xml
以外的任何其他文件进行任何更改,但是出现了此错误:
任务:app:transformDexArchiveWithExternalLibsDexMergerForDebug失败
D8:程序类型已经存在: android.support.v4.os.ResultReceiver $ 1
我已经尝试过在 stackoverflow 和 github 上可以找到的所有可能的解决方案,但是它们都不起作用。这是我的最后一个项目,我真的不知道出了什么问题。