How to build Flutter project with Android aar file?

yushulx

I want to use Flutter to create an Android app which depends on a third-party SDK that wrapped in an aar file. So far, I have only found the article Accessing Platform and Third-Party Services in Flutter. It seems that I have to build the Flutter project with additional Java files using Android Studio. This is complicated and not what I want. Is there any way to directly load aar files or *.so files in Dart code? Something like how JNI works.

yushulx

After learning the Flutter example - hello services, I have successfully built my Flutter project with aar file.

Basic Steps:

  1. Download the Flutter source code.
  2. Open flutter/examples/hello_services/android in Android Studio.
  3. Click File > New > New Module and choose Import .JAR/.AAR Package.
  4. Press F4 to open Project Structure, and then add the dependent module.
  5. Write Java code to invoke APIs that defined in aar file.
  6. Import flutter/examples/hello_services to Intellij IDEA.
  7. Build and run the Flutter app.

I've pushed the source code to GitHub.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to set Flutter build android aar version?

How to build aar in flutter

How to build CHAQUOPY Android library (.AAR or .JAR file) in Android Studio

How to use the downloaded maven aar file in my Android project?

How to install build Flutter project on android studio

Android failed to rename aar file in build

How to build AAR from Android Library?

How to create *.aar file from "existing" android studio project ( Not creating new android library)?

How to remove .aar file form Android Studio

How to publish an Android .aar file to Artifactory

How to download leakcanary-android aar file

Where is build.yaml file in Flutter project?

How to effectively add dependency .aar file in Xamarin project?

How to exclude a file from analyzing by Android Studio for a Flutter project?

Android Flutter project cannot build with various errors

How to include different .aar depending on the android build variant

How can I build an .aar library with shrunk classes in Android Studio?

How to include aar files used in library projects in main project in Android

How can I generate both an aar and apk of my Android project

How to release an AAR with another android library project dependency?

How to choose only .aar file from file manager in android

How to build an Android project with Ninja?

How and where to build UI design in a flutter project?

How to exclude a file from an .AAR Android library archive with gradle

How to import a .aar file into Android Studio 1.1.0 and use it in my code

Create aar file in Android Studio

Export Android Library as AAR file

How to build old Android project in Android Studio

copy release aar file after succeful build