Android Studio 2 error - android-studio

I have the latest Java version installed as you can see, but it still tells me the message. Moreover, I can not load any projects because it gets stuck in the gradle building process. Any idea?

It is working fine after reinstalling the JDK(500mb) pack, rather than the update (66mb).

Related

Newest Android Studio 2021.3.1.17 release gets stuck on launch screen

I've installed the newest version of Android Studio with the installer on my Windows 10, currently it's version 2021.3.1.17 Dolphin.
Upon launching it, the splash screen appears and the little bar loads to the end and then it gets stuck indefinitely on that screen. All I'm seeing is this:
I've tried the following stuff already:
Completely uninstalling Android Studio, making sure all the files have been removed correctly before re-installing it (except the JetBrains folder, since I have other JetBrains stuff in it)
Re-Downloading the installer from the official Android Studio Website to make sure it was not corrupted.
Run as Administrator.
Was previously installed on a non-primary drive D:/, and I've also tried installing it on my primary drive C:/ just in case, same issue with C:/ installation too.
Ran studio.bat to see any errors, however, I'm assuming that bat file itself is buggy. It tells me that it does not find any JRE or JDK installation within the path. So to fix it I've set the newest Oracle JDK19 as my JAVA_HOME and the /bin accordingly, however, the studio.bat will then continue a long java error which seems honestly unfixable, so I won't even bother posting it here. Me setting the path shouldn't even be necessary, as Android Studio comes bundled with a JDK... and it should be using that one anyway.
So I'm out of things to try. I cannot make it work. My only lead was the Java error, but according to some Google search, I shouldn't even have to deal with it as it comes bundled with Android Studio. Looking into the files, there is indeed a jre folder within the Android Studio installation. Is it not using that one? What could be the reason that it is not using it if that is the case?
So, I was able to fix it myself after trying a few hours more. I've had also other Java installations (Java JDK 8, JDK 19) that interfered somehow with Android Studio. I've uninstalled everything related to Android Studio and I've uninstalled every Java version I had.
Additionally, I've removed every reference to Java or Android Studio from all of my system and environment variables. Also removed a path to Android SDK that was within my system variables.
After rebooting and installing Android Studio, it worked. Haven't installed any Java version so far, so not sure if the issues will return if I install my Java versions again.

The specified Gradle distribution 'https://services.gradle.org/distributions/gradle-7.2-bin.zip' does not exist

In Android Studio, I am getting the following error when trying to run my app on an Android device:
The specified Gradle distribution 'https://services.gradle.org/distributions/gradle-7.2-bin.zip' does not exist.
All my Android Studio projects are affected by this and restoring them to older commits does not change anything.
The problems all started by following the advice given here: Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-2.1-all.zip'
I deleted everything in my /.gradle/wrapper/dists/ folder. Now, I get the above error and I do not see how to solve it.
Here is how to reproduce it with Android Studio 2021.1.1 on Windows (but be warned: this might corrupt your projects, too):
Delete everything in /.gradle/wrapper/dists/
Create a new project "Test" in Android Studio (this might take a while, since gradle-7.2-bin.zip will be downloaded in the dists folder)
The project builds and runs without errors
Close Android Studio
Delete everything in /.gradle/wrapper/dists/ again
Open project "Test" in Android Studio
Try to run
Now you should get the above mentioned error.
At this point, /.gradle/wrapper/dists/ is still empty. Now you can do the following:
run gradlew tasks in Terminal in the Project Folder of "Test" (this will take a while, since gradle-7.2-bin.zip will be downloaded in the dists folder again)
run gradlew build (everything should build without errors)
But clicking on "Run" still yields the same error.
I am getting the impression that this is an AndroidStudio / IntelliJ bug.
Can anyone help me with this?
Running Android Studio as Administrator solved the problem for me
It turned out my Android Studio installation was heavily corrupted. Simply, uninstalling it and installing it again also did not help.
I basically had to do everything that was suggested here: How to completely uninstall Android Studio from windows(v10)? and delete everything related to Android Studio. I installed it again and now everything is fine again.
I do not know what the problem was. Maybe the .m2 folder, maybe the Jetbrains folder.
My advice to everyone facing the same issue:
First try around deleting caching folders. If nothing helps, go for the brute force approach and follow the answers (not only the accepted answer) of the above mentioned StackOverflow question.

Android Studio ArticFox compiling fine but showing red errors everywhere

I have a multi module Android Compose project. One module is an android app, others are android libraries or kotlin libraries. I'm running AS Artic Fox 2020.3.1 Beta 5 on MacOS 11.4 Big Sur.
After a library upgrade (probably AGP to use compose, I don't remember when exactly) Android Studio started to show syntax errors everywhere, both in .kts and .kt files.
Compilation and execution are working fine, only those weird JDK errors are displayed.
Here are some examples :
in a .kt file from a kotlin library module, in a .kts file from the buildSrc module
It seems that there is an error with the JDK somewhere, but I don't understand how to fix it.
I Googled/StackOverflowed before posting here and I already tried :
to check the JDK used Project Structure > SDK Location > Gradle. It is using the Embedded JDK 11.0.10
to reinstall AS using Jetbrains Toolbox
to invalidate cache and restart
to clone my project again
to delete ~/.gradle
But none of those actions helped...
Thanks in advance !
Update 22/07
I tried to create a new empty Compose project with .kts support, but no luck, everything is in red
Because of a bug preventing to update, I updated manually to RC_1. Here is my current setup.
I tried to change from Embedded JDK to a separately installed OpenJDK 11 and reimport but not luck (#alexey-belkov suggestion)
I checked the logs but found nothing obvious (#andy suggestion)
ℹ️ Finally I tried to create a new empty Android project with only .gradle support, and no errors ! Could it be a kotlin script plugin problem ?

Android Studio - Gradle build daemon disappeared unexpectedly

This ISSUE persists from last 3 to 4 days. I'm using Android Studio - 2.3.2. But in previous version I had same ISSUE. The whole ERROR is like below.
Error:Failed to complete Gradle execution.
Cause:
Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)
Android Studio also crashes frequently.
When Android Studio crashes it gives ERROR like below.
I'm using Ubuntu 14.04 LTS.
What I have tried.
Installed new, latest and fresh Android Studio.
Made another folder for project work space and checked out latest project code from SVN.
Tried to CLEAN, REBUILD and RESTART Android Studio several times.
I think there should be some problem in Ubuntu but don't know how to solve it. Genuine help will be appreciated.

Finish can only be called once : Android

Recently updated Build: 2.3.1, AI-162.3871768, 20170401,
AI-162.3871768, JRE 1.8.0_112-release-b06x64 JetBrains s.r.o, OS Mac OS X(x86_64) v10.11.6 unknown, screens 1440x900; Retina
Switching back to Android 2.2.2 did not help either. Successfully able to build from command Line though(MacOX Terminal)
Delete your $HOME/.gradle directory (or on Windows, %HOME%\.gradle folder). The next execution of gradle will rebuild this. (It will require some downloads, so make sure you have an internet connection).
You can try just deleting $HOME/.gradle/caches, but this will not solve the problem in all cases.
I have similar issue on 2.3.1
I tried using the Android 2.4 Preview 4 but that did not help. I am able to build from command line too.
Android-Studio-2.3.1-Gradle-Sync
It happens when Android Studio creates two instances of gradle. I tried clearing the gradle cache or even deleting the .gradle but did not help. All this problem started when I deleted my old project repo and re-pulled it and imported to my Android Studio.
Best is to delete all your gradle instance from your home directly before your re-import your project Android Studio.
Android Studio started behaving like this after I tried building with the command line(osx) using ./gradlew
What helps is running the studio with sudo:
sudo /Applications/Android\ Studio.app/Contents/MacOS/studio
I wonder if theres a fix to this problem that allows the studio to be started normally as well.

Resources