作者:手机用户2502893535 | 来源:互联网 | 2022-12-09 09:34
这是我的应用级别 build.gradle
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
//apply plugin: 'io.fabric'
android {
compileSdkVersion 28
defaultConfig {
applicationId "threecallistos.jumperr"
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
implementation 'com.google.android.material:material:1.0.0-alpha3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'androidx.multidex:multidex:2.0.0'
}
并gradle.properties
在这里
org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
android.enableJetifier=true
当我删除
implementation 'com.google.android.gms:play-services-maps:15.0.1'
从app.build
文件它工作正常.但我必须使用谷歌地图和服务,所以我在这里和那里搜索,但找不到任何适当的解决方案.我在github中找到了一个建议
我相信这是因为com.google.firebase传递上依赖于com.android.support:support-v4.为了解决这个问题,您应该能够在gradle.properties文件中设置android.enableJetifier = true,这将"自动转换现有的第三方库,就好像它们是为AndroidX编写的"
我已经这样做了但是没有用!
我在构建/运行项目时遇到错误
程序类型已存在:android.support.v4.app.INotificationSideChannel消息{kind = ERROR,text =程序类型已存在:android.support.v4.app.INotificationSideChannel,sources = [未知源文件],工具名称=可选. (D8)}引起:com.android.builder.dexing.DexArchiveMergerException:合并dex存档时出错:
请给我一些解决方案.
1> Always Lucky..:
有多个问题存在完全不同的错误,实际上这些错误都源于在Android Studio v3.1中迁移到AndroidX库.我得到了各种奇怪的错误,如果不回复支持库就无法解决.因此,对于不同的问题,您可能会看到相同的答案.因为问题是关于在描述和上下文中差异很大的错误,所以它们不是重复的问题,因此应该用这个解决方案回答所有问题.具有讽刺意味的是,这种解释比解决方案更长,并且包含在内以帮助管理员理解.
解决方案是:Android Studio v3.2 +解决了这个问题.它还在Refactor菜单下添加了"Migrate to AndroidX"项,以便更轻松地进行迁移.无需解决方法或回滚.迁移到AndroidX库非常重要,因为旧的支持库将在发布稳定的v28支持库后结束.
从测试版渠道更新Android Studio以使用3.2+或等到不久的将来发布稳定版本.
编辑:9/25/18 - 现在可以在稳定通道中使用v3.2稳定版本.