Why flutter debug works but not release? - flutter

My app builds successfully in debug mode and runs fine but when using flutter run --release it gives some issues.
* What went wrong:
Task 'assembleAarRelease' not found in root project 'flutter_plugin_android_lifecycle'.
* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run w
ith --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 1s
Exception: The plugin flutter_plugin_android_lifecycle could not be built due to the issue above.
My flutter version is:
Framework • revision f04b3d917f (7 months ago) • 2020-11-07 16:09:02 -0500
Engine • revision 0f7cdca65f
Tools • Dart 2.12.0 (build 2.12.0-27.0.dev)

Related

Flutter project is not running on physical device

When I make a build of flutter project on windows(chrome) it run successfully but when i run on my phone it gives this error
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following SDK components:
tools Android SDK Tools
build-tools;29.0.2 Android SDK Build-Tools 29.0.2
The SDK directory is not writable (C:\Users\Cantt)
* 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 44s
Exception: Gradle task assembleDebug failed with exit code 1
I installed the Andriod SDK platform 32 and 31. please help how to fix this issue.
Open android studio and go to SDK manager
Check SDK platforms API level 28, 29, 30
Then apply and ok
Then
flutter clean
flutter pub get
flutter run
Try the following on Android Studio.
Help>Find Action and then search for each and select:
clean project
rebuild project
Invalidate caches
Then restart Android Studio.
This should fix the issue.

While running flutter app on physical device it is giving me the error

FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Failed to find Build Tools revision 28.0.3
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 3m 24s
Exception: Gradle task assembleDebug failed with exit code 1
You may need to install the Android SDK Tools. The more easiest way is from Android Studio.
The Flutter docs show how to do:
https://flutter.dev/docs/get-started/install/linux#android-setup
Download and install Android Studio.
Start Android Studio, and go through the ‘Android Studio Setup Wizard’. This installs the latest Android SDK, Android SDK Command-line Tools, and Android SDK Build-Tools, which are required by Flutter when developing for Android.

Flutter cannot get resource X86-64-debug

I am just new to Flutter and I am trying to create the web according to my colleague's code but I engage the error below:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
Could not download x86_64_debug.jar (io.flutter:x86_64_debug:1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32)
Could not get resource 'https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32/x86_64_debug-1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32.jar'.
Could not GET 'https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32/x86_64_debug-1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32.jar'.
Connect to storage.googleapis.com:443 [storage.googleapis.com/172.217.160.80] failed: Connection timed out: connect
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 36s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
flutter version
Flutter 1.17.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f7a6a7906b (4 days ago) • 2020-05-12 18:39:00 -0700
Engine • revision 6bc433c6b6
Tools • Dart 2.8.2
enviroment variables
FLUTTER_STORAGE_BASE_URL is https://storage.flutter-io.cn,
PUB_HOSTED_URL is https://pub.flutter-io.cn
May I have your help for the issue, it looks like a connection problem but I can get the X86_Debug download in the brower while I can't determine where to place the file. Maybe the directory where the file placed could be helpful too.
Using a VPN worked for me. I am using protonVPN.

FAILURE: Build failed with an exception (Shared preference and gradle wrapper properties)

I am getting this error when i run the flutter run --release command on terminal. Kindly help me in solving this problem and let me know where i am doing wrong to make its release build successfully.
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences_macos-0.0.1+2\android\build.gradle' line: 22
* What went wrong:
A problem occurred evaluating root project 'shared_preferences_macos'.
> Failed to apply plugin [id 'com.android.library']
> Minimum supported Gradle version is 5.4.1. Current version is 4.10.2. If using the gradle wrapper, try editing the distributionUrl in C:\flutter\.pub-cache\hosted\pub.dartlang.org\s
hared_preferences_macos-0.0.1+2\android\gradle\wrapper\gradle-wrapper.properties to gradle-5.4.1-all.zip
* 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 14s
The plugin shared_preferences_macos could not be built due to the issue above.
This is my flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18362.535], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.5)
[√] Connected device (1 available)
• No issues found!
I also updated my gradle wrapper properties to this one but got the same issue
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Thanks #umair for the solution. Let me give a brief understanding of solution.
We have to update the version in gradle-wrapper.properties file of respective plugins where an error is showing.
Let's say if error is showing for "shared_preferences_macos" then we have to update version number in gradle-wrapper.properties file of "shared_preferences_macos" plugin from below path.
PATH: /Users/admin/Library/Android/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+3/android/gradle/wrapper/gradle-wrapper.properties
From the above path we have to open gradle-wrapper.properties file and have to update version to 5.4.1 from 4.10.2 in distributionUrl variable and save the file. That's it.
Note:
A path for gradle-wrapper.properties file of the respective plugin will be shown on your terminal error message
Suggested Gradle version will also be shown on your terminal error message
Repeat the same process for all the plugins where you were facing an error message.

Flutter Project is not running when using indian domain

I created a project using following command on windows environment
flutter create --org in.myorg helloworld
Project is created successfully
Flutter version is as below
Flutter 1.9.1+hotfix.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 1aedbb1835 (3 weeks ago) • 2019-10-17 08:37:27 -0700
Engine • revision b863200c37
Tools • Dart 2.5.0
When I run the code I get following error
e: D:\Project\test\helloworld\android\app\src\main\kotlin\in\myorg\helloworld\MainActivity.kt: (1, 9): Package name must be a '.'-separated identifier list
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app: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 12s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 13.5s
Gradle task assembleDebug failed with exit code 1
.in domains are not allowed in flutter? using an incorrect domain will face issue while publishing app?
Yes, because in is one of Kotlin reserved keywords: keyword-reference
You can fix it by set Java as your Android platform language and not Kotlin.
Also, I think that this word is also reserved for Swift language.
I'm not sure if you can switch it on the fly but you can recreate your project with:
flutter create -i objc -a java command