Is there a way to build apk for Flutter from Android Studio.
I have seen this guideline: https://flutter.dev/docs/deployment/android
But here flutter console is used to build apk.
Is there a way to build apk for Flutter from Android Studio.
I have seen this guideline: https://flutter.dev/docs/deployment/android
But here flutter console is used to build apk.
Go to
File > Project Structure
Select your-app-name
under module.
Click on your
app
and then click+
Under the add tab select
android
Now you can see
generate signed apk/bundle
enabled underbuild
tab
As per DanyPata For flutter you have to set the signing file and then run flutter build APK. It's quite important to run the flutter command so that all the changes/libs added in flutter are also added in the Android project.
Go to File
- Project Structure
and select app
under Modules
. NOTE: It probably won't be called app
- It may be under whatever name you gave it when creating the project. Select the Signing
tab.
You need to create a certificate so click the blue plus sign and fill in the blanks. When you finish this process then you head over to the Build Types
tab and make sure you have two - debug
and release
, if you don't have release
then again press the blue plus sign and create it.
For a release build, you will want to select the Signing Config
you previously created and leave the rest as default.
Then to build your release APK go to Build
on the top main bar, then Build Bundle(s) / APK(s)
and select Build APK(s)
.
Keep a close eye on the Event Log
to see when its complete and the path where APK was saved to.
Update the gradle.build
file. Make sure your project visibility is set to something like Project
so you can see all the files in the file tree.
Head down to yourapp/src
then open build.gradle
.
Under, android
add:
buildTypes {
release {
minifyEnabled false
signingConfig signingConfigs.theNameForCertificateYouCreated
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
IMPORTANT: As a quick reminder and precaution, DO NOT lose the key it creates. Without this, you won't be able to update your application because the new release will need to be signed with the same key.
Every times you run your app, it will generate apks.
You can find it in your project files :
yourProject\build\app\outputs\apk