重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
You are building a fat APK that includes binaries for android-arm, android-arm64.
什邡ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:13518219792(备注:SSL证书合作)期待与您的合作!
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64
Learn more on:
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
Learn more on:
Initializing gradle... 2.3s
Resolving dependencies... 14.2s
Running Gradle task 'assembleRelease'... ע: E:\work_tool\flutter\.pub-cache\hosted\pub.flutter-io.cn\connectivity-0.4.4\android\src\main\java\io\flutter\plugins\connectivity\ConnectivityPlugin.javaʹ�û????����ѹ�ʱ�� API��
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣
ע: E:\work_tool\flutter\.pub-cache\hosted\pub.flutter-io.cn\url_launcher-5.1.3\android\src\main\java\io\flutter\plugins\urllauncher\WebViewActivity.javaʹ
�û????����ѹ�ʱ�� API��
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣
Calling mockable JAR artifact transform to create file: C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\android.jar\baf414ed95f14e507d85c560886dfbe2\android.jar with input E:\work_tool\sdk\android-sdk-windows\platforms\android-28\android.jar
Calling mockable JAR artifact transform to create file: C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\android.jar\ab096bb3fb172ccb785acdb1058c10a9\android.jar with input E:\work_tool\sdk\android-sdk-windows\platforms\android-27\android.jar
Request to incrementing alive workforce from 0. Current workforce (dead or alive) 0
thread-pool size=4
ProGuard, version 6.0.3
Reading input...
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\flutter.jar\ab2691c929f4d2aa57a17fa551e662a6\jetified-flutter.jar] (filtered)
Reading program jar [F:\dartSpace\flutter\jiddspace\nfc\build\app\intermediates\flutter\release\libs.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\localbroadcastmanager-1.0.0.aar\7a407f962902eada026a8e241a760bac\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\work-runtime-2.1.0.aar\8e3a1e8a8ff79006a94df6c01ceeb4f5\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\fragment-1.1.0.aar\4fa7d1b49e3514cb08c8a696f9b59436\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\room-runtime-2.1.0.aar\1b8774fa39759f08defb930275652eac\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\room-runtime-2.1.0.aar\1b8774fa39759f08defb930275652eac\jars\libs\room-common-java8-2.1.0.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\viewpager-1.0.0.aar\885186e7f6f969363bc93cd607d741a5\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\loader-1.0.0.aar\f84f22ad0a97d2c689850b912fc04277\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\activity-1.0.0.aar\a46db1490fae1b9001fc672a24eb288f\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\customview-1.0.0.aar\fe8bf4a709414e884086911d2168b715\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\core-1.1.0.aar\87febb54759dd5a2c7be8e971d745644\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\versionedparcelable-1.1.0.aar\754157c6f50ca4e4cf3ac8d7cb5ced26\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\androidx.collection\collection\1.1.0\1f27220b47669781457de0d600849a5de0e89909\collection-1.1.0.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\lifecycle-livedata-2.0.0.aar\de6944801d37d99b1dd0b877649fde1f\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\lifecycle-livedata-core-2.0.0.aar\e21d6663beb6faa41a30fd5a582cb4d9\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\core-runtime-2.0.1.aar\724bb0cc2ce99eaf0a23a99bb1cc5c23\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\androidx.room\room-common\2.1.0\b87765704590bd992ea0d92ac50253a9df7818a0\room-common-2.1.0.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\sqlite-framework-2.0.1.aar\9cbdf82e938f7e565620a3682d2406e9\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\sqlite-2.0.1.aar\1215aa5476f752bd431fb2d8059a1a39\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\lifecycle-service-2.0.0.aar\9d24ebd4d6766d7b2cd515369a737934\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\lifecycle-runtime-2.1.0.aar\ca02c0867547ae607130bcc54a4a9ba5\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\lifecycle-viewmodel-2.1.0.aar\594e1ff6298a01d8933530bb534fa472\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\savedstate-1.0.0.aar\8a2c3791a34fc80e5d9d268bf2886f95\jars\classes.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\androidx.lifecycle\lifecycle-common\2.1.0\c67e7807d9cd6c329b9d0218b2ec4e505dd340b7\lifecycle-common-2.1.0.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\androidx.arch.core\core-common\2.1.0\b3152fc64428c9354344bd89848ecddc09b6f07e\core-common-2.1.0.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\androidx.annotation\annotation\1.1.0\e3a6fb2f40e3a3842e6b7472628ba4ce416ea4c8\annotation-1.1.0.jar] (filtered)
Reading program jar [C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\com.google.guava\listenablefuture\1.0\c949a840a6acbc5268d088e47b04177bf90b3cad\listenablefuture-1.0.jar] (filtered)
Reading program jar [F:\dartSpace\flutter\jiddspace\nfc\build\flutter_downloader\intermediates\intermediate-jars\release\classes.jar] (filtered)
Reading program jar [F:\dartSpace\flutter\jiddspace\nfc\build\shared_preferences\intermediates\intermediate-jars\release\classes.jar] (filtered)
Reading program jar [F:\dartSpace\flutter\jiddspace\nfc\build\url_launcher\intermediates\intermediate-jars\release\classes.jar] (filtered)
Reading program jar [F:\dartSpace\flutter\jiddspace\nfc\build\sqflite\intermediates\intermediate-jars\release\classes.jar] (filtered)
Reading program jar [F:\dartSpace\flutter\jiddspace\nfc\build\connectivity\intermediates\intermediate-jars\release\classes.jar] (filtered)
Reading program jar [F:\dartSpace\flutter\jiddspace\nfc\build\path_provider\intermediates\intermediate-jars\release\classes.jar] (filtered)
Reading program jar [F:\dartSpace\flutter\jiddspace\nfc\build\package_info\intermediates\intermediate-jars\release\classes.jar] (filtered)
Reading program directory [F:\dartSpace\flutter\jiddspace\nfc\build\app\intermediates\javac\release\compileReleaseJavaWithJavac\classes] (filtered)
Reading program jar [F:\dartSpace\flutter\jiddspace\nfc\build\app\intermediates\transforms\mergeJavaRes\release\0.jar] (filtered)
Reading library jar [C:\Users\Administrator\.gradle\caches\modules-2\files-2.1\androidx.annotation\annotation\1.0.0\45599f2cd5965ac05a1488fa2a5c0cdd7c499ead\annotation-1.0.0.jar] (filtered)
Reading library jar [E:\work_tool\sdk\android-sdk-windows\platforms\android-28\android.jar]
Reading library jar [E:\work_tool\sdk\android-sdk-windows\build-tools\28.0.3\core-lambda-stubs.jar]
Reading library jar [E:\work_tool\sdk\android-sdk-windows\platforms\android-28\optional\org.apache.http.legacy.jar]
Reading library jar [E:\work_tool\sdk\android-sdk-windows\platforms\android-28\optional\android.test.mock.jar]
Reading library jar [E:\work_tool\sdk\android-sdk-windows\platforms\android-28\optional\android.test.base.jar]
Reading library jar [E:\work_tool\sdk\android-sdk-windows\platforms\android-28\optional\android.test.runner.jar]
Initializing...
Warning: io.flutter.embedding.android.FlutterView: can't find referenced method 'android.graphics.Insets getSystemGestureInsets()' in library class android.view.WindowInsets
Warning: io.flutter.embedding.android.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.embedding.android.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.embedding.android.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.embedding.android.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.embedding.android.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.embedding.android.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.view.FlutterView: can't find referenced method 'android.graphics.Insets getSystemGestureInsets()' in library class android.view.WindowInsets
Warning: io.flutter.view.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.view.FlutterView: can't find referenced class android.graphics.Insets
Note: io.flutter.view.AccessibilityViewEmbedder$ReflectionAccessors: can't find dynamically referenced class android.util.LongArray
Warning: io.flutter.view.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.view.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.view.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.view.FlutterView: can't find referenced class android.graphics.Insets
Note: there were 1 unresolved dynamic references to classes or interfaces.
You should check if you need to specify additional program jars.
()
Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
Thread(Tasks limiter_1): destruction
Warning: there were 12 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
()
Warning: there were 2 unresolved references to library class members.
You probably need to update the library versions.
()
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
Job failed, see logs for details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at
BUILD FAILED in 4m 23s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 264.4s (!)
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See for more information on the problem and how to fix it.
*******************************************************************************************
Gradle task assembleRelease failed with exit code 1
Flutter可以算是当下最火热的新技术之一,我现在所在团队也准备将Flutter技术应用到线上工程中。
关于混合工程,官方文档其实写的已经比较清楚了,按着文档走一般问题不大,
但是有一点值得注意的是,Flutter工程引入的库的gradle的 buildTypes 要与原工程保持一致,如果不一致需要手工添加。
进入正题,现在Flutter官方默认只提供armeabi-v7a、arm64-v8a、x86和x86-64,其中x86和x86-64是为模拟器准备的。目前我们使用的SDK大部分只使用了armeabi架构,直接使用我们会遇见找不到 libflutter.so,libapp.so 的情况,所以我们需要对FlutterSDK做一定的改造。
首先我们要了解下Flutter编译产物,因为不同版本产物是不同的,这里我们只针对Flutter 1.9.1-hotfixes来说。除了资源文件之外,Flutter打包会生成两个非常重要的so库,他们分别是 libflutter.so,libapp.so 。其中 libflutter.so 是Flutter的SDK产物而 libapp.so 正是我们编写的dart文件的产物。默认情况下,这两个文件都会出现在armeabi-v7a中,因此我们要作出对应的改造。
libflutter.so 位于FlutterSDK中,这里顺带提一句,除了这对不同CPU架构,它还分为Debug版和Release版,它们的区别在于Debug是为JIT编译方式打造的,体积较大而Release是为AOT编译方式打造的,体积很小。对 libflutter.so 的改造,只要将其移动文件路径即可,运行以下脚本即可,此脚本来自美团分享的Flutter文章。
移动完了 libflutter.so 之后我们打包发现, libapp.so 仍然会出现在armeabi-v7a中,所以第二部我们就是移动 libapp.so 。这个需要更改 flutter.gradle ,我们在 flutter.gradle 的45行可以看到如下定义,它定义了我们的环境。
在524行我们可以看到,abiValue的取值就是根据上述定义值。
所以结论很简单,只要将
private static final String ARCH_ARM32 = "armeabi-v7a";
改为
private static final String ARCH_ARM32 = "armeabi";
就可以完成对与 libflutter.so 的移动。
前期工作我们都做好了,打成aar就非常简单了
直接使用 flutter build aar --target-platform android-arm
打出来后可以解压检查下 libflutter.so,libapp.so 是否都在armeabi文件夹下即可。
说完了armeabi适配问题,这里下说下有关于有关于FlutterBoost的接入。这个东西接入有两点要注意。
在主app内加上即可,常规操作,强制统一support包的版本号
注释flutter.gradle第655行。因为编译过程中,会去初始化插件项目的buildType下面的debug配置,而插件项目下并未配置debug,导致报错。
如果发现文章中有错误或者有更好的解决方案欢迎指正留言,当然如果本篇文章帮助你解决了问题,也不要吝啬你的感谢。谢谢各位。
最近在写flutter应用,需要集成蓝牙功能,用了一个第三方的库,踩了一些坑,做一下记录。
这是库的地址 PhilipsHue/flutter_reactive_ble: Flutter library that handles BLE operations for multiple devices. (github.com)
安卓主要的坑就是,在使用蓝牙功能的时候,需要获取定位权限,这个需要动态获取。
集成之后,编译出错,提示Swift Compiler Error。
(1)首先尝试,修改对应三方库的Swift编译版本。
我这边尝试修改,没有成功。
(2) 没办法,我这边手动修改三方库的源码文件,进行修复。重新编译成功。
其他问题
最近在集成flutter进项目
以收集编译产物并以cocopods方式集成
产物大概放入两个pod库
这个暂且叫pod1,pod1放flutter.framework,第三方plugin.a,自己写的基础plugin,比如networking,hud等等(由于是混编,不可避免存在很多原生基础组件,所以能公用的基础组件都会弄一个flutter-plugin桥接)
第二个pod2放编译之后的app.framwork,注册文件GeneratedPluginRegistrant,以及各个业务模块.a(有可能没有)结构大概如下面
podspec大概如下
主工程引入这两个pod库即可
接下来从零开始搭建上文所说的
先创建一个flutter module
这个是主flutter工程,用来集成businessModule以及生成app.framework
结构如下图
再生成一个业务工程
注意此时还需要进入example生成ios和Android工程,不然无法单独编译运行
这样 这个单独的业务模块就可以单独跑起来了
此时主flutter工程和业务工程均搭建完毕
在主工程pubspec.ymal文件讲两个工程关联
好了 接下来就是编写脚本收集产物了
编译完成之后会在flutter主工程product生成如下文件
将上面文件分类收集做成文章开头的pod1,pod2 ,在native工程引入即可
在集成flutter的过程中 踩不少坑 也阅读很多前辈的文章,在此一并感谢
本文将简单梳理一下 iOS 工程接入的 Flutter Boost 的流程,以作为前文的补充。
flutter_application_path = '../flutter_module'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
target 'FlutterHybridiOS' do
install_all_flutter_pods(flutter_application_path)
end
接着在工程根目录下运行 pod install ,即可集成上 Flutter Module。看到我们的 Pods 中多了以下几个模块,即说明集成成功。
接着在工程根目录下运行 pod install ,即可集成上 Flutter Module。看到我们的 Pods 中多了以下几个模块,即说明集成成功。
这一块直接参照 Flutter Boost 官方提供的 example 就好了:
PlatformRouterImp.h:
PlatformRouterImp.m:
可以看到,Flutter Boost 支持常规 push,也支持打开模态弹窗,也支持手动 pop。
AppDelegate.h:
AppDelegate.m:
同样的,这里可在 Native 端用两种不同的方式去打开我们在 Flutter Module 中注册好的路由名。
至此,我们成功在 iOS 工程中接入了 Flutter Boost,那就开启我们的混编之旅吧~
最近项目中要集成flutter来进行混编,但是在集成后,突然遇到一个很神奇的问题,在debug模式下,用数据线连接真机打包可以打开flutter页面,但是一旦拔掉数据线,再打开flutter页面就不行了,开始以为是因为flutterSDK的原因,但是一查资料才发现,原来是因为debug模式下flutter实现了热重载,默认的编译方式是JIV,但是iOS14+之后的系统限制了JIV这种编译方式,所以连接Xcode重新run一个release包就可以了,因为flutter在release模式下的编译方式是AOT,iOS14+的系统是支持这种编译方式的,具体解决方案如下图
再运行就可以了。
当然还有另外一种解决方案,就是修改flutter的编译配置,强制设为release