how to accepts certificates in android studio - flutter

Hi all my name is Vijay Rathwa and I am totally new in flutter and for programing and for coding language. please help me I am stuck in flutter. the error is below. please guide me step by step to solve the problem. Thank you
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-30 Android SDK Platform 30
build-tools;29.0.2 Android SDK Build-Tools 29.0.2
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: C:\Users\Wins\AppData\Local\Android\sdk
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 19s
Exception: Gradle task assembleDebug failed with exit code 1

in flutter you should accept android sdk with this command
flutter doctor --android-licenses
before that you should specify sdk on operation system environment

Kindly check to ensure if the Android SDK Platform-Tools and Android SDK Build Tools are installed on your computer using Android Studio.
I faced the same issue some time ago, installing these tools using Android Studio helped me resolve the issue.

Related

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' in android studio

I get these errors When I run flutter application using android studio.How can I solve this problem
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
patcher;v4 SDK Patch Applier v4
emulator Android Emulator
platforms;android-31 Android SDK Platform 31
build-tools;30.0.3 Android SDK Build-Tools 30.0.3
tools Android SDK Tools
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: /usr/lib/android-sdk
* 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 27s
Exception: Gradle task assembleDebug failed with exit code 1
enter image description here
This error is due to you not accepting the required licences to run a project in an emulator I think so head over to your Tools menu at the top of Android studio->SDK Manager-> Mark the checkbox written Android SDK BuildsTools under the SDK Toold Tab let it download and you'll be prompted to accept the licencing. Thank you

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.

FLUTTER : Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'

Im new flutter developer, Im created my first flutter project but when I click "RUN" it shows the error below. Please help
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Failed to find Build Tools revision 29.0.2
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 26s
Exception: Gradle task assembleDebug failed with exit code 1
I fixed this error by deleting the folder ".gradle" in "C:\Users", user = your username, even though it may look like a big folder simply delete it and run your app and the BuildTools Sdk 29.0.2 will install automatically. This is a common error for beginners to Flutter.
Simply close your emulator and download the Build tools revision of the said version from Android studio.
From your Android Studio >Tools> SDK Manager> Android SDK> SDK Tools> and check the thick box Show Package Details.
In your case its 29.0.2 just follow the guide below.
After that run again the emulator using flutter.

I am using VS Code for Flutter. I have downloaded Android SDK platform 30. But it tells me to download 29 version

I am new to flutter. Here is a list of available tools on SDK Manager -
As you can see I've downloaded the tools. But debugging in the ide shows an error and tells me download a tools that are not installed -
'''
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:
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-29 Android SDK Platform 29
Install the missing components using the SDK manager in Android Studio.
2
* 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 51s
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
'''
Please help me out.
There seemed to be errors in installing certain dependencies ( sdk 30 ). Might be a technical glitch. Try installing again using flutter doctor.
I think you have to accept the licenses before building.
Try this command in the terminal
flutter doctor --android-licenses
Try flutter doctor command in your terminal. which helps us diagnose issues with your setup
flutter doctor
to learn more https://stackoverflow.com/a/55641042/7904389
Please share the android/app/build.gradle, it is probably targeting API level 29 (targetSdkVersion 29 and compileSdkVersion 29). Change them to 30 or download the API level 29 SDKs.
If it still doesn't work after that, the SDK might be missing, go to the ANDROID_HOME directory and ensure it contains an sdk directory with the stuff you want.
I couldn't figure out what the error was, but creating a new project worked for me.

flutter project cant run in visual studio

FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-28 Android SDK Platform 28
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: /usr/lib/android-sdk
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 4s
Exception: Gradle task assembleDebug failed with exit code 1
You have to accept licences before building app in visual studio.
This is only one time configuration to be done. Have you done it?
If not then run following command:
In Windows
%ANDROID_HOME%/tools/bin/sdkmanager --licenses
In Linux
yes | ~/Android/Sdk/tools/bin/sdkmanager --licenses
In macOS
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home
yes | ~/Library/Android/sdk/tools/bin/sdkmanager --licenses
If still problem persist then let me know.