I am trying to add a Flutter Module to a native Android app via an .aar file.

I followed the steps here: https://flutter.dev/docs/development/add-to-app/android/project-setup

I create a new Android project. I also created a new Flutter Module independently (different location and IDE project outside of the Android project). Then I built an .aar via flutter build aar of the module. Then I created a module from that .aar file in the Android project.

Unfortunately, I can not get it to work. After adding the aar module, I can not access FlutterActivity, FlutterEngine etc. Only FlutterFragment and Flutter under io.flutter.facade are available. I can not see the io.flutter.embedding package.

IDE Screenshot

Apparently, the Flutter dependencies are not included in the .aar archive. I tried various "fat aar" build scripts. No success. Also, as I understand, the described approach with the flutter build aar should contain all necessary Flutter dependencies, right?

Some people seem to got it to work. Unfortunately, there is no example project or specific help about the .aar approach anywhere.

Can someone help?

Solution 1: Tushar Sharma

Add this in your AndroidManifest.xml

android:theme="@style/LaunchTheme"  android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"

Refer this below link


This might help you.

Solution 2: Quang Duy Tran

You're right, AAR should contain all dependencies so from the native side, you don't need to do any extra steps, maybe you missing include one of them

maven {
    url "$project.rootDir/../duy_flutter_module/build/host/outputs/repo"
maven {
    url 'http://download.flutter.io'

remember that if your android native project has 2 modules, app and second module (contain an activity host your Flutter), your need to add AAR to both modules or add to build.gradle root inside allprojects block. You can refer to here https://github.com/duytq94/demo-integrate-flutter

Solution 3: ashutosh

I was able to add Flutter module to Android via stand alone .aar.

Steps to add Flutter build aar to Android Native

  1. Add aar to app/libs folder.If dont have libs folder create one.
  2. Under app build.gradle add

repositories {

flatDir { dirs 'libs' }
maven {
url "https://storage.googleapis.com/download.flutter.io"
maven {
url 'https://maven.google.com'
} }

3.under dependencies in build.gradle.
Specify the aar that you are providing

dependencies {
implementation(name: 'flutter_release-1.0', ext: 'aar')
implementation 'io.flutter:flutter_embedding_release:1.0.0-a9d'
implementation 'io.flutter:armeabi_v7a_release:1.0.0-a9d'
implementation 'io.flutter:arm64_v8a_release:1.0.0-a9d'
implementation 'io.flutter:x86_64_release:1.0.0-a9d'


These below implementation you can find under outputs -> repo -> com.packagae --- -> /flutter_release/1.0{version}/flutter_release{version}.pom file

implementation 'io.flutter:flutter_embedding_release:1.0.0-a9d'
implementation 'io.flutter:armeabi_v7a_release:1.0.0-a9d'
implementation 'io.flutter:arm64_v8a_release:1.0.0-a9d'

You can find pom as below image

enter image description here