I have built an app in flutter using android studio and am trying to release it on the play store.
According to https://flutter.dev/docs/deployment/android#reviewing-the-build-configuration, "Run flutter build appbundle (Running flutter build defaults to a release build.)"
However, when I try to upload this on the play console, I get the error message that "You uploaded an APK or Android App Bundle that was signed in debug mode. You need to sign your APK or Android App Bundle in release mode."
What should I do differently?
From my gradle.build:
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 29
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 "com.rtterror.custom_snooze_alarm"
minSdkVersion 16
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
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.debug
}
}
}
Flutter has the option to build an appbundle:
flutter build appbundle
My reference is from this github project.
Try modifying your buildTypes block.
buildTypes {
release {
signingConfig signingConfigs.release
}
}
Make sure you have your keystore file properly set up and referenced in "Android/key.properties". Here is the command to create the keystore:
keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
Then run flutter clean && flutter build appbundle --release
If you get the same error, then try this helpful walkthrough: https://medium.com/#psyanite/how-to-sign-and-release-your-flutter-app-ed5e9531c2ac
you have debug in front of signingConfigs just change it to release
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.debug
}
}
Related
I am trying to build an android apk to share but, when installing I get the "App Not Installed" error message.
I have placed my credentials in the build.gradle file:
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 "com.example.buddiesDrivers"
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
signingConfigs {
release {
keyAlias 'key'
keyPassword 'abc123'
storeFile file('/Users/test/key.jks')
storePassword 'abc123'
}
}
I run the keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key option and ad the creds shown above then:
Flutter clean
Flutter Build APK
The build file creates the apk but, it cannot be installed. What did I miss?
Remove your previous installation, if it was the debug so it won't work usually. Uninstall that first then try installing the release version.
it could be because you have set minsdkversion to a higher version.
go to Android/app/build.gradle and change minsdversion to 19 or below.
it worked for me after trying all the solutions.
I have to generate an APK to publish the app in Google Play Store, so I did this steps:
run keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key and paste the file key.jks inside android/app
create a file in android folder named key.properties with this content:
storePassword=myPass
keyPassword=myPass
keyAlias=KEY
storeFile=/app/key.jks
added this code in app/build.gradle:
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
Pasted this code in app/build.gradle:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
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.debug
}
}
Run flutter clean
Run flutter build apk --split-per-abi --release:
But when I send the apks to google play publish I receive this message:
You have sent a signed APK or Android App Bundle in debug mode. Sign it in release mode
What I need to do?
Remove the duplicate buildType release
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.debug
}
}
Or rename to debug.
buildTypes {
release {
signingConfig signingConfigs.release
}
debug {
signingConfig signingConfigs.debug
}
}
I can't upload the apk's on google play.
I try everything about that. I bored....
I working to this issue about 4 days.
I try this solutions.
1-)
Add key.properties on android project
storePassword=pass
keyPassword=pass
keyAlias=xxxx
storeFile=xxxx.jks
Add this lines on build.grandle
defaultConfig{
ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
if (keystorePropertiesFile.exists()) {
signingConfig signingConfigs.release
println "Signing with key.properties"
} else {
signingConfig signingConfigs.debug
println "Signing with debug keys"
}
}
}
And i try get apks from android studio. After than i upload the bundle to play store i get some error.
2-)
add this line on build.grandle
splits {
abi {
enable true
reset()
include "armeabi-v7a", "arm64-v8a"
universalApk false
}
}
it's doesn't work too.
3-) I get bundle from flutter CLI on this bash script
flutter build appbundle --release --target-platform=android-arm64
it's again doesnt work.
4-) I get bundle from flutter CLI on this bash script
flutter build apk --split-per-abi
it's again doesnt work.
Flutter --version result is ;
Flutter 1.7.8+hotfix.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 20e59316b8 (5 weeks ago) • 2019-07-18 20:04:33 -0700
Engine • revision fee001c93f
Tools • Dart 2.4.0
Google play store error is
This release is not compliant with the google play 64-bit requirement
defaultConfig {
applicationId "net.example.test"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Here is my configuration and I'm just using flutter build appbundle for building the project. Also, don't forget the change version of the project while publishing from pubspec.yaml.
I have source code of android app with gradle support. I want to generate Apk online through my server.
anyone guide me the commands for cmd or terminal by which, I can generate debug and signed apk using my source code.
For generating debug and signed apk file from android project.you should add signingConfigs into your app moulde's build.gradle file as follow:
signingConfigs {
...
release {
...
keyAlias YOUR-KEY-ALIAS
keyPassword YOUR-KEY-PASSWORD
storeFile YOUR-KEYSTORE-FILE-PATH//here is your keystore file path
storePassword KEY-STORE-PASSWORD
...
}
debug{//debug keystore
...
keyAlias "androiddebugkey"
keyPassword "android"
storeFile rootProject.file("debug.keystore")//here is your keystore file path
storePassword "android"
...
}
...
}
in your buildTypes block add:
buildTypes {
...
debug{
...
signingConfig signingConfigs.debug
...
}
release {
...
signingConfig signingConfigs.release
...
}
...
}
finally,your can input command in your project's directory:gradlew assemble,that will output your porject's apk file in some derectory(YOUR-PROJECT-DIRECTORY/app/build/outputs/apk)
I am very new to the android world and I was trying to just get to run a simple hello world app on my phone.
when I tried this I learnt that the APK generated by an android studio is an unsigned one. So to sign this I have gone through the process of creating a Key store and then a private Key, its alias and I was successful in signing the APK and installing on my phone and running it too.
Then I went through this link for adding signing configurations to the gradle to automatically sign the release with the newly created key store file.
I have followed the steps n the above link properly and did not miss anything but still when I finish my signing configurations I have an error saying
Gradle project sync failed.Basic functionality(eg. editing, debugging)
will not work properly.
Error:(19, 0) Could not find property 'config' on SigningConfig
container.
I was taken by a surprise! and now I am not able to sign my APKs manually too.
Now when I try to sign manually, it says the gradle is not in sync
I guess this file will be of help to help me solve this error. build.gradle of the project. I am trying to understand is what is mentioned here is same as the one I configured through the Android Studio UI while making the signing configurations.
apply plugin: 'com.android.application'
android {
signingConfigs {
release {
storeFile file("<path>\\firstKeystore.jks")
storePassword "******"
keyAlias "usual password"
keyPassword "******"
}
}
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {
applicationId 'com.tech.vasanth.newsfeed'
minSdkVersion 19
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
debuggable false
jniDebugBuild false
renderscriptDebugBuild false
zipAlign true
}
debug {
signingConfig signingConfigs.config
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
There is a mistake in the buildTypes.release block. The signing config should be:
signingConfig signingConfigs.release
Note, that this is how you named the configuration in the signingConfigs block above.
Also leave out the signing config in the buildTypes.debug block (or, if you really want to have it, set it like above).
I have been using below configurations for Debug/Release.
signingConfigs {
release {
keyAlias 'keyAlias'
keyPassword 'keyPassword'
storePassword 'storePassword'
storeFile file("${rootDir}/keystores/app.keystore")
}
debug {
storeFile file("${rootDir}/keystores/debug.keystore")
keyAlias 'androiddebugkey'
keyPassword 'android'
storePassword 'android'
}
}
While defining a release module:
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'other-rules.pro'
signingConfig signingConfigs.release
}
debug {
signingConfig signingConfigs.debug
}
}
Note: Here rootDir is your project root directory. Please store your keystore in mentioned directory.
structure of get a release is like this :
signingConfigs {
release {
storeFile file("release.keystore")
storePassword "******"
keyAlias "******"
keyPassword "******"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}