模块 'base' 没有 dex 文件,但属性'hasCode'在 Android 清单中未设置为 false.xml



Android应用程序捆绑工具正在抛出上述错误。

这是我的应用级渐变

apply plugin: 'com.android.application'
apply plugin: 'dexguard'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'

android {
compileSdkVersion rootProject.compileSdk
buildToolsVersion '28.0.3'

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
bundle {
language {
// Specifies that the app bundle should not support
// configuration APKs for language resources. These
// resources are instead packaged with each base and
// dynamic feature APK.
enableSplit = false
}
density {
// This property is set to true by default.
enableSplit = true
}
abi {
// This property is set to true by default.
enableSplit = true
}
}

defaultConfig {
applicationId "com.xxxxx.xxxxx"
minSdkVersion rootProject.minSdk
targetSdkVersion rootProject.compileSdk
versionCode rootProject.versionCode
versionName rootProject.versionName
resConfigs "en", "hi", "ta"
vectorDrawables.useSupportLibrary = true
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
return true
}
buildTypes {
debug {
proguardFile getDefaultDexGuardFile('dexguard-debug.pro')
proguardFile 'dexguard-project.txt'
return true
}
release {
proguardFile getDefaultDexGuardFile('dexguard-release.pro')
proguardFile 'dexguard-project.txt'
return true
}
}

return true
}
dependencies {
// playServices
implementation "com.google.android.gms:play-services-maps:16.0.0"
implementation "com.google.android.gms:play-services-location:16.0.0"
implementation "com.google.firebase:firebase-core:16.0.4"
implementation "com.google.firebase:firebase-ads:17.0.0"
implementation "com.google.firebase:firebase-config:16.1.0"
implementation "com.google.firebase:firebase-appindexing:16.0.2"
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
// supportLibrary
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
implementation "com.android.support:recyclerview-v7:$supportLibraryVersion"
implementation "com.android.support:design:$supportLibraryVersion"
implementation "com.android.support:cardview-v7:$supportLibraryVersion"
implementation "com.android.support:customtabs:$supportLibraryVersion"
implementation "com.android.support:support-media-compat:$supportLibraryVersion"
implementation "com.android.support:support-v4:$supportLibraryVersion"
implementation 'com.google.android.instantapps:instantapps:1.1.0'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
implementation 'com.android.support:multidex:1.0.3'
// Third party
// Others are here
}
apply plugin: 'com.google.gms.google-services'

发现问题:

如果这种情况只发生在发布版本中,那么可能是proguard问题。如果Proguard认为这些文件没有用处,它会从动态模块中删除这些文件。因此,您必须修改proguard-keep规则。

在proguard文件中-保留类whateverpackagename{*;}**

p.S.还检查是否启用了多点功能。

我有这个错误,当我在Project Structure窗口中将Android Gradle插件版本和Gradle版本降级为3.5.4和5.6.4 时,它消失了

最新更新