[英]generate signed apk is not working, apk is unsigned
I used to generate a signed apk from Android Studio and everything was working well until I updated Android Studio to 3.3
.我曾经从 Android Studio 生成签名的 apk 并且一切正常,直到我将 Android Studio 更新到
3.3
。 It generates an apk but after I try to install it, it says: App Not Installed!它生成一个apk,但在我尝试安装它后,它说:应用程序未安装!
My Trial was by:我的试验是通过:
build
build
APK
and click NextAPK
并点击下一步The Apk is generated but it's not signed! Apk 已生成但未签名! What is the problem ?
问题是什么 ?
Here is my app build.gradle
这是我的应用程序
build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 27
defaultConfig {
applicationId "com.twobreathe.soft2breathe"
minSdkVersion 23
targetSdkVersion 27
versionCode 9
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
}
}
vectorDrawables {
useSupportLibrary true
}
resConfigs "en", "ja"
}
signingConfigs {
release {
keyAlias "[my key alias]"
keyPassword "[my key password]"
storeFile file("[path to the keystore file]")
storePassword "[my store password]"
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
shrinkResources true
pseudoLocalesEnabled false
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/fluidsynth/android/CMakeLists.txt"
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
dataBinding {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildToolsVersion '28.0.3'
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.github.parse-community.Parse-SDK-Android:parse:1.18.4'
implementation 'com.jjoe64:graphview:4.2.2'
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.orhanobut:hawk:2.0.1'
implementation 'xyz.sahildave:arclayout:1.0.0'
implementation 'com.mikhaellopez:circularprogressbar:2.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'com.github.GrenderG:Toasty:1.3.0'
implementation 'com.kyleduo.switchbutton:library:2.0.0'
implementation 'com.github.franmontiel:LocaleChanger:0.9.2'
implementation 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
}
After updating to 3.3, many problems are occuring related to signing an APK.更新到 3.3 后,出现很多与签署 APK 相关的问题。 Sometime it doesn't sign the apk and sometime it says the key is not private.
有时它不签署 apk,有时它说密钥不是私有的。
Well i also faced this problem after upgrading to android studio 3.3 and i resolved in 3 steps.好吧,我在升级到 android studio 3.3 后也遇到了这个问题,我分 3 个步骤解决了。 But firstly make sure you backup your whole project.
但首先要确保备份整个项目。
It went successful after 2 try.经过2次尝试成功。 To be very honest i did the last step twice by restoring files from backup.
老实说,我通过从备份恢复文件做了两次最后一步。 As deleting these folders i messed up 1 time.
删除这些文件夹时,我搞砸了 1 次。
Not strictly related, but I ended up in this questions when searching for a fix to my problem.不是严格相关的,但在寻找解决我的问题的方法时,我最终遇到了这个问题。 In my case I forgot to remove 'debuggable true' for one of my non-debug built-types.
在我的情况下,我忘记为我的一种非调试内置类型删除“debuggable true”。 When I was generating the bundle the google play store wouldn't complain about it just said that it wasn't signed.
当我生成捆绑包时,谷歌游戏商店不会抱怨它只是说它没有签名。 But when I tried uploading an apk it showed the true error.
但是当我尝试上传 apk 时,它显示了真正的错误。
From your Gradle its visible that you have not configured your Signing Config with it.从您的 Gradle 中可以看出您尚未使用它配置您的签名配置。
Please check image below:请检查下图:
Step 1:第1步:
Go to your project settings > select your module (Let's say "app") > go to signing > enter proper information and keystore.jks file
转到您的项目设置> 选择您的模块(比方说“应用程序”)> 去签名> 输入正确的信息和 keystore.jks 文件
Step 2:第2步:
Go to Build Types > select Release type > assign signing config as you created on step 1. > after that your gradle will have config as there in image.
转到构建类型 > 选择发布类型 > 分配您在步骤 1 中创建的签名配置。 > 之后,您的 gradle 将具有图像中的配置。
Step 3:第 3 步:
Try generating signed APK.
尝试生成签名的 APK。
It will be success!!!一定会成功!!!
Happy Coding..快乐编码..
Double check both of the values on the final dialog, labelled by "Signature Versions".仔细检查最终对话框中的两个值,标记为“签名版本”。 For more information please check the following link: https://developer.android.com/about/versions/nougat/android-7.0#apk_signature_v2
有关更多信息,请查看以下链接: https : //developer.android.com/about/versions/nougat/android-7.0#apk_signature_v2
Anyway this question seems duplicate as the following: android studio: release apk is not signed无论如何,这个问题似乎重复如下: android studio: release apk is not signed
friend when you go for build the signed apk now in android studio 3.3 , you will 2 option for build the signed apk.朋友,当您现在在 android studio 3.3 中构建已签名的 apk 时,您将有 2 个选项来构建已签名的 apk。 1. Android App Bundle 2.APK
1. 安卓应用程序包 2.APK
i will suggest to use option 2我会建议使用选项 2
select option 2 and Click on Next button now studio ask for your password details now fill all details and select Remember password checkbox for feature and now next .选择选项 2 并单击下一步按钮现在工作室询问您的密码详细信息现在填写所有详细信息并选择记住密码复选框功能,现在下一步。 now again studio ask for debug and release build confirmation now here select release and select 2 checkbox at bottom and then continue
现在工作室再次要求调试和发布构建确认,现在在这里选择发布并选择底部的 2 复选框,然后继续
hope your signed apk will be generate .希望您的签名 apk 能够生成。
When generating an APK, make sure both the signature types are checked, otherwise Fabric (and other places) may not recognise it as signed.生成 APK 时,请确保检查了两种签名类型,否则 Fabric(和其他地方)可能无法将其识别为已签名。
Additionally you probably want to remove debuggable true
from your release config, as debuggable builds can't be uploaded to Google Play.此外,您可能希望从发布配置中删除
debuggable true
,因为无法将可调试版本上传到 Google Play。 There's a chance this is also causing an issue.这也有可能导致问题。
Try to sign it using command-line tools.尝试使用命令行工具对其进行签名。 I may help you to identify the problem.
我可以帮你找出问题所在。 ( https://developer.android.com/studio/build/building-cmdline ).
( https://developer.android.com/studio/build/building-cmdline )。
In my case, it was JAVA_HOME problem (as in @Vanshaj Daga answer).就我而言,这是 JAVA_HOME 问题(如@Vanshaj Daga 的回答)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.