I have a project that is using both ActionBarSherlock and ViewPagerIndicator. I had some issues including both as a library, so what I ended up doing was making ViewPagerIndicator include ActionBarSherlock as a library and remove the support v4 jar from ViewPagerIndicator (see this post: Using ActionBarSherlock & ViewPagerIndicator Syncronously Will Not Compile).
Everything builds and my app runs, but when I inflate a view with a TabIndicator, a resource not found exception is thrown. I’ve traced it down to the vpi__tab_indicator.xml file and the 6 drawables it’s referencing. When I comment out those drawables, the view inflates fine. I can see these drawables in both the ViewPagerIndicator project, as well as in its R file in my application. Is there something that I’m missing? The activity in question has the following style: android:theme="@style/Theme.PageIndicatorDefaults"
Edit:
stack trace (if it helps any)
07-30 14:48:22.391: E/AndroidRuntime(7517): FATAL EXCEPTION: main
07-30 14:48:22.391: E/AndroidRuntime(7517): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp/com.myapp.Activity}: android.content.res.Resources$NotFoundException: File res/drawable/vpi__tab_indicator.xml from drawable resource ID #0x7f02005a
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.app.ActivityThread.access$600(ActivityThread.java:130)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.os.Handler.dispatchMessage(Handler.java:99)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.os.Looper.loop(Looper.java:137)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.app.ActivityThread.main(ActivityThread.java:4745)
07-30 14:48:22.391: E/AndroidRuntime(7517): at java.lang.reflect.Method.invokeNative(Native Method)
07-30 14:48:22.391: E/AndroidRuntime(7517): at java.lang.reflect.Method.invoke(Method.java:511)
07-30 14:48:22.391: E/AndroidRuntime(7517): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
07-30 14:48:22.391: E/AndroidRuntime(7517): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
07-30 14:48:22.391: E/AndroidRuntime(7517): at dalvik.system.NativeStart.main(Native Method)
07-30 14:48:22.391: E/AndroidRuntime(7517): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/vpi__tab_indicator.xml from drawable resource ID #0x7f02005a
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.content.res.Resources.loadDrawable(Resources.java:1918)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.view.View.(View.java:3336)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.widget.TextView.(TextView.java:447)
07-30 14:48:22.391: E/AndroidRuntime(7517): at com.viewpagerindicator.TabPageIndicator$TabView.(TabPageIndicator.java:252)
07-30 14:48:22.391: E/AndroidRuntime(7517): at com.viewpagerindicator.TabPageIndicator.addTab(TabPageIndicator.java:152)
07-30 14:48:22.391: E/AndroidRuntime(7517): at com.viewpagerindicator.TabPageIndicator.notifyDataSetChanged(TabPageIndicator.java:209)
07-30 14:48:22.391: E/AndroidRuntime(7517): at com.viewpagerindicator.TabPageIndicator.setViewPager(TabPageIndicator.java:197)
07-30 14:48:22.391: E/AndroidRuntime(7517): at com.myapp.Activity.onCreate(Activity.java:27)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.app.Activity.performCreate(Activity.java:5008)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
07-30 14:48:22.391: E/AndroidRuntime(7517): … 11 more
07-30 14:48:22.391: E/AndroidRuntime(7517): Caused by: java.lang.NullPointerException
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.graphics.drawable.DrawableContainer$DrawableContainerState.addChild(DrawableContainer.java:524)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.graphics.drawable.StateListDrawable$StateListState.addStateSet(StateListDrawable.java:278)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:186)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:881)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:818)
07-30 14:48:22.391: E/AndroidRuntime(7517): at android.content.res.Resources.loadDrawable(Resources.java:1915)
Thanks!
When copying files from one place to the other, a couple of my
ViewPagerIndicatordrawables must have gotten corrupted along the way. I re-fetched the drawables from the repo, added them into the project, everything compiled and ran perfect.Hopefully that will save someone else a few hours.