I can’t get IntelliJ to recognise my Android SDK
I am trying to make Android programs using IntelliJ. Unfortunately, I cannot get the Android SDK to be recognised on IntelliJ. (I.e. Eclipse has Android SDK Manager installed just fine.) I select create new project from scratch. I give the project a name and select make Android module. Create source directory (next). The computer then shows Android SDK none. I click the ellipses (. ) and the program can see my JDK files. I click on the + and select Android SDK. I then find the directory c:\Program Files (x86)\Android\android-sdk. However, when I click OK a dialog box appears stating «Please select Java SDK». It only gives me the choice of 1.6 (and not the other one 1.7). I then press OK for 1.6. Finally the computer then reports it cannot find any Android targets in this SDK. Please help.
I’m still having trouble on IntelliJ 12 Community Edition on OSX 10.8.2. It refuses to accept my SDK. It never adds it no matter what I do, and the select box always only reads
12 Answers 12
Before creating a new Android Project on IntelliJ Idea, you need to configure the Java and Android Development Kits at the IDE level.
Assuming you already installed the JDK and the Android SDK and you just launched IntelliJ (I’m using version 13.0.2):
- Press Ctrl + Shift + Alt + S (to access the Project Structure dialog)
- On the left navigation pane, click on ‘Project Settings->Project’
- On the right navigation pane, you should see a drop-down list displaying »
- Click on ‘New’, select ‘JDK’ and choose the path to your JDK
- Click on ‘New’, select ‘Android SDK’ and choose the path to your Android SDK
Please note you have to define the JDK before the Android SDK.
This procedure is documented at:
If you’ve just installed Android SDK then there may not be any «platforms» installed yet. So you need to run Android SDK Manager and install at least one platform. (And in my case I had to run Android SDK Manager as Administrator to get it to work.)
On linux, run tools/android under the SDK to run the Android SDK Manager. Then download one or more of the platforms. Check out «SDK Readme.txt» in the SDK directory for more. Once you’re done there, you will be able to select a platform, and your IntelliJ system will start to run.
For others who may encounter this issue on Intellij14 + Mac — the solution that worked for me was to
1) Open intellij — select add android sdk from the project settings section, select the android-sdk-macrox root directory
2) the sdk manager pops up — download at least 1 package.
3) Restart intellij (without this restart, it didnt seem to work)
Where i can find the option to open SDK mananger from intellij? I tried everything and i cant make this work. (also on mac with intellij14)
Yeah. this is the answer of the question. in alternatively you can make an symbolic link then intellij points it. ln -s $ANDROID_HOME android_sdk , then in file explorer you can see android_sdk
Oddly, IntelliJ 12 Community doesn’t give us the option to select the JDK location for Android projects. I’ve found a workaround for this:
- First, create a new Java project. I used ‘Java Hello World’ project. This’ll give you the chance to select your JDK.
- Install the Android SDK and run the Android SDK Manager to install tools and a platform, as others have mentioned.
- Create a new Android project. Under ‘SDK’, select the Android SDK. Intellij will remember the JDK location you defined in step #1.
On Mac, IntelliJ won’t detect the installation of Android SDK. When selecting SDK for new Android module, select your android-sdk-macosx folder as your location. More info: https://peterboctor.wordpress.com/2010/12/02/installing-the-android-sdk-on-mac-os-x/
Alternatively, Google just releases Android Studio which is a whole IDE base on IntelliJ.
That link and the instructions it points to worked for me — the only change i made was to add my android sdk tools directory to my PATH. Note that I also had to restart my IDE.
With IntelliJ IDEA 14.1.2, I couldn’t select the Android SDK install location on Mac OS X. That install location was ~/Library/Android/sdk, which IntelliJ wouldn’t navigate to because ~/Library is a hidden folder. So I created a symlink in my home directory (ln -s ~/Library/Android/sdk/ ~/AndroidSDK) and IntelliJ DID let me select that.
I was able to select /usr/local/opt/android-sdk by just typing it, the slash at the beginning opens a text entry box.
@js. nice trick for prompting the search with the / . Didn’t know that. However, I still wasn’t able to navigate to ~/Library/Android . So +1 for the tip.
When going standalone (without Android Studio), make sure you have the sdk tools (from the standalone sdk, «command line tools» option), build-tools, platform-tools and an sdk (platform).
./tools/bin/sdkmanager --update # list available packages (pick a version) ./tools/bin/sdkmanager --list # install requeriments ./tools/bin/sdkmanager "build-tools;26.0.0" ./tools/bin/sdkmanager "platforms;android-26" # you might get wrong permissions from the downloaded packages sudo chmod -R +rxw tools # will need write perm to create AVDs
Yep, also worked for me. I downloaded the ‘android-sdk’ via Homebrew/Cask and then used the sdkmanager to install build-tools, platform-tools, and platform (tools are already provided) Once all four packages are present, IntelliJ recognizes it as a valid SDK!
This may help others. I found that I couldn’t get IntelliJ (MacOS) to recognise the Android targets in the android-sdk-macosx folder. Moving the Android SDK folder out of the Applications folder and into a directory in my User’s folder resolved the issue. IntelliJ was then able to recognise the Android SDK. It may have had something to do with permissions, but no errors were shown to indicate this. Hope this helps.
same issues on linux, having the SDK in /opt. creating a symlink from /home/user/sdk -> /opt/sdk makes it work. Oo
I had the same problem with version 15 intelliJ after upgrading on OS Linux Ubuntu 12.04
I found because the android sdk wasn’t in the home folder of the user running intelliJ that you had to change the Folder/file permissions before it would see this
Issuing the command chown -R /path/to/android_sdk_dir solved the problem for me
If this fails after doing this delete the ~/.ideaC(Lastversion number) any previous ~/.ideaC(Lastversion numbers) folder’s and then re open intelliJ
You will have to go through the initialization of the IDE and give the path to your Java installation ver8 upwards only on intelliJ version15 and thereafter your android sdk installation
I found this can also cause conflicts
As a further tip add the following to the very end of your ~/.bashrc using one of your editors my (nano , vi etc )
The following lines set the Android Path
PATH=$PATH:/path/to/android/:/path/to/android/tools export PATH
For SDK version r_08 and higher, also add these two lines for adb:
PATH=$PATH:/path/to/android/platform-tools export PATH
for setting android emulator to 32 bit version add this line
export ANDROID_EMULATOR_FORCE_32BIT=true
Exit your choice of editor (vi , nano etc ) and Re invoke bashrc with the command below
Starting Intellij IDEA from icon on linux: No JDK found
I am using Linux Mint and trying to run Intellij IDEA from icon on the start menu. Starting Intellij via terminal ./idea.sh works fine. However launching from icon (points to the same ./idea.sh ) ends up with following error: No JDK found. Please validate either IDEA_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation. Running echo $JAVA_HOME and java -version works correctly and shows installed JDK. How can I fix this issue and why starting from icon differs from starting from terminal?
Where are you setting JAVA_HOME ? I’m guessing it’s a file that only gets loaded by the shell in terminal windows, but not for your desktop session. That is, what is happening is: your desktop runs without JAVA_HOME set, you click on the icon, the launcher uses the environment on the desktop, breaks. You run a terminal, .bashrc sets JAVA_HOME, you run idea.sh in the terminal, then it works.
Actually, that’s not necessary, we’ve already established that the variable is not available in your login environment and thus to the launcher, so either way you need to make it available. It’s been a hot minute since I used a Linux, but can’t you set environment variables on the launcher shortcut directly? Change the call to idea.sh to be JAVA_HOME=/path/to/some/jdk /path/to/idea.sh ? Or set JAVA_HOME in .profile or whatever file Linux Mint loads at login.
@DmitryKach, I think what sdkman does is to expose the JAVA_HOME every time the terminal is launched. If this is the case you will have to manually export your java home (point to sdkman files, it’s OK)
Can’t specify SDK in Intellij on Linux
I am running IntelliJ IDEA 2017.1.6 Pro on a Linux (Ubuntu) machine and, it will not let me select an SDK for any Java project. Whenever I start up the program and go to «Create a New Project» Java has no SDKs available. If go to new and try to specify where my JDKs are installed (I have a few) it always fails with the same error: I’ve tried specifying the locations:
- /usr/lib/jvm/
- /usr/lib/jvm/java-11-openjdk-amd64/
- /usr/lib/jvm/java-8-openjdk-amd64/
- /usr/lib/jvm/openjdk-11/
- /usr/lib/jvm/jdk-14.0.2/
- /usr/lib/jvm/default-java
- /usr/lib/jvm/java-1.11.0-openjdk-amd64
- /usr/lib/jvm/java-1.8.0-openjdk-amd64
(these last three are all just symlinks)
I know I have a JDK installed for my default Java version. I can compile and run code via command line:
justin@stephanie:~/temp$ ls HelloWorld.java justin@stephanie:~/temp$ javac HelloWorld.java justin@stephanie:~/temp$ ls HelloWorld.class HelloWorld.java justin@stephanie:~/temp$ java HelloWorld Hello, World!
The output of readlink -f $(which java) is /usr/lib/jvm/java-11-openjdk-amd64/bin/java (same location for javac exectuable).
Everything I’ve looked at online suggest that I should just be able to select /usr/lib/jvm/java-11-openjdk-amd64 as my Java SDK but it is failing. I feel like I must be misunderstanding something essential here as I don’t know why this isn’t working.
Any help would be useful, I’ve never used IntelliJ before (I’ve always been an Eclipse user) and it is very frustrating I can’t even create a project in it after a couple hours of trying to mess around with it.
Android sdk for Intellij IDEA
I’m trying to setup IntelliJ IDEA to develop android applications and I faced an issue with android sdk. As far as I know, I need to download the sdk separately. But I all I managed to find was Android command line tools which is obviously not something I need. So my question how can I get android sdk for IntelliJ IDEA?
6 Answers 6
You can install whichever android SDK or API from Intellij. I have the 2018.1 version but I hope this works in earlier versions too. You can find the options to install the SDKs here:
Same problem I have with IDEA 2017.1.1. I installed tools_r25.2.3-windows.zip and managed to install them. I’ve done:
- unzipped it to C:\Android\android_sdk\
- renamed «tools» folder to «tools-sdk»
- executed C:\Android\android_sdk\tools_inst\bin>sdkmanager —update
- prepared file my_file with lines: build-tools;24.0.0 platforms;android-24 tools emulator
- Executed: C:\Android\android_sdk\tools_inst\bin>sdkmanager —package_file=my_file
Then gave IntelliJ IDEA folder C:\Android\android_sdk as Android SDK Home Folder.
Then IDEA asks to install something additional. The test android project compiles and runs on emulation (AVD Manager works). I had to install 22 Platform and Build Tools though because android-24 virtual device asked for a password.
The only problem is I still have no SDK Manager with GUI interface.