Aaron
Aaron

Reputation: 2305

Android Hello World in IntelliJ 12 - Cannot find android.app.Activity class

Please see below. I have a feeling I've got the SDKs configured incorrectly, but I'm not sure how to solve it. I tried Googling for answers but no one had this exact problem.

Do I have the wrong Java version maybe? It seems like the two SDKs might be conflicting with each other.

I made this project via:

  1. Create New Project
  2. Android > Application Module
  3. Defaults and Finish

error in IntelliJ


Edit: See screenshot. I got it working. All I did was create a new project and re-select the Android SDK. I'm still thinking it was because I added too many SDKs/JDKs the first time. I think all you need is the Android SDK and don't need to add the normal Java one too.

enter image description here

Upvotes: 8

Views: 4697

Answers (2)

fommil
fommil

Reputation: 5875

I had exactly the same problem, but the conditions leading up to it are quite unusual.

I downloaded the Android SDK as a zipfile and unextracted it into /opt.

However, the permissions did not allow normal users to enter all directories or execute all files... so when IntelliJ indexed the SDK it only picked up the res jar... and never added the sources to the library path!

Deleting the SDK, fixing the permissions problem in the SDK, and creating a new reference in IntelliJ fixed it.

Upvotes: 1

Eric H.
Eric H.

Reputation: 7014

I tried what for3st suggested to no avail at first, but i've heard other places that you should use JDK 1.6 for IntelliJ IDEA in other places, so you can do that here. Also, you set the SDK by going 'File'->"Project Structure" -> "Platform SettingS" -> "SDKs"

In the end, I also switched from Android 2.2 to 2.3.3 (api 10) and that got it to work. Don't have a good idea why it didn't work for 2.2, but since I just want a beginner's tutorial, I'm fine with that.

Upvotes: 1

Related Questions