0

I was looking for a way to obfuscate my Android APK/AppBundle, then I found this command:

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. 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?

iDecode
  • 22,623
  • 19
  • 99
  • 186

1 Answers1

2

Obfuscate Code : We have 2 level for obfuscate your code:

  • Obfuscate for native code (Java, Kotlin) , this config will at gradle file. you can read more at:

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

  • Obfuscate Dart code. (the same with your command)

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

You can obfuscate both Native Code and Dart Code.

Build release for 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

dangngocduc
  • 1,588
  • 8
  • 13
  • "But it doesn't have keystore information so I can't publish this file on the Google Play Console." -> you can create new one. If you already have it, let config on gradle at signingConfigs. (in my attach link). - "but then it doesn't use obfuscation." -> because they are use GUI. After config key for release on gradle. you can run above command. – dangngocduc Dec 13 '21 at 07:55
  • Yes, *it* meant *command* not *me*. I was talking about the command. The command doesn't allow me to enter keystore information. – iDecode Dec 13 '21 at 08:14
  • And sorry I didn't understand second part of your comment. You can edit your post to explain it. – iDecode Dec 13 '21 at 08:15
  • you can config keystore information on your gradle. you can try with this guide https://stackoverflow.com/questions/18328730/how-to-create-a-release-signed-apk-file-using-gradle – dangngocduc Dec 13 '21 at 08:22
  • Thanks, that's what I was looking for. I'll upvote your post for this :) – iDecode Dec 14 '21 at 09:39