Issue
In my case, I have my signature key and I have generated the apk with function menubuild--->generate signed Bundle/Apk
Here are the steps how I generate this apk:
step 1:
step 2:
finally:
When I put this generated release apk into my real device, it will work well.
But when I tried to send this apk to my application center, it said that I don't have any signature file in this apk.
According to many issues found on google, I have noticed that there was actually no signature file in my apk at all. It seems that Android studio's build--->generate signed Bundle/Apk
didn't work at all, there was only a release with no signature that generated.
I'm quite new in android developing. I wonder if there are some mistakes in my gradle settings.
My application has 2 gradle.build
file like this picture:
the gradle.build
out side the app directory is :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and the gradle.build
file inside app directory is:
apply plugin: 'com.android.application'
android {
signingConfigs {
debug {
storeFile file('D:\\CodeRepository\\app-key-store\\SimpleSender.jks')
storePassword '123123123'
keyAlias 'simple-sender-key'
keyPassword '123123123'
}
}
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.example.simplesender"
minSdkVersion 25
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.9.2'
implementation group: 'com.alibaba', name: 'fastjson', version: '1.2.78'
implementation group: 'com.google.guava', name: 'guava', version: '31.0.1-android'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
}
I don't know why I can't generate an apk with signature...
Solution
Thanks for @Raj Suvariya
and @Nitish
The problem was solved according to their kindness instructions. And how I solved this problem is showing below:
First of all I'm using AS of version
Android Studio Arctic Fox | 2020.3.1 Patch 3
If you are using the same AS, you won't find any options to select signing version when you trying to generate a signed apk with your signing key like this picture showing below (they all have these 2 options).
after finishing building, the APK can be run in my device an works just all right, but I cannot deploy it to app store because app store told me that I have no signature file in META-INF.
The solution is to Explicitly specify
the signing strategy like this in build.gradle
and here is the code. the important code is
v1SigningEnabled true
v2SigningEnabled true
here is my build.gradle
file
apply plugin: 'com.android.application'
android {
signingConfigs {
debug {
storeFile file('D:\\CodeRepository\\app-key-store\\SimpleSender.jks')
storePassword 'xxx'
keyAlias 'simple-sender-key'
keyPassword 'xxx'
v1SigningEnabled true
v2SigningEnabled true
}
release {
storeFile file('D:\\CodeRepository\\app-key-store\\SimpleSender.jks')
storePassword 'xxx'
keyAlias 'simple-sender-key'
keyPassword 'xxx'
v1SigningEnabled true
v2SigningEnabled true
}
}
.....your other configs.....
}
Try run generate signed apk again, and problem solved, and deployment to app store succeed.
Answered By - william
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.