Flutter build no-shrink [closed] - flutter

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 9 days ago.
Improve this question
I am creating a mobile app and then tried to run the application in an android physical and then received this message in the terminal:
Launching lib\main.dart on vivo 1718 in debug mode...
Running Gradle task 'assembleDebug'...
ERROR:C:\Users\ADMIN\StudioProjects\dogcare_app\build\app\tmp\kotlin-classes\debug\com\example\dogcare_app\MainActivity.class: D8: Type com.example.dogcare_app.MainActivity is defined multiple times: C:\Users\ADMIN\StudioProjects\dogcare_app\build\app\tmp\kotlin-classes\debug\com\example\dogcare_app\MainActivity.class, C:\Users\ADMIN\StudioProjects\dogcare_app\build\app\intermediates\javac\debug\classes\com\example\dogcare_app\MainActivity.class
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:dexBuilderDebug'.
> There was a failure while executing work items
> A failure occurred while executing com.android.build.gradle.internal.dexing.DexWorkAction
> Failed to process: C:\Users\ADMIN\StudioProjects\dogcare_app\build\app\tmp\kotlin-classes\debug, C:\Users\ADMIN\StudioProjects\dogcare_app\build\app\intermediates\javac\debug\classes
* 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 https://help.gradle.org
BUILD FAILED in 38s
┌─ Flutter Fix ──────────────────────────────────────────────────────────────┐
│ [!] The shrinker may have failed to optimize the Java bytecode. │
│ To disable the shrinker, pass the `--no-shrink` flag to this command. │
│ To learn more, see: https://developer.android.com/studio/build/shrink-code │
└────────────────────────────────────────────────────────────────────────────┘
Exception: Gradle task assembleDebug failed with exit code 1

Related

i cant found the minSdkVersion 16 in the build.gradle

* What went wrong:
Execution failed for task ':app:dexBuilderDebug'.
> There was a failure while executing work items
> A failure occurred while executing com.android.build.gradle.internal.dexing.DexWorkAction
> Failed to process: C:\Users\El.Sa7er\AndroidStudioProjects\test_1\build\app\tmp\kotlin-classes\debug, C:\Users\El.Sa7er\AndroidStudioProjects\test_1\build\app\intermediates\javac\debug\classes
* 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 https://help.gradle.org
BUILD FAILED in 10s
┌─ Flutter Fix ──────────────────────────────────────────────────────────────┐
│ [!] The shrinker may have failed to optimize the Java bytecode. │
│ To disable the shrinker, pass the `--no-shrink` flag to this command. │
│ To learn more, see: https://developer.android.com/studio/build/shrink-code │
└────────────────────────────────────────────────────────────────────────────┘
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
this is the error
i do not found the minSdkVersion 16
in build.gradle and i dont understand what is error
In your code, In line number 42 is the minSdkVersion. Remove the line and replace it with this line. Sometimes it does not work, so clean the project and build again
minSdkVersion 21

FAILURE: Build failed with an exception. Execution failed for task ':fluttertoast:compileDebugKotlin'

FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':fluttertoast:compileDebugKotlin'.
Compilation error. See log for more 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 https://help.gradle.org
BUILD FAILED in 21s
┌─ Flutter Fix ────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin. │
│ Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then │
│ update F:\Flutter Projects\clima\android\build.gradle: │
│ ext.kotlin_version = '' │
└──────────────────────────────────────────────────────────────────────────────────────────────┘
Exception: Gradle task assembleDebug failed with exit code 1
I am getting such an error when i try to build my flutter project in android studio. Please help someone.

"Cannot run with sound null safety" trying to use Google Maps with Flutter

When I try running Google Maps on Android Studio Emulator I am getting an error message. It does mention some links on where to go on how to solve the problem, but I still don't get it.
The error is:
***
**Launching lib\main.dart on Android SDK built for x86 in debug mode...**
***
lib\main.dart:1
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:
- package:google_maps_flutter
- package:google_maps_flutter_platform_interface
- package:stream_transform
- package:plugin_platform_interface
For solutions, see https://dart.dev/go/unsound-null-safety
3
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\14706\Desktop\CODES\Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1070
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\14706\Desktop\CODES\Flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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 https://help.gradle.org
BUILD FAILED in 52s
Exception: Gradle task assembleDebug failed with exit code 1
***
**Exited (sigterm)**
***
Run this command in the project terminal and then run your app.
flutter pub upgrade --major-versions

Flutter Update issues

My flutter code works perfectly fine and I have run multiple tests on it.
I just decided to install the new VS code updates and restart my VS code application.
All of the sudden I started having the error below and I have searched the entire code for the method but none was found
Launching lib\main.dart on Android SDK built for x86 in debug mode...
lib\main.dart
../../../flutter_windows_1.22.3-stable/flutter/packages/flutter/lib/src/widgets/navigator.dart:3783:32: Error: Getter not found: 'deoNotPop'.
case RoutePopDisposition.deoNotPop:
^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\temp\flutter_windows_1.22.3-stable\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\temp\flutter_windows_1.22.3-stable\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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 https://help.gradle.org
BUILD FAILED in 1m 26s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Someone, please help me
It looks like you may have inadvertedly modified a Flutter SDK file:
flutter/packages/flutter/lib/src/widgets/navigator.dart
case RoutePopDisposition.deoNotPop:
This should say doNotPop and not doeNotPop. Removing the e and saving the file should fix it. You can run git status in your Flutter SDK to see if there are other changes that may need reverting.

Execution failed for task ':app:compileDebugJavaWithJavac'. flutter

my project was going great till i ran flutter clean and then tried to run my app on android,where i got this error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
* 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 https://help.gradle.org
BUILD FAILED in 20s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
This issue will most likely occur when the dependencies of your app is not compatible with your development environment.
On the following SO posts, the best solution for this error is to update the dependencies as also mentioned in the comment above. To backup the references, you can refer to this SO post that exhibits the issues encountered:
Flutter error: Execution failed for task ':app:compileDebugJavaWithJavac'
Execution Failed for task :app:compileDebugJavaWithJavac in Android Studio