Signed Flutter App: Not Installed Android APK - android

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.

Related

flutter building appbundle in release mode

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
}
}

Cannot generate apk in release mode

I was following this documentation "Configure the build process to automatically sign your app" https://developer.android.com/studio/publish/app-signing#sign-auto and trying to generate apk for release version.
However, the apk that is generated always locate inside debug folder even though I did setting for release on Module Setting.
This is gradle file.
android {
signingConfigs {
config {
keyAlias 'key0'
keyPassword 'password'
storeFile file('C:/path/to/filename.jks')
storePassword 'password'
}
}
compileSdkVersion 28
defaultConfig {
applicationId "com.packagename"
minSdkVersion 19
targetSdkVersion 28
versionCode 3
versionName "2.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
}
and I clicked Build Bundle(s)/APK(s) -> Build APK(s)
Is this what it supposed to do? If not, how can I fix this?
In android studio click on Build variant option on left vertical bar and then select release Build variant then Build Bundle(s)/APK(s) -> Build APK(s)

React Native installRelease Task 'installRelease' not found in root project 'timeReportTool'. Some candidates are: 'uninstallRelease'

Okay so I am trying to get my react-native into an apk file and install it on a device the assembleRelease works fine but it seems like it doesn't get the signing since I can only install the debug version and not installRelease which gives me the error
Task 'installRelease' not found in root project 'timeReportTool'. Some candidates are: 'uninstallRelease'.
here is the Android block from my build.gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.timereporttool"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release // add this line as well
}
}...
I do get an app-release-unsigned.apk so it is clearly not getting signed in Android studios it can't sync the gradle because of this line that were there from the start
apply from: "../../node_modules/react-native/react.gradle"
in Android Studio the node modules map is empty but it exists in the directory
You have to create a signing key and reference it in your project, as described here: https://facebook.github.io/react-native/docs/signed-apk-android
It's crazy that no one answered this for over a year. There's no way around this issue if you publish a React-Native app to the Play Store.
It's due to unsigned code. You have to follow some sort of steps mentioned in the react native official website for generating a signed apk. Otherwise, even though the apk is created, the user not able to install it on their device.
Refer the following link for generating signed apk.
Publishing to Google Play Store

Android.Gradle: Sign release apk and put on specific folder

Gradle 4.2, Android Studio 2.3.3.
My app/build.gradle
android {
compileSdkVersion 26
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.myproject"
minSdkVersion 16
targetSdkVersion 23
versionCode 3
versionName "1.2.3"
}
signingConfigs {
release {
keyAlias keystoreProperties['KEY_ALIAS_RELEASE']
keyPassword keystoreProperties['KEY_PASSWORD_RELEASE']
storeFile file(keystoreProperties['STORE_FILE_RELEASE'])
storePassword keystoreProperties['STORE_PASSWORD_RELEASE']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
If I want to create sign apk I use the next command:
gradlew assembleRelease
As result I get sign apk in the path = \my_project\app\build\outputs\apk\app-release.apk
OK. It's work fine.
Now I has some custom requirements:
Sign release apk
The resul apk name must be "myproject_xxx.apk", where xxx = versionName. So in this example result apk name = "myproject_1.2.3.apk"
The file "myproject_xxx.apk" must be in the directory: my_project\result_apks\
So to do all of this points I need to write my custom gradle task. I'm right?

INSTALL_PARSE_FAILED_NO_CERTIFICATES with OWN .apk

Since I updated my Android Studio, I cant install my App anymore, neither in the debug nor in the release mode.
I always get the error:
pkg: /data/local/tmp/com.myappdomain.mypp
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
Installation failed since the APK was either not signed, or signed incorrectly.
If this is a Gradle-based project, then make sure the signing configuration is specified in the Gradle build script.
Error while Installing APK
From what I googled, this just happens when trying to install unsigned third party .apk
This is my own App though, signed with Android Studio
Gradle looks like this:
android {
signingConfigs {
release {
storeFile file("...")
keyAlias "..."
storePassword "..."
keyPassword "..."
}
}
buildTypes {
release {
minifyEnabled true
zipAlignEnabled true
signingConfig signingConfigs.release
}
}
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId '...'
minSdkVersion 14
targetSdkVersion 22
}
productFlavors {
}
}
I solved it by updating the target SDK to 23 and updating all my used libraries. Maybe it helps you too.

Categories

Resources