Import errors and Hello World activity won't run in IDEA 12

Please see the screenshot 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



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.
successful hello world idea 12.png


I didn't understand, where the "Select Project SDK" dialog came from? Did you click on "Project SDK is not defined panel"? What SDK have you chosen in "New Project" window?


Here's what it looks like for me. I selected a new SDK, which was just the same one as before. I think the mistake I made earlier was selecting too many SDKs -- I didn't need the Java one because it's already associated with the IDE?



You do need both JDK and Android SDK. If you still have problems, please look at File | Project Structure | SDKs. Android SDK should refer to some Java SDK


Thanks! That's a good menu option to know about. Indeed, the working project (good_sdk.png attached) and non-working project (bad_sdk.png) are different!



If the "bad" project is "hello_world_2", then the problem is that Java SDK is specified for your project instead of Android SDK. That is weird, because project SDK should be set to Android automatically if you've chosen it in "New project" window. Also SDK can be configured on Module level (see Project Structure | Modules | Dependencies | Module SDK). By default it should inherit project SDK.


Please sign in to leave a comment.