Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Android Source Generator: Cannot parse SDK

Situation:
I'm using Intellij Idea (13.1.1 on Win 8.1) and wanted to get started with Android development again. Therefore I just downloaded the latest Android SDK (also started the SDK-Manager and downloaded the suggested tools), created a new Android Application Module in Intellij and set the just downloaded Android SDK as Project SDK.

Now it looks as follows:

Project Settings:

Project -> Project SDK: Android API 19 Platform (java version "1.8.0")
Modules -> Dependencies: Module SDK: Project SDK
Modules -> Dependencies -> Export: Android API 19 Platform (java verion "1.8.0")

Platform Settings:

SDKs:
Name: Android API 19 Platform
Build target: Android 4.4.2
Java SDK: 1.8

Problem

..but whenever I try to run MyActivity.java, it throws these errors:

Error:Android Source Generator: Cannot parse SDK 'Android API 19 Platform': unknown target android-19
Error:Android Source Generator: [TestAndroid] Android SDK is invalid or not specified

Well, I googled a lot but I have no idea what I should do, since everything is set up right as I guess. (But if I use the downloaded sdk with Eclipse it works fine. Don't judge me, but I prefer using Intellij Idea).

Any ideas?

like image 487
Schwamm007 Avatar asked Apr 18 '14 13:04

Schwamm007


2 Answers

Just came across the same issue (same setup but running Win7), here's what solved it for me.

In the Project Settings dialog
Platform Settings -> SDKs: set Java SDK to 1.7 (didn't work with 1.8)
Project Settings -> Project: set Language level to 7.0 or below

like image 144
guest31415 Avatar answered Sep 28 '22 14:09

guest31415


You need to change the IntelliJ android sdk location. I think the install location changed with Windows 8.

In IntelliJ, go to Project Structure -> SDKs. Change the Android SDK home location to where it is in your App Data folder. E.g. C:\Users\youruser\AppData\Local\Android\android-sdk

like image 45
manyways Avatar answered Sep 28 '22 15:09

manyways