Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle release build still debuggable?

According to the Gradle docs, the default value for "debuggable" a "release" buildType is false. However, whether I explicitly set it to false or not, my release build always seems to be debuggable (I can see logcat output). Am I misinterpreting this property? Can someone please explain?

Here's my build.gradle:

buildscript {
    repositories {
        mavenCentral()
    }

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

apply plugin: 'android'

dependencies {
    compile project(':facebook-android-sdk-3.0.1:facebook')
    compile project(':google-play-services_lib')
    compile project(':nineoldandroids')
    compile project(':SlidingMenu-master:library')
    compile project(':ViewPagerIndicator')
    compile project(':volley')
    compile project(':windowed-seek-bar')
    compile files('compile-libs/androidannotations-2.7.1.jar', 'libs/Flurry_3.2.1.jar', 'libs/google-play-services.jar', 'libs/gson-2.2.4.jar', 'libs/picasso-1.1.1.jar', 'libs/crittercism_v3_0_11_sdkonly.jar', 'libs/gcm.jar', 'libs/apphance-library.jar')
}

android {
    buildToolsVersion "17.0"
    compileSdkVersion 17

    signingConfigs {
        debug {
            storeFile file('keystores/debug.keystore')
        }

        release {
            storeFile file('keystores/release.keystore')
            storePassword "***"
            keyAlias "***"
            keyPassword "***"
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release

            sourceSets {
                main {
                    manifest.srcFile 'AndroidManifest.xml'
                    java.srcDirs = ['src', 'normal']
                    resources.srcDirs = ['src']
                    aidl.srcDirs = ['src']
                    renderscript.srcDirs = ['src']
                    res.srcDirs = ['res']
                    assets.srcDirs = ['assets']
                }
            }
        }
    }
}
like image 635
Karim Varela Avatar asked Jul 13 '13 01:07

Karim Varela


People also ask

Why is Gradle build failing?

Sometimes due to any issue or after formatting of your pc. Some of the Gradle files may get deleted unexpectedly. So when you will start building your apps you will get to see an error in Android studio as 'Error running android: Gradle project sync failed.

How fix Gradle build failed?

You can resolve gradle by going C:\Users\(user name path)\. gradle and delete this . gradle file build again and make sure you are connected to internet.


2 Answers

Viewing logcat is not tied to whether the app is debuggable or not.

If you see the process in DDMS then your app is debuggable (unless you're looking at an emulator in which case all apps are considered debuggable).

like image 154
Xavier Ducrohet Avatar answered Sep 20 '22 13:09

Xavier Ducrohet


If you're using Build -> Generate Signed APK in Android Studio, it's using assembleDebug gradle task instead of assembleRelease. Try executing assembleRelease task manually and debuggable flag should be false

like image 33
srgtuszy Avatar answered Sep 19 '22 13:09

srgtuszy