Flutter apk builds, installs but then will not open - android

I'm attempting to create apk for my flutter app. It works when running flutter run on both emulator and device.
When running:
flutter build apk
Get success and apk. When copying apk to device it installs but then cannot be opened. (After install button to open is grayed out and finding app in app draw opens up the app info page). Have tired apk on multiple devices.
flutter run --release works
I've followed the steps to migrate to Androidx and have checked all packages build.gradle to ensure all are compileSdkVersion 28.
I've tried running on stable, master and beta flutter branch.
Running:
flutter build apk --release gives (on flutter beta branch)
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'... 2.8s
✓ Built build/app/outputs/flutter-apk/app-release.apk (21.2MB).
EDIT:
The plot thickens xD. I can launch the app from deeplinks, but using the app icon always launches into settings.

Add below code to
android\app\build.gradle
Inside android {
}
buildTypes {
release {
signingConfig signingConfigs.release
ndk {
abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
}
}
}

Turns out I had the package app availability installed which was using the compileSdkVersion of 27. Changing this to 28 in that package's build.gradle seemed to fix it.
The easiest solution was just to swap that package out.

Related

What's the difference between build and release in flutter?

Why the size of flutter build apk --release is larger than the size of flutter run --release which reduces the size by half. I need to get the leaner app size.
We should know that flutter run --release compiles only for a target ABI (because you run the generated APK directly to your device). while, flutter build apk --release results in a fat APK (Universal apk) that contains your code compiled for all the target ABIs, as a result, you could install this apk on any device.
Flutter app can be compiled for
Armeabi-v7a (ARM 32-bit)
Arm64-v8a (ARM 64-bit)
x86-64 (x86 64-bit)
In Flutter, a build refers to the process of taking your source code and turning it into a deployable app. There are two types of builds in Flutter: debug builds and release builds.
Debug builds are used for development and testing. They are built with debugging symbols enabled, which makes it easier to debug your code. Debug builds also include a debugger that allows you to pause the execution of your code and inspect variables and the call stack.
Release builds are used for deploying your app to app stores or distributing it to users. They are built with debugging symbols stripped, which makes the app smaller and faster. Release builds also have optimizations enabled, which makes the app even faster.
To create a release build in Flutter, you can use the flutter build command with the --release flag. For example:
flutter build apk --release
This will create a release build of your app in the build/app/outputs/apk directory.

Wrong icons when I run the aplication in release mode in flutter

I just finished an application with flutter and while I run it in debug mode everything is fine, but when I switch to --profile or --release mode it changes all the icons that I use and puts others, even the navigation arrows of the application.
I've had this error before while locally testing on a device with an .apk file directly generated from flutter build.
It fixed itself once I tested from the play store.
I found that when directly testing flutter build .apk files, there are issues as there are different processor types armeabi-v7a (ARM 32-bit), arm64-v8a (ARM 64-bit), and x86-64 (x86 64-bit).
If you are testing locally I would recommend:
Building an app bundle using flutter build appbundle in
terminal.
Using the bundletool from the GitHub repository.
Generate a set of APKs from your app bundle.
Deploy the APKs to connected devices.
Source

Flutter: How to create a development APK that can be installed on the phone

I recently started working with flutter. I have been making several test applications. They all work well on emulators.
But now I want to be able to use them on my cell phone.
I took the APK that is generated when I run the application in the emulator, indicated in this route:
But it always fails to install
So far, my applications are simple, Hello world, Add numbers, etc.
Any ideas?
How should I do it correctly?
First: Open your Terminal/Shell/Command Line and open the directory of the Flutter App in there (cd PATH_TO_YOUR_FILE)
You probably want to create a profile-mode apk for testing. This build still helps debugging while having the speed of the --release version:
This creates a single APK which works on all devices (x64, arm64 and arm), it's probably pretty big:
flutter build apk --profile
If the people who install your App know which devices they have, you can use the split-per-abi command which creates three different APKs for all architectures (x64, arm64 and arm)
flutter build apk --profile --split-per-abi
If you want to have a release build, you can use what #Niteesh commented:
flutter build apk --release --split-per-abi
Release-builds can be uploaded to Google-Play (also the internal testing)
Read more: https://flutter.dev/docs/testing/build-modes
the apk that is generated when you run the app is the debug-apk, it contains lots of overheads which helps in flutter hot reload and hot restart. The size of debug apk version is also a lot.
use this command to generate release version of apk
flutter build apk --split-per-abi
After execution of the command, you get the path of the apk, something like this
√ Built build\app\outputs\flutter-apk\app-armeabi-v7a-release.apk (7.0MB).
Then you can install that apk on your phone

Flutter apk running fine in release mode and debug mode but built apk not working?

I have an app running fine in flutter run and flutter run --release.
I am using flutter flutter_ssh plugin(this plugin is not connecting)
I have already given the required permission internet permission in main manifest file
But built apk not working
this is my repo
issue solved by building apk using
flutter build apk --split-per-abi --no-shrink
or
flutter build apk --no-shrink

React Native Android Debug APK installed but unsigned doesn't

when i built the APK with react native in windows with the debug version it worked fine (also in the emulator) and installed in the real device, but when i tried to build with the release version i saw the message ( app not installed ) , the problem is i have no way to trace or debug this problem (probably i don't know ), i tried to fix this problem for about one week ,so i ask for some help here , thanks
gradlew assembleDebug --- installed fine
gradlew assembleRelease --- app not installed
also i added this lines to gradle.properties file in my project
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=123456
MYAPP_RELEASE_KEY_PASSWORD=123456
other details
react native version 0.48 ---
my device android version 5.0
windwos version 8.1
the project is AwsomeProject --- the initial projects to test
NOTE : in all situations i see the message "BUILD SUCCESSFUL" and the file generated without any problem or any error message
$ cd android && gradlew assembleRelease creates a signed apk.
(Note: Don't forget to cd out of <MyProject>/android after creating a signed apk back the root of your directory)
$ react-native run-android --variant=release will install the signed apk onto your device
It is all about adding this line in the gradle.properties file
signingConfig signingConfigs.release
hope it help someone
You need to generate some certificates to be able to run your signed APK , in the RN docs that is documented.
Please check this out RN Docs

Categories

Resources