FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\romit\Desktop\FlutterSoft\projects\basic_app\android\build.gradle' line: 26
What went wrong:
A problem occurred evaluating root project 'android'.
A problem occurred configuring project ':app'.
Could not open proj generic class cache for build file 'C:\Users\romit\Desktop\FlutterSoft\projects\basic_app\android\app\build.gradle' (C:\Users\romit.gradle\caches\6.7.1\scripts\4hhqko2lgng4etjv4i11vmj58).
> BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 60
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 1s
Exception: Gradle task assembleDebug failed with exit code 1
NOTE: I have already updated the gradle. Also tried solving it by using gradlew clean and gradlew build.
DOES ANYONE HAVE SOLUTION FOR THIS?
///build.gradle snippets
Code LINE -1-27
Remaining Lines
Major Version 60 is for Java 16 - see https://en.wikipedia.org/wiki/Java_class_file#General_layout.
As far as I know Android does not support this java version at all. Also it seems Android Studio does only support Java 7 (full) and Java 8 (partial) - see https://developer.android.com/studio/write/java8-support.
Android Gradle plugin 3.0.0 and later support all Java 7 language
features and a subset of Java 8 language features that vary by
platform version. When building your app using Android Gradle plugin
4.0.0 and higher, you can use a number of Java 8 language APIs without requiring a minimum API level for your app.
I am using Eclipse most time, but I think the settings can be done as described at
https://developer.android.com/studio/intro/studio-config#jdk
Related
Launching lib\main.dart on M2006C3MII in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\Rana\Desktop\Flutter Projects\new_soft\android\build.gradle' line: 26
What went wrong:
A problem occurred evaluating root project 'android'.
A problem occurred configuring project ':app'.
Could not open proj generic class cache for build file 'C:\Users\Rana\Desktop\Flutter Projects\new_soft\android\app\build.gradle' (C:\Users\Rana.gradle\caches\7.5\scripts\52edrvulxtnk4ivgfae602cyx).
> BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 63
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 3s
Exception: Gradle task assembleDebug failed with exit code 1
Post your project build gradle codes in question
This error message is indicating that there is a compatibility issue between the version of the Java compiler being used to build the project and the version of the compiled class files. The error message specifically mentions that the "major version 63" of the class file is not supported by the compiler.
The major version numbers of Java class files follow a release-versioning scheme. In this case, "63" likely corresponds to Java SE 11 (18.9), while the compiler being used may not support that version.
To resolve this issue, you may need to update the compiler to a version that supports the class file major version, or alternatively, you can try to recompile the class files with a compatible version of the Java compiler.
This answer can help you open it
I am developing a bluetooth app using flutter in android studio. I am getting the following error:
The plugin flutter_blue uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.
Launching lib\main.dart on SM G885F in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Apps\Bluetooth\android\app\build.gradle' line: 51
What went wrong:
Could not compile build file 'C:\Apps\Bluetooth\android\app\build.gradle'.
startup failed:
build file 'C:\Apps\Bluetooth\android\app\build.gradle': 51: Statement labels may not be used in build scripts.
In case you tried to configure a property named 'minSdkVersion', replace ':' with '=' or ' ', otherwise it will not have the desired effect.
# line 51, column 24.
minSdkVersion: 19
^
1 error
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 1s
Exception: Gradle task assembleDebug failed with exit code 1
in my case, i solved it by changing the minSDK 19 to 29, just update the number from 19 to 29 and try build your app.
Today I was installing the software of cordova for implement the code html in an app. First you have to create a project and a browser.I want to use this also for android so you have to add android to a platform. In the moment i want to compile this platform i have an error that stop all the compile and i dont know what to do to solve this error.
I´m adding the code error.
* Where:
Script 'C:\Users\leti\Aplicaciones\PrimeraApp\platforms\android\CordovaLib\cordova.gradle' line: 75
* What went wrong:
A problem occurred evaluating script.
> No usable Android build tools found. Highest 30.x installed version is 30.0.2; minimum version required is 30.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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 5s
Command failed with exit code 1: C:\Users\leti\Aplicaciones\PrimeraApp\platforms\android\gradlew cdvBuildDebug -b C:\Users\leti\Aplicaciones\PrimeraApp\platforms\android\build.gradle
It says it in your error message
> No usable Android build tools found. Highest 30.x installed version is 30.0.2; minimum version required is 30.0.3.
Update your build tools to 30.0.3
I am trying to build my android app and am getting an error about the version of Gradle that is being used. When I make the change that is suggested and run the command again the change gets changed back causing it to fail again.
I have tried replacing all references to gradle-4.1-all.zip with gradle-4.10.1-all.zip and for some reason it keeps getting changed back at this location /gradle/wrapper/gradle-wrapper.properties to gradle-4.10.1-all.zip
Android Studio project detected
ANDROID_HOME=/Users/user.account/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home
studio
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
Where:
Build file '/Users/user.account/cordovaProjects/hybrid-base/platforms/android/CordovaLib/build.gradle' line: 41
What went wrong:
A problem occurred evaluating project ':CordovaLib'.
Failed to apply plugin [id 'com.android.library']
Minimum supported Gradle version is 4.10.1. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in /Users/user.account/cordovaProjects/hybrid-base/gradle/wrapper/gradle-wrapper.properties to gradle-4.10.1-all.zip
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 0s
/Users/user.account/cordovaProjects/hybrid-base/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
Where:
Build file '/Users/user.account/cordovaProjects/hybrid-base/platforms/android/CordovaLib/build.gradle' line: 41
What went wrong:
A problem occurred evaluating project ':CordovaLib'.
Failed to apply plugin [id 'com.android.library']
Minimum supported Gradle version is 4.10.1. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in /Users/user.account/cordovaProjects/hybrid-base/gradle/wrapper/gradle-wrapper.properties to gradle-4.10.1-all.zip
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 0s
I am able to get a build to work if I do a cordova platform remove android and then immediately cordova platform add android but as soon as I try to build a second time it fails
If for any reason you need a different version of gradle there is no need to edit any file, just set the CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL env var with value the url where to fin the gradle zip, for example
http://services.gradle.org/distributions/gradle-4.1-all.zip
I do not have any problem with version 4.1 ( win10, android platform 7.1.4 ).
After you set your desired gradle version, reset your project ( remove all plugin and all platforms and manual edits then reinstall ) and then try to build.
If the problem persist, to help you better, post the error and please specify which OS, cordova version and android platform version you are using.
As a rule of thumb, from my experience with cordova, when you think that the only way to set a certain configuration is to edit platform files, there is probably a proper way to do so ( for example to automatically sign the apk when build )
I'm trying out ionic for the first time. I have no issues with iOS, but building the demo app for Android gives me an error with virtually no information (see below). It seems likely to me that the issue is with the gradle config file that ships with Cordova, but I don't believe it's considered good practice with Cordova to edit the platform-specific files if you can avoid it.
[myApp]Bro? ionic build android
Running command: /Users/x/Documents/Dev/myApp/hooks/after_prepare/010_add_platform_class.js /Users/x/Documents/Dev/myApp
add to body class: platform-android
Running command: /Users/x/Documents/Dev/myApp/platforms/android/cordova/build
ANDROID_HOME=/Users/x/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
Running: /Users/x/Documents/Dev/myApp/platforms/android/gradlew cdvBuildDebug -b /Users/x/Documents/Dev/myApp/platforms/android/build.gradle -Dorg.gradle.daemon=true
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> A problem occurred configuring project ':CordovaLib'.
> Failed to notify project evaluation listener.
> java.lang.ExceptionInInitializerError (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Looked at the stacktrace and it was clear that I had an issue with my Java XPath and XQuery libraries (Saxon). Turns out I hadn't updated that library since migrating from JDK 7 to JDK 8, and JDK 8 is not compatible with the version I had installed. Looks like the Android build uses the same plugin to parse the AndroidManifest.xml.
Short answer - look at your stack trace. Perhaps it also has to do with an outdated Java library.