Methods to construct APK our flutter undertaking? | by Marva Athatillah | Jul, 2022


We will construct the Flutter undertaking that has been created right into a .apk file that may run on Android. APK construct is a strategy of wrapping flutter functions into .apk format which can later be put in on Android gadgets. Listed below are the steps when constructing a Flutter app to an APK.

Earlier than constructing the APK, we’ll configure the android/app/src/important/AndroidManifest.xml file. AndroidManifest.xml is a file that incorporates details about the Android software to be constructed. The knowledge is within the type of the applying title, icon, permissions, display screen orientation, and others. The contents of AndroidManifest.xml are as follows:

<manifest xmlns:android=""
package deal="id.eudeka.samples">
android:useful resource="@type/NormalTheme"
android:useful resource="@drawable/launch_background"
<motion android:title="android.intent.motion.MAIN"/>
<class android:title="android.intent.class.LAUNCHER"/>
android:worth="2" />

To set the applying title, we merely change the android:label property within the AndroidManifest.xml file as follows:



android:label="App Title"

Fill in android:label with the title of the specified software. Or you need to use the next library to generate the app title from pubspec.yaml.

By default, our Flutter app icon is a Flutter icon. To vary the applying icon simply, we’ll change the ic_launcher.png picture situated within the android/app/src/important/res/ folder which is split into numerous mipmaps (icon decision sizes).

The very first thing we do is create an app icon with Android Asset Studio.

With Android Asset Studio, we will simply create software icons, and later they are going to be made in numerous resolutions (mipmap). After creating the icon as desired, press the obtain button within the higher proper.

After downloading, unzip the file and discover the res/ folder in it. Then copy the res/ folder to android/app/src/important/res/ to switch the ic_launcher.png on every mipmap with the brand new app icon. Or you need to use the next library to generate launcher icon from pubspec.yaml.

When the app is in debug or profile mode, web permissions can be robotically added. However whenever you wish to run or construct it in launch mode, you want to add all of the required permissions to the AndroidManifest.

So as to add permissions to an Android software, you may add the uses-permission tag to the AndroidManifest, contained in the manifest tag and in step with the applying tag. For instance, as proven beneath:

<uses-permission android:title="android.permission.INTERNET"/>

After we set the app title and icon, the following step is to construct the app into an APK. Beforehand, there have been three (3) sorts of software modes that wanted to be recognized, specifically debug, profile, and launch. Debug APKs are typically used for inner testing and deployment of apps. Debug mode is utilized by default when operating functions utilizing the flutter run command. In the meantime, to be launched by means of the Google Play Retailer, you want to make an APK launch. Whereas profile mode is identical as launch, it may well nonetheless be debugged utilizing instruments reminiscent of DevTools and can’t be run on emulators or simulators.

On this class, we’ll discover ways to construct a debug APK. The trick is to make use of the terminal on Android Studio. Press the Terminal button within the decrease left nook.

When utilizing Visible Studio Code choose the terminal menu within the prime left menu. Then choose new terminal.

If the terminal has appeared, write the next command:

flutter construct apk --debug

Wait till the construct course of is profitable. After a profitable construct, the ensuing construct within the type of an apk-debug.apk file can be situated within the construct/app/outputs/apk/debug/ folder or a listing will seem the place the file is saved when the construct is full in Terminal.

To have the ability to construct apk launch and add it by way of Google Play Retailer, you want a signing key. This signing key’s used as a signature to make your software safer. By default Flutter makes use of the debug key because the signing key so you may truly create an apk launch by operating the next command:

flutter construct apk

Nonetheless, in fact, it could be higher when you use your personal signing key. You possibly can learn the right way to create a signing key and create an apk launch on the following documentation hyperlink:



Leave a Reply

Your email address will not be published.