Flutter Giving error in running the test app - android

It would be great if someone could help me out.
I am trying to learn it and these errors are stoping me.
Error running Gradle:
ProcessException: Process "C:\Users\HP\AndroidStudioProjects\flutternew\android\gradlew.bat" exited abnormally:
Configure project :app
Checking the license for package Android SDK Platform 27 in C:\Users\HP\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Platform 27 not accepted.
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\HP\AndroidStudioProjects\flutternew\android\build.gradle' line: 24
What went wrong:
A problem occurred evaluating root project 'android'.
A problem occurred configuring project ':app'.
Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-27 Android SDK Platform 27
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\HP\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 7m 38s
Command: C:\Users\HP\AndroidStudioProjects\flutternew\android\gradlew.bat app:properties
Finished with error: Please review your Gradle project setup in the android/ folder.

As you can see in the logs, this is the cause - Warning: License for package Android SDK Platform 27 not accepted.
You can run flutter doctor from a terminal, and it ask you to run flutter doctor --android-licenses in order to accept them. Fix any other issues it may indicate. After that, you should be good to go.

Related

Flutter how to build APK

I'm created an empty flutter project. Flutter installed success. And I'm created an empty project, but I can't build an APK and start my application on Android device when I connect my phone through USB.
And after building apk I'm getting an error:
Building with sound null safety
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not download gradle-4.1.0.jar (com.android.tools.build:gradle:4.1.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.jar'.
> Premature end of Content-Length delimited message body (expected: 6�041�440; received: 4�456�416)
> Could not download builder-4.1.0.jar (com.android.tools.build:builder:4.1.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/4.1.0/builder-4.1.0.jar'.
> Premature end of Content-Length delimited message body (expected: 9�546�513; received: 6�553�552)
> Could not download bundletool-0.14.0.jar (com.android.tools.build:bundletool:0.14.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/0.14.0/bundletool-0.14.0.jar'.
> Premature end of Content-Length delimited message body (expected: 7�826�780; received: 4�456�416)
* 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 1h 23m 34s
Running Gradle task 'assembleRelease'... 5015,6s
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Checking the license for package Android SDK Build-Tools 29.0.2 in C:\Users\User\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Build-Tools 29.0.2 not accepted.
Checking the license for package Android SDK Platform 30 in C:\Users\User\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Platform 30 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:lintVitalRelease'.
> Could not resolve all dependencies for configuration ':app:lintClassPath'.
> Could not create task ':app:minifyReleaseWithR8'.
> 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\User\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 6m 19s
Running Gradle task 'assembleRelease'... 380,2s
Gradle task assembleRelease failed with exit code 1
I'm creating an Android application at first. And I'm haven't an experience.
What's wrong?
Thanks a lot.
I'm fixed an error adding jcenter() to build.gradle. But now I'm getting an error:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.
> 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\User\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 9s
You can build the apk throw the command line with:
flutter build apk --release
or directly with Android Studio
if it is the first launch... Make sure you are connected to internet! Some dependencies should be installed and cached
If the error persists... Try to run flutter pub clean and then flutter pub get
I can see you are having some problems with license agreements.
You should try to open the terminal and type:
flutter doctor --android-licenses
Then you should press y to accept every license, after completing the process try building the project again.
According to the error, what happens is that you do not have some components installed, you can open the android studio, settings, sdk and look for the buildtools and plattforms versions after installing them because your problem will be solved, in the same way to create the applications I like to do it with the following command that gives you the releases by architectures
flutter build apk --split-per-abi

Flutter app build failed License for package Android SDK Build-Tools 29.0.2 not accepted

Checking the license for package Android SDK Build-Tools 29.0.2 in /home/maruf/Android/Sdk/licenses
Warning: License for package Android SDK Build-Tools 29.0.2 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;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: /home/maruf/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 2s
Exception: Gradle task assembleDebug failed with exit code 1
Can you try to accept licenses with flutter doctor?
Open your terminal
Type flutter doctor --android-licenses
Accept licenses by typing y and ENTER

ionic cordova build android - build failed with an exception

I'm a beginner and in trouble with Ionic. I want to make an android app using Cordova for my homework. I tried to switch to Android Studio, uninstall-reinstall the Gradle, run the command with the --verbose flag and nothing works. When I type "ionic cordova build android" I got 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 Android SDK packages as some licences have not been accepted.
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\Hp\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
**BU¦LD FAILED in 1s**
Command failed with exit code 1: C:\Users\Hp\hava\platforms\android\gradlew cdvBuildDebug -b C:\Users\Hp\hava\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Have you installed SDKs and AVDs?
This link has an excellent walk thru
Could be u are using wrong java version.....maybe you didn't set up ENV path.....possibly (most likely based on error) you have not download API levels and accepted the licensing agreement which then also means you haven't install an AVD.
That guide should set you straight.

Showing "Finished with error: Gradle task assembleDebug failed with exit code 1". Was running Flutter in Android Studio.What should I do?

This was shown in the console
dyld: Library not loaded: #rpath/libswiftCore.dylib
Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
Reason: image not found
git: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly!
git: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch
Launching lib/main.dart on vivo 1951 in debug mode...
Running Gradle task 'assembleDebug'...
Checking the license for package Android SDK Build-Tools 28.0.3 in /Users/macbook/Library/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 /Users/macbook/Library/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: /Users/macbook/Library/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 2s
Finished with error: Gradle task assembleDebug failed with exit code 1
Someone please help me.
Run flutter doctor --android-licenses in console and accept android licenses
then run flutter doctor to ensure everything is ok

Command failed with exit code 1 Error output: FAILURE: Build failed with an exception

I'm trying to run the command ionic build android --release to build the apk but i am getting this error
BUILD FAILED
Total time: 2.623 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 25]. 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.
enter image description here
Use the SDK manager to install SDK Platform 25 manually. This should ask you to accept the license which should fix this error.

Categories

Resources