Issue after Android studio update - android-studio

I just tried to update Android studio from 1.4 to 2.2 preview 2. After updating Android Studio, when I tried to open it, it showed me this error:
Error:(1, 1) A problem occurred evaluating project ':app'.
java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
Can any one help me to resolve this?

I spent quite a lot of time with this one in Android Studio too.
It seems this problem is caused by the difference in java version used for compiling the project.
Finally, inside the "Project Structure" settings window, I enabled the "Use embedded JDK (recommended)" in the SDK location tab.
And happy compiling :)

Your runtime environment is running a different version of Java than your compiler - 52.0 represents Java SE 8
On Linux, type:
sudo update-alternatives --config java
Output will be like:
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-7-oracle/jre/bin/java 2 auto mode
1 /usr/lib/jvm/java-7-oracle/jre/bin/java 2 manual mode
* 2 /usr/lib/jvm/java-8-oracle/jre/bin/java 1 manual mode
Press <enter> to keep the current choice[*], or type selection number:
Select 2
Then compile your project:
./gradlew assembleDebug
This fixed it for me:)
On Windows, you can do it via the Java Control Panel very easily - read more about it here!

Related

Android Studio 4.1 Canary 9 201.6466190-linux distribution corrupted?

At first I've tried to update Android Studio 4.1 Canary 8 to Canary 9 as usual through update dialog. At the first start Canary 9 have thrown error:
Missing essential plugin:
org.jetbrains.android
Please reinstall Android Studio from scratch.
So I downloaded Canary 9 distribution from official source (https://developer.android.com/studio/preview). Deleted Canary 8 catalog and extracted tar.gz with Canary 9. Then launched android-studio/bin/studio.sh with the same error.
I renamed ~/.AndroidStudioPreview4.1 catalog and started studio once more. Same error.
Now I rolled back to Canary 8 from my backup.
Any help how to move from Canary 8 to 9?
Basically this issue mentioned in release notes
In Android Studio 4.1 Canary 9, you may see the following error when
first launching Android Studio after upgrading:
missing essential plugin org.jetbrains.android
This can happen when you import your settings from a previous version
of Android Studio. Typically, this means you have a locally installed
Kotlin plugin that is not compatible with the new IDE.
To fix this issue, remove the Kotlin directory from the following
locations:
Linux: ~/.local/share/Google/AndroidStudioPreview4.1
Windows:
C:\Users\YourUserName\AppData\Roaming\Google\AndroidStudioPreview4.1
MacOS: ~/Library/Application Support/Google/AndroidStudioPreview4.1
Because there is no Kotlin plugin compatible with Canary 9 currently
available from JetBrains, we have bundled our own Kotlin plugin with
the Canary 9 update, so you don't need to manually install a Kotlin
plugin.
source
At the same time by path ~/.local/share/Google/AndroidStudioPreview4.1 no such file or directory. The only catalog named AndroidStudioPreview4.1 founded by ./.cache/Google/AndroidStudioPreview4.1. So I deleted it without any effect on subject issue.
Then I completely removed ~/.AndroidStudioPreview4.1 instead of renaming which I'd done before. And resolved the issue.
I believe Google bundle Kotlin plugin in a different way JetBrains do. So paths differ. Maybe path for Windows to. I believe paths should be corrected in release notes.
Solution:
rm -r ~/.AndroidStudioPreview4.1
Solved this problem by using terminal in Ubuntu 18.04.5 LTS
toumbou#toumbou-Aspire-V3-471:~$ cd ~/.AndroidStudio4.0/config
toumbou#toumbou-Aspire-V3-471:~/.AndroidStudio4.0/config$ ls
codestyles disabled_plugins.txt inspection plugins tasks user.token
colors disabled_update.txt options port.lock terminal workspace
toumbou#toumbou-Aspire-V3-471:~/.AndroidStudio4.0/config$
and open the file via nautilus
toumbou#toumbou-Aspire-V3-471:~/.AndroidStudio4.0$ nautilus config
Then move the config folder and remove also the kotlinRefractoring.xml and also I removed the caches of my previous project so now I got it running fine again with some tweaks all things ares fine.

Error running forked groovyc caused in Netbeans

I installed Netbeans 11.3 under Ubuntu 18.04 and created in the following a new Groovy project.
Choose File > New Project (Ctrl-Shift-N;\u2318-Shift-N on Mac) from the main menu to open the New Project wizard.
Select Java Application in the Java category. Click Next.
Type GroovyJavaDemo as the Project Name and specify the folder where you want to create the application in the Project Location field.
Deselect the Create Main Class checkbox. Click Finish.
Next, I created a Groovy Script file with only this content println "Hello" and it caused the following problems:
ant -f /home/ubuntu/NetBeansProjects/GroovyJavaDemo -Djavac.includes=Hello.groovy -Drun.class=Hello run-single
init:
deps-jar:
Created dir: /home/ubuntu/NetBeansProjects/GroovyJavaDemo/build
Updating property file: /home/ubuntu/NetBeansProjects/GroovyJavaDemo/build/built-jar.properties
Created dir: /home/ubuntu/NetBeansProjects/GroovyJavaDemo/build/classes
Created dir: /home/ubuntu/NetBeansProjects/GroovyJavaDemo/build/empty
Compiling 1 source file to /home/ubuntu/NetBeansProjects/GroovyJavaDemo/build/classes
/home/ubuntu/NetBeansProjects/GroovyJavaDemo/nbproject/build-impl.xml:1120: The following error occurred while executing this line:
/home/ubuntu/NetBeansProjects/GroovyJavaDemo/nbproject/groovy-build.xml:26: Error running forked groovyc.
BUILD FAILED (total time: 1 second)
What did I miss?
Thank you in advance,
I don't think you missed anything, since I can reproduce your problem with JDK 11 on NetBeans 11.3.
However, there is a (somewhat unsatisfactory) workaround that worked for me:
Install JDK 8 (if necessary).
Edit the NetBeans file etc/netbeans.conf and set the JDK that NetBeans uses to JDK 8. In my case I added the line netbeans_jdkhome="C:\Java\jdk1.8.0_221" to netbeans.conf.
Restart NetBeans then rebuild your project. It should compile now:
Notes:
You could bug report this issue to the NetBeans team if you wish.
I also tried using JDK 14 as the default Java platform for NetBeans and got a different error: NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7. See the Gradle bug JDK 14 support #10248 for more information on that.
Setting JDK 8 as the default platform for NetBeans doesn't prevent you from adding other Java platforms (Tools > Java Platforms > Add Platform...) such as JDK 11 and JDK 14 for your individual projects.
Edit the groovy-build.xml and replace <groovyc javahome="${platform.home}" with <groovyc javahome="${jdk.home}" it works for me on JDK 1.8
Please find here the solution for Open-JDK-13

Gradle sync failed: Could not run JVM from the selected JDK

I have a problem with the Android Studio, at the top there is a bar that says Gradle sync failed, and in the notes from the bottom there is this comment: Gradle sync failed: Could not run JVM from the selected JDK. ,, and the version of Android is 3.2, and my computer is 32 bit, I updated the gradle as I watched the video from Google, but so far I have not found a solution to the problem, please help, thanks.
In my case, the following solved it:
File->Other settings->Default Project Structure
Tick Mark the Use Embedded JDK (recommended)
Then Hit Apply .

Android Studio can't open project

I've recently get update notification of android studio 2.3, after the update it's not opening any project and throwing error:
[plugin: com.darkklord.gradle.metric.core]
after downgrading and reinstalling i still have this issue, can anyone please help me on this topic ?
Download latest plugin from here: https://plugins.jetbrains.com/plugin/9197-android-gradle-metrics--checkstyle
Install Plugin manually from disk.
Restart Android Studio (The error will still occur)
Remove plugin in IDE.
Restart
You might also uninstall the refrenzed plugins Checkstyle and PMD
You need to change your dependency
classpath 'com.android.tools.build:gradle:3.1.0'
Sometimes you need to change name of project manually(look at AndroidStudioProjects folder) that you opened lastly.
After changing name, android studio will show all projects,
open one of them,
in file menu,
click open button,
then open your desire project (or change its name to its previous name)
change build:gradle plugin to:
classpath 'com.android.tools.build:gradle:3.3.2'
(in app gradle file)
I made sure that my Gradle version was compatible with my android gradle plug in. In my case I was using Gradle 6.0.1 and when I changed my android gradle plug in to version 3.5.3 the problem went away.
Project Structure----->> Project ------>> Android Gradle plug in version 3.5.3.
[https://docs.gradle.org/6.0.1/release-notes.html
[Java 14 and later versions are not yet supported.
Compatibility Notes
A Java version between 8 and 13 is required to execute Gradle.
Java 6 and 7 can still be used for compilation and forked test execution. Just like Gradle 5.x, any supported version of Java can be used for compile or test.
This version of Gradle is tested with
-------->>>>>>>>Android Gradle Plugin 3.4, 3.5 and 3.6
Kotlin 1.3.21 through 1.3.50
Other versions may or may not work.]]]]
I hope this helps

Error:Unable to start the daemon process:

Error:Unable to start the daemon process: could not reserve enough
space for object heap.
Please assign more memory to Gradle in the project's gradle.properties file.
For example, the following line, in the gradle.properties file, sets the maximum Java heap size to 1,024 MB:
org.gradle.jvmargs=-Xmx1024m</em>
Read Gradle's configuration guide
Read about Java's heap siz
Try this one.
Add this line at the end of your application gradle.properties
org.gradle.jvmargs=-Xmx512m -XX\:MaxPermSize\=512m
I had multiple JDK installed in my system. JDK 1.7 and JDK 1.8.
And Android Studio was using JDK 1.7. Changing to 1.8 Solved the Issue for me.
Steps I did:
Step 1 : Start Android studio and close any open project (File > Close Project).
Step 2 : On Welcome window, Go to Configure > Settings.
Step 3 : Go to Build, Execution, Deployment > Compiler > Java Compiler
Step 4 : Change the Project bytecode version to the highest (currently 1.8).
Step 5 : Close and Restart Android Studio.
Close Android Studio, go to its install directory, usually "C:\Program Files\Android\Android Studio\bin," open "studio.exe.vmoptions" with Notepad and change the following lines:
-Xms256m
-Xmx750m
to:
-Xms512m
-Xmx1024m
restart computer.

Resources