I followed flutter.div instructions in how to deploy my app to google play, but im having a problem when i run flutter build appbundle in vs code, it says
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Failed to read key key from store "c:\Users\iikxz\upload-keystore.jks": No key with alias 'key' found in keystore c:\Users\iikxz\upload-keystore.jks
android/app/build.gradle:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
android/key.properties:
storePassword=123456
keyPassword=123456
keyAlias=key
storeFile= c:/Users/iikxz/upload-keystore.jks
If you just copied/pasted the command on the Flutter documentation, this one, keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload, then the alias would be upload and not key.
Related
I'm having a problem while running this command on Flutter: flutter build appbundle --target-platform android-arm,android-arm64,android-x64 which I need to run in order to execute flutter build apk.
build.gradle
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.release
}
}
key.properties
storePassword=XXXX
keyPassword=XXXX
keyAlias=key
storeFile="C:/Users/User/Key/key.jks"
Error:
* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file 'D:\Projects\Flutter\iusefully\android\app\"C:\Users\User\Key\key.jks"' not found for signing config 'release'.
I finally found the answer,
my problem was in the key.properties file.
The problem occurred because I used storeFile="LOC"
The declartion of this variable for the path of the .jks should NOT be in " "
quotation.
WRONG:
storeFile="C:/Users/User/Key/key.jks"
RIGHT: storeFile=C:/Users/User/Key/key.jks
In addition, I added the key.jks file to the /app folder.
this solution work for me...
follow this instruction
https://flutter.dev/docs/deployment/android#create-a-keystore
and in key.properties don't put values inside ""
ex:
storePassword=454545
keyPassword=456565
keyAlias=upload
storeFile= C:/Users/{profile}/upload-keystore.jks
Change your key location c to d drive...
Same time permission issue occurred with c drive
For me it helped to rename file
{home}\.android\debug.keystore to {home}\.android\debug.keystore.jks
In addition to t0m3r's answer, when running the command below on windows: change USER_NAME to your user name
keytool -genkey -v -keystore c:\Users\USER_NAME\upload-keystore.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias upload
an error occurred while trying to get the sha-256 fingerprint of the keystore file
Make sure you are using the debug.keystore
You can define it in gradle.
android {
// ...
signingConfigs {
debug {
storeFile file('../../../.android/debug.keystore')
keyAlias 'androiddebugkey'
keyPassword 'android'
storePassword 'android'
}
}
//...
I've used this command
keytool -genkey -v -keystore ~/nutella.jks -keyalg RSA -keysize 2048 -validity 10000 -alias nutella
to generate a Keystore. It works fine but From what I've read this command should also prompt you for a key password(not the store password)? I never got this prompt.
I can run
keytool -v -list -keystore //nutella.jks
to see the contents of the Keystore. And the key seems to be there...ie the correct alias is there.
Where do I get/set the password for the the particular alias?
I have a key.properties in the android directory
storePassword=password
keyPassword=password
keyAlias=ballotbox
storeFile=/Users/gerardhorgan/ballotbox.jks
and in build.gradle I have:
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "app.ballotbox.app"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
When I try to generate a release build I get
Execution failed for task ':app:validateSigningRelease'.
> Keystore file not set for signing config release
I think it might have something to with keyPassword because I didn't set this and read somewhere you can use the storePassword.
`
Try android, it's the default one.
May be the issue is with the wrong alias.
In this code you have mentioned -alias = nutella at the end.
keytool -genkey -v -keystore ~/nutella.jks -keyalg RSA -keysize 2048 -validity 10000 -alias nutella
But in key.properties you have keyAlias=ballotbox.
Secondly, as per official guide,
The -storetype JKS tag is only required for Java 9 or newer. As of the Java 9 release, the keystore type defaults to PKS12.
That means, if you don't provide -storetype JKS in the command to generate keystore, the generated keystore file is of type PKS12 and not JKS. It seems in PKS12 format you can only set store password and the same password is used for key password during build. So, when I had different passwords set in key.properties file for store and key, I was getting "given-final-block-not-properly-padded" error, and no error when both were same.
I am generating a signed apk through Android Studio, and even when creating a new keystore, Android Studio uses an old keystore. This occurs even by placing the signature data in the gradle. All my apks are coming out with the same SHA1.
Im already push Invalidate Caches and Restart and nothing changes.
you can also do app signing in build.gradle script like this:
android {
.....
signingConfigs {
release {
keyAlias 'alias'
keyPassword 'pass'
storeFile file('release.keystore')
storePassword 'pass'
}
debug {
keyAlias 'androiddebugkey'
keyPassword 'oass'
storeFile file('debug.keystore')
storePassword 'pass'
}
}
My first Android project is finish. I want to load Google Play.
when I make build -> Generate Signed APK give error android studio.
For Gradle-based projects, the signing configuration should be
specified in the Gradle build scripts.See the Gradle User Guide for
more info."
I tried to sign configs as this sample
signingConfigs {
release {
storeFile file("mykeystore")
storePassword "mypassword"
keyAlias "my alias"
keyPassword "mykeypassword"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
But I dont know mykeystore and my password and other infos.
release {
storeFile file("mykeystore") -> what is mykeystore ?
storePassword "mypassword" -> what is mypassword ?
keyAlias "my alias" -> what is myalias ?
keyPassword "mykeypassword" -> what is mykeypassword ?
}
I cant build apk my project. This is my first project.
I use android studio 2.0.11 and mac os x lion.
Please help. Sorry bad english.
Thanks.