Adding VPI to project with a lot of dependencies causes error on pre-3.0 devices

I recently switched from eclipse to intellij, it has been a great experience so far I am really loving it. However, I have run into a strange issue that I have been hitting my head against the wall with. I am trying to use ViewPagerIndicator, ActionBarSherlock, RoboSherlock, and RoboGuice as well as some other common frameworks in my application. It all works fine until I add VPI.

Basically, when adding the ViewPagerIndicator dependency to my project it breaks the application for pre 3.0 devices (runs fine on 3.0+).

The error is rather confusing because it seems to be something wrong with an ABS compatible theme not being picked up when the VPI apklib is present (please note that I am using an ABS compatible theme in my manifest).

>09-18 10:33:15.986: ERROR/COM.IRIE.TASTEBUD/ObserverMethodListener.java:34(509): main java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:507)
        at roboguice.event.eventListener.ObserverMethodListener.onEvent(ObserverMethodListener.java:32)
        at roboguice.event.EventManager.fire(EventManager.java:130)
        at com.github.rtyley.android.sherlock.roboguice.activity.RoboSherlockActivity.onCreate(RoboSherlockActivity.java:63)
        at com.irie.tastebud.view.activity.MainActivity.onCreate(MainActivity.java:38)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

When I look deeper at the trace I see the below (even though I am using a sherlock theme):

   Caused by: java.lang.IllegalStateException: You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.
    at com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:1007)
    at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:919)
    at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:853)
    at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:218)
    at roboguice.inject.ContentViewListener.optionallySetContentView(ContentViewListener.java:21)
    ... 19 more**

See full exception stack trace and activity/manifest/pom.xml code @ https://gist.github.com/3743646 .

Once again – this only happens on pre-3.0 devices when adding the VPI project as a maven dependency. If I remove VPI – the app runs fine on 2.2+ devices.

My Pom.xml is almost exactly like the Android Bootstrap application which works fine on 2.2+ as far as I know.

My guess is that I have some kind of dependency configuration issue on my end. I am pretty green with maven and intellij so it has been quite difficult to trouble shoot.

I am not sure if anyone else has seen this behavior, or if I am making a rookie mistake. Any help is appreciated – if I solve the issue, I will update this question with the answer.

Thanks to everyone in advance and sorry if I broke any stackoverflow etiquette with this post.

EDIT: Found potential related issue @ http://youtrack.jetbrains.com/issue/IDEA-90719

Answer

I found another workaround for this issue that works much faster. In Android facet config change resource processing from “Run ‘process-resources’ Maven task before Make” to “Compile resources by IDE”. See screenshot in attachment. After this change all works fine and fast on all android versions

Facet configuration

Source: stackoverflow
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .