2017-05-05 41 views
1

即使我正在以調試模式編譯它,我也會獲得BuildConfig.BUILD_TYPE會始終返回「release」。構建類型始終爲「Release」

我這裏有我的build.gradle的一部分:

buildTypes { 
     debug { 
      debuggable true 
      minifyEnabled false 
     } 
     release { 
      debuggable false 
      minifyEnabled false 
      //md5 sign certificate split in two 
      proguardFile './dexguard-config/dexguard-release-conservative.pro' 
      //proguardFile getDefaultDexGuardFile('dexguard-release-aggressive.pro') 
      proguardFile 'dexguard-project.txt' 
     } 

謝謝!

+0

看一看http://stackoverflow.com/a/23432225/3981656 –

+0

你導入BuildConfig該特定模塊? – laalto

回答

0

使用這個代替:

if(BuildConfig.DEBUG){ 
    //Do something if the build is debug 
}else{ 
    //Do something if the build is release 
} 
相關問題