简体   繁体   中英

How to integrate a flutter module in android?

I am trying to integrate a flutter module in my android native project with Kotlin language. I am getting errors while following the steps given in the docs .

I have followed the steps mentioned in the docs:

STEP 1:

C:\Users\user\AndroidStudioProjects\DataStore> flutter create -t module --org com.example my_flutter

STEP 2:

C:\Users\user\AndroidStudioProjects\DataStore> cd my_flutter

STEP 3:

C:\Users\user\AndroidStudioProjects\DataStore\my_flutter> flutter build aar

STEP 4:

Consuming the Module

  1. OLD WAY: Open \app\build.gradle

    NEW WAY: Add repository inside repositories block of dependencyResolutionManagement and pluginManagement blocks in settings.gradle

  2. Ensure you have the repositories configured, otherwise add them:

 String storageUrl = System.env.FLUTTER_STORAGE_BASE_URL ?: "https://storage.googleapis.com" repositories { maven { url 'C:\Users\user\AndroidStudioProjects\DataStore\my_flutter\build\host\outputs\repo' } maven { url "$storageUrl/download.flutter.io" } }
  1. Make the host app depend on the Flutter module:
dependencies {
  debugImplementation 'com.example.my_flutter:flutter_debug:1.0'
  profileImplementation 'com.example.my_flutter:flutter_profile:1.0'
  releaseImplementation 'com.example.my_flutter:flutter_release:1.0'

}
  1. Add the profile build type:
android {
  buildTypes {
    profile {
      initWith debug
    }
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM