How to build signed apk from Android Studio for Flutter
You can build the Apk/AppBundle using IDE and command line.
Building APK/AppBundle through IDE:
Step-1
In Android Studio's tab bar, click on
Tools
and thenFlutter
and thenOpen Android module in Android Studio
:Step-2
Open Project it in New Window:
Step-3
Having opened the project, click on
Build
and thenGenerate Signed Bundle / APK ...
Building APK/AppBundle through command:
Step-1:
Modify your
build.gradle(app)
file and include your key information there:android {
compileSdkVersion 31
signingConfigs {
release {
storeFile file("<path-to-keys.jks>")
storePassword "********"
keyAlias "<key-alias>"
keyPassword "********"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}Step-2:
Build AppBundle:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64 --obfuscate --split-debug-info=/<directory>
Build APK:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi --obfuscate --split-debug-info=/<directory>
Build android studio signed apk with release build type
Pick Build Variants
tab at the bottom-left panel and choose a release type:
P.S. Don't forget to give a credit to the @MatPag's comment.
Generating unsigned, release apk with Android Studio
In the release
build type, don't specify a signingConfig
at all, and your build won't be signed. Release builds don't pick up the default signing config that debug builds get, so it should work for those.
There's a discussion on the adt-dev mailing list about it.
Bear in mind that to build from Android Studio, you'll need to go to the Gradle tasks window and choose the assembleRelease
task; normal builds via "Make Project" don't actually build the final APK.
Flutter build apk on release mode cannot generate updated version
I think you need
flutter clean
(I'd consider it a bug that this is necessary, but I'm encountering it as well)
and
flutter build apk --release
Related Topics
Android Webview for Facebook Like Button
Android Taking Screenshot of Offscreen Page
Android Progressbar UI Custom Layout
Getting Results of Nearby Places from User's Location Using Google Maps API in Android
Phonegap Plugin:How to Convert Base64 String to a Png Image in Android
Android: When Is Oncreateoptionsmenu Called During Activity Lifecycle
Glide-4.0.0 Missing Placeholder, Error, Glideapp and Does Not Resolve Its Method Placeholder,Error
Best Way to Update Data with a Recyclerview Adapter
Eclipse Indigo - Cannot Install Android Adt Plugin
Android Spinner with Different Layouts for "Drop Down State" and "Closed State"
How to Populate Android Room Database Table on First Run
Android How to Create Triangle and Rectangle Shape Programmatically
Android - Hide All Shown Toast Messages
Emulator Appearing Offline on M1 MAC After the Last Update of Arm64-V8A
Android: How to Get Gsm Signal Strength for All Available Network Operators