Android Studio:在发布模式下生成签名的apk,但我仍然可以在调试列表中看到它

时间:2015-05-21 09:49:44

标签: android android-studio android-gradle

Android Studio:在发布模式下生成已签名的apk,但我仍然可以在调试列表中找到我的应用程序(android studio Devices对话框),手机的开发者选项:选择要调试的应用程序也可以显示我的应用程序

我的build.gradle文件:

__new__

thx任何答案

2 个答案:

答案 0 :(得分:1)

使用以下命令检查您的应用是否已签名:

$ jarsigner -verify hello_world.apk

jarsigner 位于JDK / bin文件夹中。

编辑:您可以使用manifest.xml中的android:debuggable="false"停用调试(在application标记中)

答案 1 :(得分:0)

以下是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 {
    ...
}

然后你需要运行../gradlew clean然后 ../gradlew assembleRelease生成发布APK它将出现在app / build / outputs / apks / app-release.apk中,如果你的android模块名称是app。