颤振模块的Android包装器库

时间:2020-08-23 04:57:54

标签: flutter dart flutter-add-to-app

根据文档https://flutter.dev/docs/development/add-to-app/android/plugin-setup#b-plugins-needing-project-edits

For advanced users, if more modularity is needed and you must not leak knowledge of your Flutter module’s dependencies into your outer host app, you can rewrap and repackage your Flutter module’s Gradle library inside another native Android Gradle library that depends on the Flutter module’s Gradle library. You can make your Android specific changes such as editing the AndroidManifest.xml, Gradle files or adding more Java files in that wrapper library.

因此,我们可以为flutter模块创建Android本机包装库,以便将该库导入外部项目中,而不是直接添加Flutter模块。

我的问题是我们如何在Android库中添加Flutter模块

在文档中给出了使用此命令更新settings.gradle的

// Include the host app project.
include ':app'                                    // assumed existing content
setBinding(new Binding([gradle: this]))                                // new
evaluate(new File(                                                     // new
  settingsDir.parentFile,                                              // new
  'my_flutter/.android/include_flutter.groovy'                         // new
)) 

但是我们无法将settings.gradle添加到android库模块。只能将其添加到根项目中。

任何人都可以共享git repo,因为它在Android库中具有flutter模块吗?

我做了什么:

  1. 创建一个新的Android项目
  2. 添加了新的模块库说明
  3. 在库中克隆flutter模块目录
  4. 在:mylibrary build.gradle中添加了implementation project(':flutter')

现在,当我生成aar时,即使根项目运行正常,它也不包含flutter模块的

0 个答案:

没有答案