Android Studio:在发布模式下生成已签名的apk,但我仍然可以在调试列表中看到它
Android Studio:在发布模式下生成已签名的apk,但我仍然可以在调试列表(Android Studio设备对话框)中看到我的应用程序,手机的开发者选项:选择要调试的应用程序也可以显示我的应用程序 我的build.gradle文件:Android Studio:在发布模式下生成已签名的apk,但我仍然可以在调试列表中看到它,android,android-studio,android-gradle-plugin,Android,Android Studio,Android Gradle Plugin,Android Studio:在发布模式下生成已签名的apk,但我仍然可以在调试列表(Android Studio设备对话框)中看到我的应用程序,手机的开发者选项:选择要调试的应用程序也可以显示我的应用程序 我的build.gradle文件: android { compileSdkVersion 21 buildToolsVersion "21.1.2" defaultConfig { applicationId "com.lydiabox.android"
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对于任何答案,请检查您的应用程序是否使用以下命令签名:
$ jarsigner -verify hello_world.apk
jarsigner在您的JDK/bin文件夹中
编辑:您可以在manifest.xml(在
应用程序
标记中)中禁用使用android:debuggable=“false”进行调试
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 assembleerelease生成发布APK如果您的android模块名为app,它将出现在app/build/outputs/apks/app-release.APK中。谢谢您的回答,我发现我导入了另一个第三方库,在这个库中可调试是真的,这导致了我的问题。好答案!!,非常感谢。