Can't get IntelliJ, maven and Android parts to work together

I had an existing Android project set up in IntelliJ that was working fine. The project uses RoboGuice and Robolectric. Unit tests are run through jUnit off the emulator. All that was working well.

I then added a Maven pom.xml file to the project to get it to build (with dependencies) on our build server. IntelliJ imported the POM file, changed it and now no longer builds the app. Specifically, it appears that it's not loading any of the resources.

When I run my tests from IntelliJ I get RoboGuice errors saying it can't in inject null for fields that exist in the layout. When I run the app from IntelliJ, I a ClassNotFoundException for the root application.

Running maven from the command-line fails on my development system with a strange path problem, but exhibits the missing resource issue in test that IntelliJ has.

1. Why did IntelliJ create a completely new iml file when I added a pom.xml to my application root?
2. Why is the new iml file broken (including as described in a previous post)?

What additional information can I provide to help diagnose this?

1 comment
Comment actions Permalink

So I was able to resolve this by closing the existing project and then reloading IntelliJ and sayong "Open Project..." and pointing to the pom.xml file, rather than the .iml file it had created.

IntelliJ removed the old .iml file, created a new on (changed case on the file incidentally) and added an ipr and an iws file. Once these were in place I was able to recreate my run configurations and IntelliJ is working again.

Still I think there's some problems in the auto-import behavior as it clearly imported the pom.xml right once I told it to.

0

Please sign in to leave a comment.