I am using android studio to run flutter project, now i can not run any project and i get the same error every time:
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-29 Android SDK Platform 29
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\moham\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 29s
Exception: Gradle task assembleDebug failed with exit code 1
it seem you did not accepted all licences after install.
Try to run this:
flutter doctor --android-licenses
and then press y every time it ask, to accept the licence
seems like duplicate of this
you should delete config Android studio folder and reinstall that whit all requirements.
C:\Users[your name folder]
Related
I had to reinstall my windows and so I had to freshly install Android studio, flutter sdk and everything.
After completing all my installations I am unable to run my project. Before upgrading the system my project was working all fine with 0 errors.
Flutter doctor:
C:\Users\Admin>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.17.5, on Microsoft Windows [Version 10.0.18362.959], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[√] Android Studio (version 4.0)
[√] Connected device (1 available)
• No issues found!
Error:
Launching lib\main.dart on Mobile in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':agora_rtc_engine:extractDebugAnnotations'.
> Could not resolve all files for configuration ':agora_rtc_engine:lintClassPath'.
> Could not download kotlin-compiler.jar (com.android.tools.external.com-intellij:kotlin-compiler:26.6.3)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/26.6.3/kotlin-compiler-26.6.3.jar'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/26.6.3/kotlin-compiler-26.6.3.jar'.
> dl.google.com
> Could not download uast.jar (com.android.tools.external.org-jetbrains:uast:26.6.3)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/external/org-jetbrains/uast/26.6.3/uast-26.6.3.jar'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/external/org-jetbrains/uast/26.6.3/uast-26.6.3.jar'.
> dl.google.com
> Could not download groovy-all.jar (org.codehaus.groovy:groovy-all:2.4.15)
> Could not get resource 'https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.4.15/groovy-all-2.4.15.jar'.
> Could not GET 'https://jcenter.bintray.com/org/codehaus/groovy/groovy-all/2.4.15/groovy-all-2.4.15.jar'.
> jcenter.bintray.com
* 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 46s
Exception: Gradle task assembleDebug failed with exit code 1
This is the first time I am moving my project from my original system to this new one.
I don't have enough reputation to comment so I will write it as an answer. Since it is the first time running the app, make sure you have an internet connection so it can download the required files.
Solution:
As of now what I have done is the following:
agora_rtc_engine that was showing up as error I have removed it. (I will be re-adding this package as this is required for my app)
java jdk download i have added I was getting error on keytool to generate SHA1 Key Fingerprint.
I updated my SHA1 Key Fingerprint in Firebase. I have to do this as I was getting error when login in using Google sign-in.
Now my App is working fine with no errors.
This might not be the correct solution for the issue, so feel free to give your suggestion on the above error that I had faced.
I just installed android studio and flutter on my laptop, and i was running the default code to test my settings, but this error(exception) came up. I am very new to this, can someone help me with this error please -
Launching lib\main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
Checking the license for package Android SDK Build-Tools 28.0.3 in C:\Users\Shreyansh\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 28 in C:\Users\Shreyansh\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Platform 28 not accepted.
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: C:\Users\Shreyansh\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 19s
Exception: Gradle task assembleDebug failed with exit code 1
Open your Android Studio
Open the "Tools" menu
Select "SDK Manager"
In the following screen, make sure API Level 28 says "Installed".
If it doesn't, install it. You will have to agree to the license agreement.
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: C:\Users\emre\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 11s
FAILURE: Build failed with an exception.
What went wrong:
Could not update C:\Users\emre.gradle\caches\5.6.2\file-changes\last-build.bin
C:\Users\emre.gradle\caches\5.6.2\file-changes\last-build.bin (Access is denied)
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 11s
Exception: Gradle task assembleDebug failed with exit code 1
Apparently you should accept the license,so in your command promp:
cd /d "%ANDROID_SDK_ROOT%/tools/bin"
and then
sdkmanager --licenses
just accept the license and the error should goes away.
Here is the main problem
Failed to install the following Android SDK packages as some licenses have not been accepted. build-tools;28.0.3 Android SDK Build-Tools 28.0.3 platforms;android-28 Android SDK Platform 28
As the error suggests, first accept all licenses by running the following command
flutter doctor --android-licenses
next head over to https://androidsdkmanager.azurewebsites.net/Buildtools and download the build tool that corresponds to the one you are missing in this case 28.0.3 After downloading extract the zip file into C:\Android\Sdk\build-tools\28.0.3 if you are on windows and /Library/Android/sdk/build-tools/28.0.3 if you are on mac
finally, download the missing Android SDK platform 28 from https://androidsdkmanager.azurewebsites.net/SDKPlatform and unzip it into /Library/Android/sdk/platforms/android-28 if you are on mac or C:\Android\Sdk\platforms\android-28 if you are on windows
Run your project (flutter run) and enjoy
Try running flutter doctor on cmd. If it shows:
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.19042.685], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 4.1.0)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.52.0)
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (0 available)
Then run flutter doctor --android-licenses,
and accept all the license agreement. The problem must be solved then.
go setting
android SDK
SDK Tools
and then
click show package details
and Android SDK Build-Tools
Download 28.0.3
Apply and ok :)
In my own case, Deleting .gradle folder solved the problem. Just head-on into your usual project dir and navigate into android and you'd find .gradle folder waving a hand in there. I hope this helps somebody out there. But make sure you have done
flutter doctor --andriod-licences
Don't do anything, like changing the SDK path or updating tools.
At first, what you should try to do is this:
Remove your physical device from your machine which is connected via USB and instead of the physical device, run your application on a browser (I suggest Chrome) and if there is no other issue then you will find the error will have been tackled. So I am saying that the problem is neither in the path nor in the software or code. Please try this suggestion first, because I wasted a full day trying to tackle this problem!
We just need to install proper Android version manually
Go To SDK Manager
Android SDK
Uncheck Installed Version
Manually Install Android version which it tried and throwing error for(see in error message)
Apply and OK
Restart
It worked for me.
smackuser#smackcoders:~/Documents/projects/Awesome$ react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> failed to find Build Tools revision 23.0.1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.562 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
Go to Android SDK Manager and under tools install Android SDK Build-tools 23.0.1.
You can access SDK Manager by either typing android in your terminal or going to your android-sdk/tools directory and from there typing ./android
BUILD FAILED
Total time: 7.548 secs
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'. >
You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 24].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
also updated sdk for the same error , but still facing the same
I have Removed android platform ($ ionic platform remove android ) and re-installed it ($ ionic platform add android ) .
after then problem was no more. got my build successfully.
Thanks for your responses all of you.