Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.ClassNotFoundException android + eclipse + maven + osx

I'm trying to implement maven into an existing android project. I've done so through the context menu > Configure > Convert to Maven project. And everything seems okay, no warnings or errors.
But when I try to run the app (just like before) I get:

12-31 10:16:57.423: E/AndroidRuntime(14242): java.lang.RuntimeException:
Unable to instantiate activity ComponentInfo{xxx/xxx.MainActivity}: 
java.lang.ClassNotFoundException: xxx.MainActivity

I've followd all the instructions on implementing m2e and everything looks like it should work.
If I don't convert the project to a maven project, the app runs fine.

Any suggestions where I'm failing?

This is what my pom.xml looks like: http://pastebin.com/ByXA0BP4

like image 884
basvk Avatar asked Dec 31 '13 09:12

basvk


2 Answers

This took me ages to resolve and it was the OP's answer which guided me.

After enabling Maven for the project, you need to disable "Allow output folders for source folders"

Steps:

Project Properties -> Java Build Path -> Source Tab -> Untick "Allow output folders for source folders" -> Click OK

I also noticed that I got the following message in the console, which led me down a rabbit warren of false leads:

trouble writing output: already prepared
like image 137
Alastair McCormack Avatar answered Oct 24 '22 19:10

Alastair McCormack


I figured it out myself. After converting the project to a maven project, right click on the 'src' folder and chose Build path > Use as Source Folder

Now the project runs fine

like image 44
basvk Avatar answered Oct 24 '22 17:10

basvk