Unable to switch to debug build variant in Android Studio

后端 未结 16 721
不知归路
不知归路 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:07

    For me I was unable to switch to our 'devDebug' variant but I could switch to another variant like 'devRelease' and then 'devDebug'. So try switching to another variant first.

    0 讨论(0)
  • 2021-02-01 15:10

    I ran into a similar issue. My module level build.gradle reflected configurations specified for "debug" AND "release" accordingly. I was able to successfully run my app on emulator and device (LG) prior To Building and Signing My Release Version Of My App. After Building and Signing The Release Version and attempting to Run The Signed APK on My Phone and Device, i received an Error PM Session 'mobile': Error Launching activity....Error while Launching activity..So I started retracing my steps and realized that before deploying the signed release variant, i opened up the run/debug Configurations Dialog

    and mistakenly selected the the Value APK from app bundle value From The Deploy attribute, under the Installation category

    I Signed My APK In its ENTIRETY and NOT Via Bundle, so the option selected was attempting to Deploy an invalid App Bundle That Was Never Generated To Begin With, even if it was for the correct Build Variant.

    0 讨论(0)
  • 2021-02-01 15:11

    I fixed this issued by:

    1. Add a new build type named debug1 via edit build.gradle;Enable debug function of this build type;
    2. Sync and select the new build type debug1;
    0 讨论(0)
  • 2021-02-01 15:15

    Had the same problem, solved creating a new temporary Build Type, Build > Edit Build Types, select Build Types and add a new one. Sync, then you can select the new build type, and then revert back to original Debug build type.

    0 讨论(0)
  • 2021-02-01 15:17

    in main root of app in build.gradle

    replace it from:

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
    

    to my Android Studio v3.0.1 in my case:

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
    
    0 讨论(0)
  • 2021-02-01 15:19

    This issue seems to occur when opening the project in a symlinked location on linux. Opening the project directly fixed this issue for me.

    relevant link: https://issuetracker.google.com/issues/156857164

    0 讨论(0)
提交回复
热议问题