Bug? B4A 6.80: java.lang.NoSuchMethodError: No virtual method AddTwoLinesAndBitmap2

walt61

Active Member
Licensed User
Hi all (and possibly specifically @Erel),

A project that ran fine with B4A 6.50 now throws an exception with 6.80:

B4X:
java.lang.NoSuchMethodError: No virtual method AddTwoLinesAndBitmap2(Ljava/lang/String;Ljava/lang/String;Landroid/graphics/Bitmap;Ljava/lang/Object;)V in class Lanywheresoftware/b4a/objects/ListViewWrapper; or its super classes (declaration of 'anywheresoftware.b4a.objects.ListViewWrapper' appears in /data/app/com.code4data.hamm-1/base.apk)
    at njdude.compact.actionbar.compactactionbar._addmenuitem(compactactionbar.java:90)
    at com.code4data.hamm.main._setupcompactactionbar(main.java:1418)
    at com.code4data.hamm.main._activity_resume(main.java:1184)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:163)
    at com.code4data.hamm.main.afterFirstLayout(main.java:108)
    at com.code4data.hamm.main.access$000(main.java:17)
    at com.code4data.hamm.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:746)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5443)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

I've seen that @MDimitris was caught by that issue too (https://www.b4x.com/android/forum/threads/slidingmenu-and-b4a-version-6-80-problem.76836/) where @DonManfred suggested to recompile the library.

I could of course ask @NJDude nicely if he'd mind recompiling his Compact ActionBar with 6.80, but can imagine that this issue can pop up in cases where the author or source are no longer available.

Is there a solid solution for this (other than using another library, which I want to avoid)?

Thanks,

walt61
 

walt61

Active Member
Licensed User
I may be having the wrong idea about AppCompat, so please enlighten me :) I've given it a shot, actually uninstalled and reinstalled JDK and the Android SDK including all the bits that @corwin42 mentions in the AppCompat post. I added the latest AppCompat library to the CompactActionBar demo project as well as, in the Main (and only) Activity:

B4X:
#Extends: android.support.v7.app.AppCompatActivity

and in the Manifest Editor:

B4X:
SetApplicationAttribute(android:theme, "@style/Theme.AppCompat")

But the result is the same. I had the (possibly completely wrong) idea that AppCompat would sort of provide stubs that would cater for changed signatures to provide backward compatibility. Am I missing something, or did you perhaps mean 'use the AppCompat ActionBar object instead of Compact ActionBar'?

I'm attaching the exported project; any pointers would be greatly appreciated!

On a sidenote, I can't help wondering (feel free to refer me to a document or to tell me the explanation would be too long) why this didn't happen with any B4A version up to and including 6.50 but does now with 6.80 - it could be useful to know, e.g. to potentially avoid future pitfalls.

Thanks!

(Some version numbers: JDK=jdk1.8.0_121; SDK=android-25; B4A=6.80; Android on phone=6.0)
 

Attachments

  • CABar.zip
    19.6 KB · Views: 214
Top