2

Android app bundle 工具抛出上述错误。

这是我的应用程序级别 gradle

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'
4

2 回答 2

1

发现问题:

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

在 proguard 文件中 -keep 类whateverpackagename。{ *; }**

PS 还检查是否启用了 multidex 功能。

于 2019-10-10T15:50:45.863 回答
0

我有这个错误,当我将项目结构窗口中的 Android Gradle 插件版本和 Gradle 版本降级到 3.5.4 和 5.6.4 时它消失了

于 2020-08-28T11:04:40.277 回答