Harbon
Harbon

Reputation: 63

Android Studio: generate signed apk in release mode ,but i still can see it in debug list

Android Studio: generate signed apk in release mode ,but i still can see my application in debug list(android studio Devices dialog) , phone's developer options : select app to be debugged can also show my application

my build.gradle file:

    android {
    compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "com.lydiabox.android"
    minSdkVersion 15
    targetSdkVersion 21
    versionCode 49
    versionName "1.8.7"
//        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
android {
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'LICENSE.txt'
    }
    dexOptions{
        preDexLibraries = false;
    }

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

thx for any answer

Upvotes: 1

Views: 759

Answers (2)

silentsudo
silentsudo

Reputation: 6973

Here is sample build.gradle

    apply plugin: 'com.android.application'
android {
    compileSdkVersion 21
    buildToolsVersion '21.1.1'
    defaultConfig {
        applicationId 'com.example'
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName '1.0'
    }
    signingConfigs {
release {
            storeFile file("releasekeystore.jks")
            storePassword "password"
            keyAlias "ReleaseAlias"
            keyPassword "password"
        }
    }
    buildTypes {

        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.release
        }
    }
    productFlavors {
    }


    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/DEPENDENCIES'
    }
}
dependencies {
    ...
}

then you need to run ../gradlew clean followed by ../gradlew assembleRelease to generate release APK it will be present in app/build/outputs/apks/app-release.apk if you android Module name is app.

Upvotes: 0

PatrickMA
PatrickMA

Reputation: 887

Check if your app is signed with the following command:

$ jarsigner -verify hello_world.apk

jarsigner is in your JDK/bin folder.

Edit: you can disable debugging with android:debuggable="false" in your manifest.xml (in the application tag)

Upvotes: 1

Related Questions