Picking a specific build type in a dependency

后端 未结 5 2445
闹比i
闹比i 2021-02-20 07:14

Suppose I have an Android app with three build types:

buildTypes {
    release {
        ....
    }
    optRelease {
        ....
    }
    debug {
        ....
         


        
5条回答
  •  借酒劲吻你
    2021-02-20 07:32

    Thanks a lot ahasbini for your solution. Copying ahasbini's answer from this thread for easy reference to the solution.

    You'll need to specify matchingFallback with the Android Gradle Plugin 3.0.0 for the plugin to know which fallback build type of library to use when being compiled with app code in case a certain build type defined in your app is not found in the library.

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            applicationIdSuffix '.debug'
        }
        staging {
            initWith release
            applicationIdSuffix '.staging'
            matchingFallbacks = ['release']
        }
    }
    

    More info here: Migrate to Android Plugin for Gradle 3.0.0.

提交回复
热议问题