準(zhǔn)備工作
1.創(chuàng)建native工程
app->build.gradle
android {
//...
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
2.創(chuàng)建flutter工程
cd some/path/
flutter create -t module --org com.example my_flutter
1.引入
1.1源碼引入
app->settings.gradle
setBinding(new Binding([gradle: this])) // new
evaluate(new File( // new
settingsDir.parentFile, // new
'my_flutter/.android/include_flutter.groovy' // new
))
app
dependencies {
implementation project(':flutter')
}
1.2aar引入
build aar
cd some/path/my_flutter
flutter build aar
image.png
體積分析截圖
image.png