I have built a release android apk file, conceived for a size of 7.9 MB.
I manage to install it on my android device, but not to open it because it crashes.
When i use flutter run --release it still does not open and detects no errors.
How can I solve that problem?
Thank you for your help.
Note: I have found several questions close to mine, but they have an error or are not entirely similar to mine. As a consequence the solution given do not work on my case.
Here is some of my build.gradle
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
checkReleaseBuilds false
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.misteref.mykamus"
minSdkVersion 16
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
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}
in app level build.gradle
set minifyEnabled and shrinkResources to false
or use progaurd if you need this two be true
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
To expand on #Joachim Haglund's comment
update your gradle file with the following. All the builds will then be included in the aab file. (It's also worth checking what SDKs you have installed/require updating with Android Studio)
android {
defaultConfig {
//add the following
ndk {
abiFilters "x86", "x86_64", "armeabi", "armeabi-v7a", "arm64-v8a"
}
}
}
Related
I'm running into an odd issue and not at all sure why.
I'm using firebase app distribution to install development-grade versions of my app and whenever I try to install a dev version of my app, it won't install claiming that the app exists already, but it doesn't.
I have the app from the store installed and upon uninstalling that, the app will then install but I don't understand why as both have different applicationIds.
the store version has: com.example.myapp & the dev version has com.example.myapp.preview and the app name is also different as is the version code and version name.
I don't get what they seem to share that is causing it to not allow both of them to coexist.
Not sure if this is important, but when I try to install the dev version, play protect will pop-up claiming the app is unknown and to be sure you trust it.
I'm hoping someone can steer me in a direction on solving this as I'm simply lost on what's causing the conflict.
here is the relevant gradle config:
android {
compileSdk 32
defaultConfig {
applicationId "com.example.myppp"
targetSdkVersion 32
minSdkVersion 26
versionCode verCode
versionName "4.2.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
development {
storeFile file("../keystore/development.jks")
storePassword System.getenv("DEV_SIGNING_STORE_PASSWORD")
keyAlias System.getenv("DEV_SIGNING_KEY_ALIAS")
keyPassword System.getenv("DEV_SIGNING_KEY_PASSWORD")
}
debug {
storeFile file("../keystore/debug.jks")
storePassword System.getenv("DEBUG_SIGNING_STORE_PASSWORD")
keyAlias System.getenv("DEBUG_SIGNING_KEY_ALIAS")
keyPassword System.getenv("DEBUG_SIGNING_KEY_PASSWORD")
}
release {
storeFile file("../keystore/prod.jks")
storePassword System.getenv("PROD_SIGNING_STORE_PASSWORD")
keyAlias System.getenv("PROD_SIGNING_KEY_ALIAS")
keyPassword System.getenv("PROD_SIGNING_KEY_PASSWORD")
}
}
buildTypes {
development {
versionNameSuffix "-DEV"
minifyEnabled false
applicationIdSuffix '.preview'
debuggable true
signingConfig signingConfigs.development
firebaseCrashlytics {
mappingFileUploadEnabled false
}
}
debug {
versionNameSuffix "-DEBUG"
minifyEnabled false
applicationIdSuffix '.debug'
signingConfig signingConfigs.debug
firebaseCrashlytics {
mappingFileUploadEnabled false
}
}
release {
signingConfig signingConfigs.release
// Enables code shrinking, obfuscation, and optimization for only your project's release build type.
minifyEnabled true
// Enables resource shrinking, which is performed by the Android Gradle plugin.
shrinkResources true
// Includes the default ProGuard rules files that are packaged with the Android Gradle plugin.
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// Makes crash reports readable
// #see https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=android
firebaseCrashlytics {
mappingFileUploadEnabled true
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
packagingOptions {
resources {
excludes += ['META-INF/*.kotlin_module']
}
}
kotlinOptions {
jvmTarget = '11'
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
}
buildFeatures {
viewBinding true
}
lint {
abortOnError true
}
}
I have discovered my issue, it appears I was reusing the same file provider identifier, I made that more dependent on the application id and now I'm able to install the dev app alongside my store version.
I also has add product flavors as I saw a few SO answers claim that's a better way to go about what I was looking to do.
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)
I Want generated build apk but after cd android && ./gradlew assembleRelease build failed.
there my info:
* What went wrong:
Could not list contents of '/Users/sweet/Desktop/phase/ka-
mobile/node_modules/react-native/third-party/glog-0.3.4/test-driver'.
Couldn't follow symbolic link.
i already put my-release-key.keystore under android/app
and change android/app/build.gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.kickavenue"
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
}
}
and change android/gradle.properties or change on ~/.gradle/gradle.properties
android.useDeprecatedNdk=true //only on android/gradle.properties i write
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=sample
MYAPP_RELEASE_KEY_PASSWORD=sample
there is wrong my step to build genereated APK
What version of RN are you using? This issue appears on RN 0.46.3 as stated on React Native's github: https://github.com/facebook/react-native/issues/14464
You could upgrade to React Native 0.47.0 to fix the issue.
Try deleting the .bin folder inside your node_modules
I tried to test the release build of the app. So I have added the below config to build.gradle of my app. But that didn't make any effect. Test always runs on debug build
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.****.****"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0 Beta"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
testBuildType "release"
signingConfigs {
release {
keyAlias '******'
keyPassword '*****'
storeFile file('path to keystore')
storePassword '*****'
}
}
buildTypes {
release {
minifyEnabled true
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
multiDexEnabled true
}
}
}
When searched for answers in other SO thread I found testBuildType "release" will run test on release build but it did not work
I'm not sure I got it all, but a few things :
You can test your release with the build variant menu on Android studio (menu at the bottom left) (#Sagar Chavada suggestion)
When you generate your signed apk with Android studio you can choose at the end the build type, release in your case
I know it's for testing purpose but debuggable true in your realease build won't allow you to push it on Google play
Whenever you are building a project and want to create a signed apk then
Add following code in to android {} in your build.gradle file.
productFlavors {
RELEASE {
applicationIdSuffix ".release"
versionNameSuffix "-release"
}
DEBUG {
applicationIdSuffix ".debug"
versionNameSuffix "-debug"
}
}
Go to Android SDK --> Build.
Tap on Generate Signed APK
It will ask to create a debug or Signed build (apk format)
Then select release flavour and generate apk.
When I start Gradle to build a test or debug application, It logs this at the very beginning.
BuildType_Decorated{name=release, ...
with attributs from the release builtType, While I ran the Debug buildType !
Any idea what this issue could be ?
compileSdkVersion ANDROID_BUILD_SDK_VERSION
buildToolsVersion ANDROID_BUILD_TOOLS_VERSION
productFlavors {
// Define separate dev and prod product flavors.
dev {
// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
// to pre-dex each module and produce an APK that can be tested on
// Android Lollipop without time consuming dex merging processes.
minSdkVersion 21
multiDexEnabled false
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
prod {
// The actual minSdkVersion for the application.
minSdkVersion ANDROID_BUILD_MIN_SDK_VERSION
multiDexEnabled false
}
}
defaultConfig {
applicationId "fr.millezimsolutions.app.millezimu"
targetSdkVersion ANDROID_BUILD_TARGET_SDK_VERSION
minSdkVersion ANDROID_BUILD_MIN_SDK_VERSION
versionCode ANDROID_BUILD_VERSION_CODE
versionName ANDROID_BUILD_APP_VERSION_NAME
}
buildTypes {
release {
debuggable false
ext.enableCrashlytics = true
renderscriptOptimLevel 3
signingConfig android.signingConfigs.release
zipAlignEnabled true
minifyEnabled true
// shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules-release.pro'
}
debug {
debuggable true
renderscriptOptimLevel 3
applicationIdSuffix ".debug"
versionNameSuffix "debug"
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-debug.pro'
testProguardFile('proguard-rules-test.pro')
}
}