flutter打包的android包部分手机安装失败(flutter run --release命令和flutter build apk命令的区别)

如题,直接说原因:

flutter run --release命令打的包不行,必须要通过build apk(flutter build apk命令)的方式来

后面android打包都用build apk的命令来打包,这个命令打出的包会大一些,因为包含了更多的支持的cpu abi指令集,能适配更多的手机。
用flutter run --release命令打出来的包只是针对你当前插入的手机来执行的包,体积要小很多。
所以以后都用flutter build apk命令或者android里面的菜单:

这种方式打包。

执行打包命令后,提示:

Running "flutter pub get" in newsinenglish... 1.2s
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
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,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'...

细看上面的绿色显示的命令,其实还是有很多方式去执行打包的。

猜你喜欢

转载自blog.csdn.net/wangyajuncsd/article/details/106946695