Thom
Thom

Reputation: 15042

Android on Intellij showing error: is not an activity

I have just imported my android project into intellij from eclipse. I am new to intellij.

I have gotten everything working and set up the run configuration for Android. When I run it, it gives me the edit configuration screen.

When I say launch the default activity, it tells me that it can't find the default activity, which is odd. When I code the activity to launch straight away, it tells me that that's not an activity subclass or alias. I double-checked and the class is certainly an activity.

When I ignore it and run anyway, it blows up as soon as it hits the phone.

Can you help me understand/fix these errors, please?

Upvotes: 6

Views: 5966

Answers (3)

In my case, none of these solutions worked. Then I started digging.

As I remember, my java files had to be placed in src/main/java/com.something.blabla. Then I realized that the directory has changed to src/main/java/com/something/blabla.

So I created a new com.something.blabla folder under ../java/ and moved my java files to that folder. I removed the com folder, and it worked perfectly.

Upvotes: 0

inky
inky

Reputation: 1462

My solution was to delete and recreate the run configuration.

Upvotes: 1

gbuys
gbuys

Reputation: 400

In the Intellij project structure dialog, select the module that your Activity is residing in.

Then under the sources tab, add the root folder of your sources as sources for this module by clicking the 'Mark as Sources' link or button. The sources root folder should be mark blue.

The module can now find your sources and launch the activity.

Upvotes: 17

Related Questions