简体   繁体   中英

Can build auto generated debug build variant apk, but not a custom build variant apk

I can generate a signed APK with the auto generated debug and release build variant, but not with a staging variant that I added.

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            buildConfigField "String", "REST_BASE_URL", RELEASE_REST_BASE_URL
            buildConfigField "String", "PREF_FILE_KEY", RELEASE_PREF_FILE_KEY
            buildConfigField "Boolean", "RETROFIT_CLIENT", RELEASE_RETROFIT_CLIENT
        }

        debug {
            applicationIdSuffix ".debug"
            debuggable true
            buildConfigField "String", "REST_BASE_URL", DEV_REST_BASE_URL
            buildConfigField "String", "PREF_FILE_KEY", DEV_PREF_FILE_KEY
            buildConfigField "Boolean", "RETROFIT_CLIENT", DEV_RETROFIT_CLIENT
        }

        staging {
            applicationIdSuffix ".debugStaging"
            debuggable true
            buildConfigField "String", "REST_BASE_URL", STAGING_REST_BASE_URL
            buildConfigField "String", "PREF_FILE_KEY", STAGING_PREF_FILE_KEY
            buildConfigField "Boolean", "RETROFIT_CLIENT", STAGING_RETROFIT_CLIENT
        }
    }

I basically took the debug variant and duplicated it for staging, with the exception of changing some configuration fields.

I ONLY get this error I get when doing a staging apk build. A debug apk build is not a problem:

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Entry name 'META-INF/androidx.hilt_hilt-common.version' collided

I printed out the dependency tree. The only entries for hilt-common are as follows:

+--- androidx.hilt:hilt-common:{strictly 1.0.0-alpha02} -> 1.0.0-alpha02 (c)

|    +--- androidx.hilt:hilt-common:1.0.0-alpha02
|    |    \--- com.google.dagger:hilt-android:2.28-alpha (*)

|    +--- androidx.hilt:hilt-common:1.0.0-alpha02

I don't really see anything that looks like it is showing a conflict, but then again, I don't really know how to read the dependency printout. Maybe I am missing something

And by the way, this was not always the case. This happened out of nowhere; just suddenly out of the blue.

Unless declaring initWith debug it will duplicate nothing:

buildTypes {
    staging {
        initWith debug
        applicationIdSuffix ".staging"
        buildConfigField "String", "REST_BASE_URL", RELEASE_REST_BASE_URL
        buildConfigField "String", "PREF_FILE_KEY", RELEASE_PREF_FILE_KEY
        buildConfigField "Boolean", "RETROFIT_CLIENT", RELEASE_RETROFIT_CLIENT
    }
}

And this question has no dependencies block.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM