Android Question R8 - code now crashing

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Crash where??:
Get this crash Info

java.lang.NullPointerException
        at com.BOBs.BOBsCommon.cdropdown._vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv1(SourceFile:32)
        at com.BOBs.BOBsCommon.cdropdown._vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv4(SourceFile:273)

cdropdown line 32 says what?
public anywheresoftware.b4a.objects.B4XViewWrapper _vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv5 = null;

This make no sense to me
so I go to line 273 to see what is there
@Override
        public String toString() {
            return BA.TypeToString(this, false);
        }}
public void  _add_item(com.BOBs.BOBsCommon.cdropdown._tdropdown_itementry _itementry) throws Exception{
ResumableSub_Add_Item rsub = new ResumableSub_Add_Item(this,_itementry);
rsub.resume(ba, null);
}
The string to string does not mean anything but _add_item??

This only happen when I compile with #R8 option (probably something I did wrong years ago coming back to haunt me)

not sure how to debug (i was crashing somewhere else) until I recompiled this library with #r8 options. (not sure if this helps)

Final note this is code that has been running file (not saying it isn't my error - just how to shoot these is a problem
 

Peter Simpson

Expert
Licensed User
Longtime User
Hmm, you can try adding this to the manifest file.

I would personally go with this line.
B4X:
AddProguardText(
-keep class com.BOBs.BOBsCommon.cdropdown { *; }
)

Or maybe even this.
B4X:
AddProguardText(
  -keep class com.BOBs.BOBsCommon.** { *; }
)

I doubt any of the lines above will fix your issue though...
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
no. didn't help.

I believe the routine below is where it is happening

if (BA.isShellModeRuntimeCheck(ba))
this.getClass().getMethod("_class_globals", com.BOBs.BBS.cdropdown.class).invoke(this, new Object[] {null});
else

Whole Return:
public class cdropdown extends B4AClass.ImplB4AClass implements BA.SubDelegator{
    private static java.util.HashMap<String, java.lang.reflect.Method> htSubs;
    private void innerInitialize(BA _ba) throws Exception {
        if (ba == null) {
            ba = new BA(_ba, this, htSubs, "com.BOBs.BBS.cdropdown");
            if (htSubs == null) {
                ba.loadHtSubs(this.getClass());
                htSubs = ba.htSubs;
            }
            
        }
        if (BA.isShellModeRuntimeCheck(ba))
               this.getClass().getMethod("_class_globals", com.BOBs.BBS.cdropdown.class).invoke(this, new Object[] {null});
        else
            ba.raiseEvent2(null, true, "class_globals", false);
    }
 
Upvote 0
Top