I receive errors when trying to import my Cordova based, eclipse exported "build.gradle" file, when importing into Android Studio:
"Gradle version 1.6 is required. Current version is 1.9"
However, upon changing the version using a local gradle distribution I receive the following:
"You are using an old, unsupported version of Gradle. Please use version 1.8 or greater."
Anyone have any ideas how to resolve this?
Stumbled upon the same issue, you should check this link where everything is pretty well explained:
http://rexstjohn.com/exporting-android-project-eclipse-android-studio-0-4-0/
Related
"General error during conversion: Unsupported class file major version 63"
I've tried multiple suggestions on here. None have worked. I think I need more of a step-by-step solution because I've tried installing multiple versions of Java (19,16,11), flutter clean, flutter doctor is all good, and I've installed a newer version of Android Studio (just in case). Here is what I see in VSCode:
I encountered this error while trying to run Flutter integration tests on Firebase Test Lab. I was able to solve this by updating a few things in Android Studio.
Update the Project's JDK
Open the Android Studio project settings page (File -> Project Settings) and add the newest JDK version.
Update com.android.tools.build:gradle
In android/build.gradle, update the com.android.tools.build:gradle value to the latest version found here.
dependencies {
classpath 'com.android.tools.build:gradle:7.4.1'
...
}
Update the gradle distributionUrl
In android/gradle/wrapper/gradle-wrapper.properties, update the distributionUrl property to use the latest Gradle version.
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
Other Useful Tips
You can type /usr/libexec/java_home into the terminal to see which version of Java you have installed.
You can find the current value of JAVA_HOME by running %echo $JAVA_HOME in your terminal (source).
You can update JAVA_HOME by following these steps
The problem is that somehow, either deliberately or inadvertently, you've built one or more Java files (or you're using one or more 3rd party .jars) with Java 19 ... but your "build environment" is using an older JRE. Hence the Unsupported class file error.
I, too, am using VSCode for my Flutter IDE; and I, too have Android Studio in my environment. Unfortunately, there are constantly new releases for Flutter, for VSCode, for the Android SDK, for Android Studio (with its own embedded Java/Kotlin!) and - last, but not least - for Gradle and the A/S Gradle plugin. Any one of them falling out of sync can break your entire development environment :(
I just tried to rebuild a project that compiled fine a few months ago... and (as expected) the build failed. None of the source change - but I recently upgraded A/S, and that inadvertently broke the Flutter build :(
SUGGESTION:
See if you can identify which Java class or .jar is using Java 19 ... and back it down to an older version.
In parallel, upgrade EVERYTHING in your build environment:
flutter upgrade => Flutter 3.7.3, Dart 2.19.2
VSCode update, pub upgrade => VSCode 1.751, Dart Code 3.58.0
A/S upgrade => Electric Eel 2022.1.1 Patch 1, Gradle Plugin 4.2.2
Note: Gradle Plugin 4.2.2 => Gradle version => 6.7.1, Default=Java8, AGP dependency 4.2.2
A/S Electric Eel gives you java 11... in (new!) directory "c:\Program Files\Android\Android Studio\jbr"
I have created gradle project from here and while importing Gradle(STS) from eclipse I am getting error and image of error log is
So, I am not able to import my project. any suggestion?
I know its quite a late response. But, It might help others.
Download Gradle Zip from Gradle website
Open your eclipse Preferences
Select Gradle STS -> choose your gradle directory
This solved mine.
Apologies for unable to reproduce this issue in my Eclipse or STS IDE. But, I have faced this issue in my IntelliJ IDE. The updated version of the IDE resolved this issue.
https://www.jetbrains.com/idea/download/#section=windows
Updated Android studio.
Downloaded Gradle. Changed Gradle folder in PC's environmental settings.
In computer, gradle -version returns Gradle 4.4.1.
In Android Studio, returns Gradle 3.5
Smart Android IDE refuses to recognise gradle and I can't compile.
It even gives the wrong error message
Minimum supported Gradle version is 4.1. Current version is 3.5. If using the gradle wrapper, try editing the distributionUrl in C:\xxxxxx\gradle\wrapper\gradle-wrapper.properties to gradle-4.1-all.zip
I have tried restarting, invalidate and restart. Nothing works.
How to fix it?
You need to go to
File->Settings->Build,Execution,Deployment->Gradle
Then tick User local gradle distribution and set the path to your local gradle
Fixed it by restarting the computer.
Restarting the IDE is not good enough. After restarting computer and going into Android Studio's terminal, typing in gradle -version shows the correct version. That's when I know it'd work. Sure enough, gradle commands now work.
Answered this just to show how genius the IDE written by geniuses is.
I check android studio offical web, android studio IDE now support version just to gradle-4.1.
I think you can go to gradle-wrapper.properties, and change to distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
or
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip
, maybe it can solve the problem.
Reference site:
https://developer.android.com/studio/releases/gradle-plugin.html
I faced this problem and i had fixed it. first goto https://services.gradle.org/distributions/gradle-4.10.1-all.zip and download it locally. Goto File->Settings->Build,Execution,Deployment->Gradle and select "Use local gradle" and set local gradle path that you downloaded just.
gradle path
There are several questions with solutions to this, but I'm not getting any luck with them.
I'm using IntelliJ (rather than the raw Android Studio). As far as I can tell I have the latest version of Gradle. I've never used Gradle before, so I'm not totally sure.
Error running app: This version of Android Studio is incompatible with the Gradle Plugin used. Try disabling Instant Run (or updating either the IDE or the Gradle plugin to the latest version)
It might be that Gladle is indeed out of date. How can I check and confirm or fix this?
If it's not that, what else can it be?
(I'm using the latest version of IntelliJ (2016.2.5) RUNNING ON Windows 10)
P.S. I have tried disabling Instant Run, with no effect.
You need to find out your gradle plugin version and check the compatibility with your IDE here. And here you can find which code base of Intellij Idea used in specific Android Studio version.
But I suggest that you should use Android Studio. GL
I just updated to Android Studio 2.2.1 for Mac. Then I updated the JDK to version 8. Tried to start a new project and run it. I got the following error:
Error:(1, 1) A problem occurred evaluating project ':app'.
java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
I also tried going back to JDK version 7 as it says on google site that JDK 8 is unstable for Mac. still got the same error.
Check your android build tools dependencies. In your build.gradle if its something like:
classpath "com.android.tools.build:gradle:+"
It has likely downloaded the alpha of 2.2 and that can cause the error you are seeing.
Try
classpath "com.android.tools.build:gradle:2.1.0"
If you are already using the right build tools version but keep getting this error, maybe one of the third party Android libraries you are using is causing the problem due to the same reason. You can force the dependency version to be used (including transitive) by changing
classpath "com.android.tools.build:gradle:2.1.0"
to
classpath('com.android.tools.build:gradle:2.1.0') {
force = true
}
Documentation: gist and official gradle docs.
I was also facing same problem. I upgraded Android Studio and as it forced to But we need to configure same in App Settings as well.
You can try to update JAVA_HOME to point to JDK 8 location.
In my case, I've updated Android studio project's SDK settings, changed java version in my PATH env variable, but still this error occured. Only updating JAVA_HOME helped me.
I was also facing the same problem. I upgraded Android Studio and as it forced to install JDK 8, downloaded and installed this as well. But we need to configure same in App Settings as well.
Select Project [Right click on the app module] -> Open Module Settings -> Select SDK Location from Left Menu - > Configured correct JDK Version i.e removed the old version and updated path of JDK. Save.
Sync Project.
Problem solved!
EDIT: Elaborated Project word.
If you are on Jenkins, check Java version in Jenkins->Manage Jenkins->Global Tool Configuration->JDK
I had to update mine to JDK 8.
I had same error in 2.3 beta 1 ,
Fixed as follow :
Download latest java jdk
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
In Android Studio , go to File > Project Structure > SDK Location > select JDK Location path to point to the new jdk installed (Ex: C:\Program Files\Java\jdk1.8.0_111 )
Done !
Ufff, I changed like everything I was able to find to jdk 8 and still no result but then I found Gradle settings in Intellij (preferences > gradle > GradleJVM) and it was ofc wrong, changed that and woala.
I meet the problem too, but I have changed nothing before it's happening. I think google is purposely. Google is trying to use openJDK instead of JDK because of the lawsuit between google and oracle. So, in the new version 2.2.0 of android, we found that there are some new files in the installed folder:
android studio 2.1 files
android studio 2.2 files
Then, I think we have two method to fix it:
Change the JDK environment variable of your OS.
Just click menu File --> Project Structure, choose Use embedded JDK (recommended). I chose this way and it work.
Good luck...
I had a same problem what is work for me is that .
Go
*File>Settings>(on the panel left)Build,Execution,Deployment . then click on Gradle
There is option to Update Gradle. Click on that it will time 3 to 4min and after that error gone.
The simplest way is to update Android Studio to v2.2.3, it includes a fix of JDK8:
Bug fix for a JDK8/Kotlin compiler + dx issue (issue 227729)
It's solved my problem.