Android Question Oops: java.lang.NoClassDefFoundError

Discussion in 'Android Questions' started by Peter Simpson, Apr 27, 2015.

  1. Peter Simpson

    Peter Simpson Expert Licensed User

    Hiya all,
    This just appeared in one of my apps on the Play Store. I'm using AppCompat from @corwin42 and this is the first error that I've seen, which isn't too bad really considering that I have a few thousand users using my apps.

    Error is in Anywayandroid.support.v7.app.ActionBarActivityDelegateBase.initializePanelMenu and I'm not sure where to start with error, any ideas?

    Code:
    java.lang.NoClassDefFoundError: android.support.v7.internal.view.menu.MenuBuilder
    at android.support.v7.app.ActionBarActivityDelegateBase.initializePanelMenu(ActionBarActivityDelegateBase.java:
    914)
    at android.support.v7.app.ActionBarActivityDelegateBase.preparePanel(ActionBarActivityDelegateBase.java:
    964)
    at android.support.v7.app.ActionBarActivityDelegateBase.doInvalidatePanelMenu(ActionBarActivityDelegateBase.java:
    1182)
    at android.support.v7.app.ActionBarActivityDelegateBase.access$
    100(ActionBarActivityDelegateBase.java:79)
    at android.support.v7.app.ActionBarActivityDelegateBase$
    1.run(ActionBarActivityDelegateBase.java:115)
    at android.os.Handler.handleCallback(Handler.java:
    725)
    at android.os.Handler.dispatchMessage(Handler.java:
    92)
    at android.os.Looper.loop(Looper.java:
    137)
    at android.app.ActivityThread.main(ActivityThread.java:
    5285)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:
    511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
    1102)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
    869)
    at dalvik.system.NativeStart.main(Native Method)
    Screenshot_2015-04-27-09-46-53.png
     
  2. DonManfred

    DonManfred Expert Licensed User

    Did you update your SDK?
    If yes; maybe this is the problem. AppCombat has been xtended. Maybe you need a new version of AppCompat library
     
    thedesolatesoul likes this.
  3. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Peter Simpson and DonManfred like this.
  4. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Infact a huge number of developers are facing this issue and the only workaround seems to be to obsucate the appcompat-v7 menu builder class using proguard. Not quite sure how we can do that with B4A as I imagine this would happen at app compile stage. (or i guess library compile stage for the AppCompat library). Which is a shame as it forced us to obfuscate a library and makes debugging harder.
     
    Peter Simpson likes this.
  5. thedesolatesoul

    thedesolatesoul Expert Licensed User

  6. corwin42

    corwin42 Expert Licensed User

    First: AppCompat wrapper library works very well with the v22.1 version of the support library.

    The above issue is an issue with Samsung (and at least Wiko) devices with Android 4.2.2. thedesolatesoul is absolutely correct.

    The question is how to solve this. Seems that it can be easily solved with ProGuard (would be just a one liner) but I don't know if it can be used with the #CustomBuildAction attribute. maybe @Erel can say something about it. I have absolutely no experiance with ProGuard.

    Does anybody here has an affected device to do some tests? I'm not sure if this solution will work. This would be easy to add to the wrapper library but I need a device to test it on. Seems that it happens when you set a ToolBar as ActionBar.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    You don't need to run proguard during compilation. Only once when you create the (native) library jar file.
     
  8. corwin42

    corwin42 Expert Licensed User

    A workaround to this issue may be:

    Code:
    Try
        ToolBar.SetAsActionBar
    Catch
        
    Log("Faulty Samsung ROM?")
    End Try
     
    Last edited: Apr 29, 2015
  9. Peter Simpson

    Peter Simpson Expert Licensed User

    My SDK had is uptodate @DonManfred.

    Hmm, I'm now lost.

    Thank you @thedesolatesoul I will read this :)

    Thank you @corwin42, I'll give it a try :D.

    The thing that baffles me is that I have an Samsung S4 test device with Android 4.2.2 and it works perfect on that device. I have turned off the auto update OS as I need a Samsung phone with 4.2.2 and it's been trying to install Android 5.x...


    Thanks to everybody for helping me with this issue, what a great community this is :cool:
     
    Last edited: Apr 29, 2015
    thedesolatesoul likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice