I downloaded Android Studio latest version and installed Java 8. When I launch Android Studio I got below image.
Android studio found my Java version is 1.6 which is deprecate to run it. But I have installed java 1.8.0_101 and set the JAVA_HOME correctly. Please see below terminal output:
zhaoyi0113:Contents zhaoyi0113$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
zhaoyi0113:Contents zhaoyi0113$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
I wonder how to setup java version for android studio?
EDIT1
I have tried to reboot my mac os but it still got the same error.
EDIT2
This dialog block me using android studio so there is no chance for me to click android studio menu or doing any configuration on it. When I click the update button, my browser will be open to jdk1.6 download page.
you must edit Info.plist :
to right click on the icon for the Android application Studio and choose " Show Package Contents "
Open Contents/Info.plist with a TextEdit, at the line :
<key>JVMVersion</key>
<string>1.6</string>
, changes in
<key>JVMVersion</key>
<string>1.7*,1.8+</string>
Sorry for my very bad english !
Go to File > Project Structure and pick the correct SDK and JDK location.
Related
C:\ns\example-app>java -version
java version "17" 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed
mode, sharing)
C:\ns\example-app>ns -version
8.1.5
√ Up to date.
C:\ns\example-app>npm -version
6.14.15
Try to uninstall and then reinstall Android SDK using the Android SDK Manager.
You can do this by installing Android Studio, and opening the SDK Manager:
Then, click on "SDK Manager" (red mark), then "Show all packages" (orange mark) and then uncheck version 31.0.0 (should be where my blue mark is), and click apply to uninstall it.
Then, check version 31.0.0 (or any other version), and click apply to install it again.
I have both versions 30.0.2 and 26.0.3 and they work great.
Also, check to see that the $ANDROID_HOME and $ANDROID_SDK_ROOT paths are correctly set by following this answer.
After you've reinstalled the packages, check this answer to see how to fix a corrupt SDK installation if it is still corrupt.
I’m trying to run Android Studio with JDK 13 just because I feel like it must run faster than the JDK 8 that comes embedded with it.
According to the documentation (which I found from umang shukla's answer), we can force Android Studio to use something other than the embedded JDK by setting STUDIO_JDK.
STUDIO_JDK
Sets the location of the JDK with which to run Studio. When you launch Android Studio, it checks the STUDIO_JDK,
JDK_HOME, and JAVA_HOME environment variables in that order.
And I did that:
$ export STUDIO_JDK=`/usr/libexec/java_home -v 13`
$ echo $STUDIO_JDK
/Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home
$ open /Applications/Android Studio 3.5.app/
$ ps ax | grep Android
1198 ?? R 1:07.86 /Applications/Android Studio 3.5.app/Contents/MacOS/studio
1269 ?? S 0:00.02 /Applications/Android Studio 3.5.app/Contents/bin/fsnotifier
1300 s000 R+ 0:00.00 grep Android
$ ps eww 1198
PID TT STAT TIME COMMAND
1198 ?? S 1:46.13 /Applications/Android Studio 3.5.app/Contents/MacOS/studio ANDROID_HOME=/Users/hborders/Library/Android/sdk TERM_PROGRAM=Apple_Terminal JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home TMPDIR=/var/folders/r6/qtc_vgrx1xb2gqsg08y0tl000000gp/T/ __CF_USER_TEXT_ENCODING=0x1F6:0x0:0x0 SHELL=/bin/bash _=/usr/bin/open HOME=/Users/hborders TERM_SESSION_ID=CA1F90D5-ABE9-427A-ACC5-EEE63AC66CAB SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.J9ll4GUN4M/Listeners Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.B3Rds8GPV9/Render TERM_PROGRAM_VERSION=421.2 SHLVL=1 PATH=/usr/local/bin:/Users/hborders/Library/Android/sdk/tools:/Users/hborders/Library/Android/sdk/platform-tools:/usr/local/opt/go/libexec/bin:/Users/hborders/go/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin DISPLAY=/private/tmp/com.apple.launchd.4O8kDH9XQS/org.macosforge.xquartz:0 TERM=xterm-256color LOGNAME=hborders XPC_SERVICE_NAME=com.google.android.studio.55476 LANG=en_US.UTF-8 GOROOT=/usr/local/opt/go/libexec GOPATH=/Users/hborders/go USER=hborders XPC_FLAGS=0x1 STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home PWD=/Users/hborders
However, when I look in Android Studio’s Collect Troubleshooting Information dialog, I get the following information:
Build version: Android Studio 3.5.1 Build #AI-191.8026.42.35.5900203 September 25, 2019
Java version: 1.8.0_202-release-1483-b49-5587405x86_64
Operating System: Mac OS X (10.14.6, x86_64)
JVM version: OpenJDK 64-Bit Server VM JetBrains s.r.o
I also tried launching Android Studio thusly:
$ /Applications/Android Studio 3.5.app/Contents/MacOS/studio
And I got the same result. I filed an Android Studio issue about this. Please star it.
Any ideas?
TLDR
Don't try to do this. Android Studio 3.5.1 hangs when trying to change the boot jdk. I filed this in the Android Studio issue tracker. Please star it.
Someone privately suggested:
cmd+shift+a -> switch boot jdk
This definitely changed Android Studio's behavior. However, Android Studio 3.5.1 hung at the splash screen.
This happened when I tried to start it with either Oracle JDK 13:
java version "13.0.1" 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
or Oracle JDK 11:
java version "11.0.5" 2019-10-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.5+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.5+10-LTS, mixed mode)
To fix this problem, I found that Android Studio stores the boot jdk preference in ~/Library/Preferences/<PRODUCT><VERSION> on macOS (~/Library/Preferences/AndroidStudio3.5 in my case).
Then, I simply deleted the studio.jdk file, and Android Studio started normally again.
Jetbrains has instructions for choosing the underlying runtime.
At a high level:
Install the Choose Runtime plugin
Then do "Find Action" in the IDE and select "Choose Runtime"
Android Studio is giving me a Gradle build error that looks like this:
Error:(3, 22) compileSdkVersion android-22 requires compiling with JDK 7
Now it gives me these clickable prompts:
Download JDK 7
Select a JDK from the File System
Open build.gradle File
And I have already downloaded and installed JDK 7. The problem is when I go to select it in the "File System" i can only find a directory named 1.6.0 JDK. Furthermore, the installation of JDK 7 skipped the bullet point where I would've selected the install directory, so I'm really not sure where it is. My java control panel says I have "Java 7 Update 79" so I'm pretty sure I'm close, I just need to tell android studio where it is. I also ran the java -version command in the terminal and it says my version is "1.7.0_79".
Any help would be appreciated!
You can use cmd + ; for Mac or Ctrl + Alt + Shift + S for Windows/Linux to pull up the Project Structure dialog. In there, you can set the JDK location as well as the Android SDK location.
To get your JDK location, run /usr/libexec/java_home -v 11 in terminal. Send 1.7 for Java 7, 1.8 for Java 8, or 11 for Java 11.
Android Studio Arctic Fox (2020.3.1)
In Android Studio Arctic Fox (2020.3.1 Patch 4), the JDK Location setting is moved to:
File > Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JDK
Up to Android Studio 4.2
You can follow the answer from Ben Kane, the JDK Location setting is located in:
File > Project Structure > SDK Location
For new Android Studio versions, go to C:\Program Files\Android\Android Studio\jre\bin(or to location of Android Studio installed files) and open command window at this location and type in following command in command prompt:-
java -version
The gradle sync uses the following JDK location:
In Android Studio, File -> Project Structure
Navigate to the SDK Location.
cd /Applications/Android\ Studio\ 4.1.0.app/Contents/jre/jdk/Contents/Home
➜ Home ./bin/java --version
openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
OpenJDK 64-Bit Server VM (build 11.0.8+10-b944.6916264, mixed mode)
On a Mac, you can use terminal to go to /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home (or wherever your Android SDK is installed) and enter the following in the command prompt:
./java -version
In Android Studio 4.0.1, Help -> About shows the details of the Java version used by the studio, in my case:
Android Studio 4.0.1
Build #AI-193.6911.18.40.6626763, built on June 25, 2020
Runtime version: 1.8.0_242-release-1644-b01 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1237M
Cores: 8
Registry: ide.new.welcome.screen.force=true
Non-Bundled Plugins: com.google.services.firebase
This is old question but still my answer may help someone
For checking Java version in android studio version ,
simply open Terminal of Android Studio and type
java -version
This will display java version installed in android studio
gradle.properties:org.gradle.java.home=/Applications/Android\ Studio.app/Contents/jre/Contents/Home
./gradlew assembleDebug -Dorg.gradle.java.home=/Applications/Android\ Studio.app/Contents/jre/Contents/Home
Friends
I am new in to android app development and When I am trying to setup the environment I am getting the error i am just confuse why it is happening with me I am using Ubuntu 14.04 LTS and java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
and when have download the android-studio-ide-135.1641136-linux.zip from here and when i am running the studio it starts well and after when I try to create a new project i am facing like this !null
java.lang.AssertionError any one can please help me in solveing the problem
I had the same issue but on Windows 7 OS. Apparently Android Studio had no idea where the Android SDK folder was located. You can set this location under File -> Project Structure -> "SDK Location" or use Ctrl+Alt+Shift+S then "SDK Location". You just have to specify the ..\Android\sdk folder location. You can also set your Java Development Kit (JDK) location as well if that is not set properly.
Remove .idea files from project it will fix your issue.
After a long research over net and R&D i found that my SDK Manager was not properly configured and was unable to download the minimum SDK but it's a bug too of an IDE so my recommendation is that if u find this kind of problem try to import an entire per-compiled project then when ever the IDE will open will open with some value. Some times in case of Linux it is some permission issue so we have to check all the permission carefully
I am running android studio on a Mac os x maverick. I have installed the 64bit JDK. When I run the emulator I get the message
Error:Abnormal build process termination:
Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.
in android studio.
java -version
returns
version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
and
$JAVA_HOME
points to
/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
So every thing seems to be fine. What could possibly be wrong?
Update:
I still had an old jdk1.6 lying around on my mac. When removing it Android Studio was asking to install Java 6 again. So apparently Android Studio needs Java 6 to compile (as confirmed by Andrew in the comment of this question). Hoping that it would install the x64 version I let it install Java 6. However I still wasn't successful afterwards. I neither could find Java 6 for Mac OS X 64 Bit. Any hints on that?
Android Studio can run on whatever it needs, but the error seems to be pointing to the SDK that the project is using. To check what your project is using, go into Project Structure > Project Settings > Project. You should now see the Project SDK. It should say something like "Android API ## Platform (java version "1.7.[current version number]"). If it doesn't say 1.7.[current version number], then it probably needs to be updated.
Here's what you can do to update it:
In Project Structure > Platform Settings > SDKs, click the "+" button to add a new SDK.
In the pop-up, go into your Android SDK folder and click "Choose"
Another pop-up will appear asking for which SDK and JDK you want to use. Choose any Android SDK and the 1.7 JDK.
Go to Project Structure > Project Settings > Project and change your Project SDK to the one you just created. You should see the name of the SDK with the new Java version that you installed.
I am not sure but I think that sometimes the error is actually stating a falsehood, and is misleading.
I agree with #Maxwell inasmuch as the problem is a mismatch between the JDK configured for the project and the JDK that IntelliJ is running under.
The specific problem I encountered was Running IntelliJ 13.1.1 with 1.6.0_65 ... x86_64 while compiling a project configured with a Java 7 x64 JDK. Reconfiguring the project to an x64 Java 6 JDK put out the fire.
I resolved this issue by doing the following:
Go to File -> Project Structure... -> Platform Settings -> SDKs
Select the SDK listed
Click on the ' - ' to remove it.
Restart Android Studio
Go to File -> Project Structure -> Platform Settings -> SDKs
Select the SDK listed
Click on the ' + ' to add it (follow path to your JDK HOME)
Restart Android Studio, and re-Build your Project.