Unable to switch to debug build variant in Android Studio

后端 未结 16 789
不知归路
不知归路 2021-02-01 14:22

I\'ve switched to release build variant and configured signingConfigs. Now when I try to check the debug build variant from the drop down menu it switches immediately back to th

16条回答
  •  别那么骄傲
    2021-02-01 15:04

    Maybe you have got your solution to this, just in case, i provide my solution here.


    For Android Studio 2.x

    It may because that you compile your dependent project using:

    compile project('module_a')
    

    Above setting will force your project to compile the release version of your modules. Just change it to below:

    releaseCompile project(path: ':module_a', configuration: 'release')
    debugCompile project(path: ':module_a', configuration: 'debug')
    

    For Android Studio 3.x

    You don't need to explicitly specify the build variant for a "module project". Just using

    implementation project(':library') 
    

    will automatically help select the correct build variant.

    Here is a detailed explanation: https://developer.android.com/studio/build/?utm_source=android-studio#variant_aware


    For Android Studio 3.x Upgraded from 2.x

    Delete the .idea folder under your project root directory and restart your Android Studio.

    Below is the GUI screenshot:

    Hope it helps!

提交回复
热议问题