简体   繁体   English

Flutter 使用代码混淆构建签名的 apk 或 appbundle

[英]Flutter build signed apk or appbundle with code obfuscation

I was looking for a way to obfuscate my Android APK/AppBundle, then I found this command :我正在寻找一种方法来混淆我的 Android APK/AppBundle,然后我找到了这个命令

flutter build apk --obfuscate --split-debug-info=/<project-name>/<directory>

But it doesn't have keystore information so I can't publish this file on the Google Play Console.但它没有密钥库信息,因此我无法在 Google Play 控制台上发布此文件。 Then, I found this post for building the app with keys but then it doesn't use obfuscation.然后,我发现这篇文章用于使用密钥构建应用程序,但它没有使用混淆。

So, how do I build a release version of my app with Dart code obfuscation?那么,如何使用 Dart 代码混淆构建我的应用程序的发布版本?

Obfuscate Code: We have 2 level for obfuscate your code:混淆代码:我们有 2 个级别来混淆您的代码:

  • Obfuscate for native code (Java, Kotlin), this config will at gradle file.对本机代码(Java、Kotlin)进行混淆,此配置将位于 gradle 文件中。 you can read more at:你可以阅读更多:

https://developer.android.com/studio/build/shrink-code https://developer.android.com/studio/build/shrink-code

  • Obfuscate Dart code.混淆 Dart 代码。 (the same with your command) (与您的命令相同)

https://docs.flutter.dev/deployment/obfuscate https://docs.flutter.dev/deployment/obfuscate

You can obfuscate both Native Code and Dart Code.您可以混淆本机代码和 Dart 代码。

Build release for APK. APK 的构建版本。

  • If you don't have keystore to sign app, you can create it with this guide:如果您没有密钥库来签署应用程序,您可以使用本指南创建它:

https://developer.android.com/studio/publish/app-signing https://developer.android.com/studio/publish/app-signing

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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