Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 721
Aaron Avatar asked Mar 09 '13 21:03

Aaron


People also ask

How configure Android SDK IntelliJ?

Set up a module SDKFrom the main menu, select File | Project Structure | Project Settings | Modules. Select the module for which you want to set an SDK and click Dependencies. If the necessary SDK is already defined in IntelliJ IDEA, select it from the Module SDK list.

Which is the official IDE for Android app development based on IntelliJ IDEA?

Android Studio is the official Integrated Development Environment (IDE) for Android app development, based on IntelliJ IDEA .

Can I use IntelliJ instead of Android Studio?

Chose Android Studio. Android application development can also be done using the IntelliJ IDE. It is a very good IDE but it is paid for professional and commercial product development. However, IntelliJ IDE is available with a student license for limited application development features.

Does IntelliJ have Android SDK?

IntelliJ IDEA contains all the features found in Android Studio. Setup for Android development is, however, a bit more involved since it does not include the Android SDK by default.


2 Answers

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.

like image 124
Eric H. Avatar answered Oct 07 '22 23:10

Eric H.


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.

like image 31
fommil Avatar answered Oct 08 '22 01:10

fommil