An error occurs when obfuscating the Flutter app - flutter

I'm about to release my Flutter app.
https://flutter.dev/docs/deployment/obfuscate
I read the above page and ran the following command in a terminal, but I get an error.
flutter build appbundle --obfuscate --split-debug-info /projectName/odf
↓error contents
* Where:
Script '/Users/userno1/dev2/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1035
* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/Users/userno1/dev2/flutter/bin/flutter'' finished with non-zero exit value 1
flutter build appbundle
With the above command, the release build was successful.
I'd like to somehow obfuscate the source code, which is the result of my efforts.
Is there any good way?

You're incorrectly using the command:
flutter build appbundle --obfuscate --split-debug-info /projectName/odf
because you're missing the = after --split-debug-info
Try the following command:
flutter build appbundle --obfuscate --split-debug-info=your_debug_info_directory
Where your_debug_info_folder is a directory in your project

Related

flutter build appbundle --obfuscate error

I want help configuring the apk file
I see this message
> flutter build appbundle --obfuscate
"--obfuscate" can only be used in combination with "--split-debug-info"

failed to build flutter apk because of this error SigningConfig "release" is missing required property "storeFile"

I have a flutter project and I wanted to get an apk for the app I tried flutter build apk command and I got this error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageRelease'.
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
> SigningConfig "release" is missing required property "storeFile".
I've tried this command flutter build apk --release but I also got the same error.
I also searched and tried different solutions but nothing fixed the issue.
General-ish solution that could work for you:
Try flutter clean and then flutter pub get.
If that doesn't work, you can try upgrading your Flutter SDK like so: flutter upgrade.
You can also run flutter doctor to see a list of possible issues with your code.
After running the set of commands, then try building the .apk.

Flutter APK Errors while build apk command running?

I have a flutter app and its working fine in debug mode but when i run flutter build apk command for android apk it shows the following error.
The error is cannot run with sound null safety.
Error:
C:\Users\RAILO\flutter\bin\flutter.bat --no-color build apk
Building with sound null safety
Running Gradle task 'assembleRelease'...
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:
- package:flutter_swiper
- package:flutter_page_indicator
- package:transformer_page_view
For solutions, see https://dart.dev/go/unsound-null-safety
FAILURE: Build failed with an exception.
Add this line on top of main.dart
// #dart=2.9
then run $flutter clean && flutter pub get
you can try this command also.
flutter build apk --release --no-sound-null-safety

FAILURE: Build failed with an exception. flutter.gradle' line: 904

FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
I tried flutter clean / pug get and update but application is still not working.
Try this:
flutter clean
flutter pub get
Once these two commands have been successfully executed, launch your project ... This is what I did and it worked.
try running
flutter clean
flutter upgrade
it work for me.
In Android Studio I did the following:
flutter clean
flutter pub get
Invalidate Caches and Restart (from the File menu)
After all that, I re-ran the flutter build appbundle command and it worked.
My antivirus was blocking dart from reading asset images, i allowed it from there and the error got fixed!!
I've had the same error and tried the following:
uninstall android studio and delete all folders regarding this
clean up registry
review path for environment variables
give all sorts of flutter commands (clean, update, and so on)
Until I realized this is an error on the flutter folder, so basically this is due to some force close some operations and the variables that write in the 'flutter.gradle' file are obsolete. What I did and worked for me:
Make sure you have all android studio processes closed.
Delete the flutter folder (the one that you defined as for the PATH)
Extract in the same location the flutter folder from the SDK archive.
Enjoy :)
Powershell commands Example:
Remove-Item 'D:\DEV\flutter'
Expand-Archive -LiteralPath 'C:\Archives\flutter_windows_1.22.3-stable.Zip' -DestinationPath D:\DEV

when i release my apps flutter application this happens in android studio

C:\Users\i\Desktop\New folder\Covid-19-Flutter-UI-master>flutter build apk --release
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
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\i\Desktop\New folder\Covid-19-Flutter-UI-master\android\app\build.grad
le' line: 50
* What went wrong:
Could not compile build file 'C:\Users\i\Desktop\New folder\Covid-19-Flutter-UI-master\andr
oid\app\build.gradle'.
> startup failed:
build file 'C:\Users\i\Desktop\New folder\Covid-19-Flutter-UI-master\android\app\build.gr
adle': 50: expecting anything but ''\n''; got it anyway # line 50, column 15.
" }
^
1 error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to g
et more log output. Run with --scan to get full insights.
Gradle task assembleRelease failed with exit code 1
C:\Users\i\Desktop\New folder\Covid-19-Flutter-UI-master>
Follow all these steps: https://flutter.dev/docs/deployment/android
Flutter and Android also recommend using App bundle as preferred over APK, so try using flutter build appbundle once you have followed all the steps.