Search code examples
androidmavenactionbarsherlockandroid-maven-plugin

Maven-Android-Plugin 3.8.2 causes ActionBarSherlock issues


I've been a happy ABS user for a number of years now but since my last updated to the maven-android-plugin I cannot get the built app to run on devices without a native Action Bar...i.e. anything before Honeycomb.

The exception I am getting is;

01-11 15:47:04.413: E/AndroidRuntime(1479):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1768)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at android.app.ActivityThread.access$1500(ActivityThread.java:123)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at android.os.Looper.loop(Looper.java:130)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at android.app.ActivityThread.main(ActivityThread.java:3835)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at java.lang.reflect.Method.invokeNative(Native Method)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at java.lang.reflect.Method.invoke(Method.java:507)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at dalvik.system.NativeStart.main(Native Method)
01-11 15:47:04.413: E/AndroidRuntime(1479): Caused by: java.lang.RuntimeException: Couldn't find content container view
01-11 15:47:04.413: E/AndroidRuntime(1479):     at com.actionbarsherlock.internal.ActionBarSherlockCompat.generateLayout(ActionBarSherlockCompat.java:1015)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at com.actionbarsherlock.internal.ActionBarSherlockCompat.installDecor(ActionBarSherlockCompat.java:902)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:836)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:261)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at com.oceanlife.core.activity.AbstractThemedActionBarActivity.onCreate(AbstractThemedActionBarActivity.java:32)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at com.oceanlife.activity.SpotListingActivity.onCreate(SpotListingActivity.java:119)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-11 15:47:04.413: E/AndroidRuntime(1479):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1722)
01-11 15:47:04.413: E/AndroidRuntime(1479):     ... 11 more

I am suspecting that my upgrade to the android-maven-plugin v3.8.2 alongside the required upgrade to Maven 3.1.1 has caused this problem (and not ABS itself) ...so my question is, how can I diagnose what is wrong? Interestingly when debug the portion of code causing the problem ActionBarSherlockCompat#generateLayout the layout is found correctly but the underlying id is not, review the comments inline below;

if (DEBUG) Log.d(TAG, "[generateLayout] using screen XML " + mActivity.getResources().getString(layoutResource));
  View in = mActivity.getLayoutInflater().inflate(layoutResource, null);
  mDecor.addView(in, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));

  // mDecor not null and the orginal resource contains an id called "abs__content"
  ViewGroup contentParent = (ViewGroup)mDecor.findViewById(R.id.abs__content);
  if (contentParent == null) {
      throw new RuntimeException("Couldn't find content container view");
  }

The only thing abnormal about the child view with this id is that it has the following namespace;

com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout

Any assistance with getting my build back working on Gingerbread devices most appreciated. And to the SDK 14+ armada, this is my last release to Gingerbread. Thank you in advance.


Update: I have confirmed that this is a direct effect of upgrading to the maven-android-plugin at v3.8.2 (and the consequential 3.1.1 Maven upgrade).


Solution

  • You should use the apklib of ActionBarSherlock with 3.8.1 and the aar with 3.8.2. We are currently trying to get support for both working nicely in our works towards 3.8.3...