Android Studio:在发布模式下生成签名的 apk,但我仍然可以在调试列表中看到它
Android Studio: generate signed apk in release mode ,but i still can see it in debug list
Android Studio:在发布模式下生成签名的 apk,但我仍然可以在调试列表(android studio 设备对话框)中看到我的应用程序,phone 的开发人员选项: select待调试的应用也可以显示我的应用
我的build.gradle文件:
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'
}
}
}
感谢任何答案
检查您的应用是否已使用以下命令签名:
$ jarsigner -verify hello_world.apk
jarsigner 在您的 JDK/bin 文件夹中。
编辑:您可以在 manifest.xml 中使用 android:debuggable="false"
禁用调试(在 application
标签中)
这是示例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 如果您 android 模块名称是 app.
,它将出现在 app/build/outputs/apks/app-release.apk 中
Android Studio:在发布模式下生成签名的 apk,但我仍然可以在调试列表(android studio 设备对话框)中看到我的应用程序,phone 的开发人员选项: select待调试的应用也可以显示我的应用
我的build.gradle文件:
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'
}
}
}
感谢任何答案
检查您的应用是否已使用以下命令签名:
$ jarsigner -verify hello_world.apk
jarsigner 在您的 JDK/bin 文件夹中。
编辑:您可以在 manifest.xml 中使用 android:debuggable="false"
禁用调试(在 application
标签中)
这是示例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 如果您 android 模块名称是 app.
,它将出现在 app/build/outputs/apks/app-release.apk 中