Android Question [SOLVED] LoadLayout fails after set targetSdkVersion="29"

giggetto71

Active Member
Licensed User
Hi,
guys. I need some help here.
I have a market APP that stopped working after I set the SDK target version to 29.

The line 380 where the code crashes (see below) is simply a call to the LoadLayout for my layout.
All I did was to set 29 here:

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="29"/>
Of course I also se the path for the android jar to the new platform 29.:

C:\Android\platforms\android-29\android.jar


if I set it back the manifest to 28
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="28"/>
even leaving the platform jar path to 29, it works fine.
Please help...
THANKS!!


Error occurred on line: 380 (Main)
java.lang.NoSuchFieldException: No field mColorStateList in class Landroid/graphics/drawable/GradientDrawable$GradientState; (declaration of 'android.graphics.drawable.GradientDrawable$GradientState' appears in /system/framework/framework.jar)
at java.lang.Class.getDeclaredField(Native Method)
at anywheresoftware.b4a.objects.B4XViewWrapper.getColor(B4XViewWrapper.java:388)
at b4a.example3.customlistview._designercreateview(customlistview.java:305)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:61)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at gigiosoft.MQTTAlert.main.afterFirstLayout(main.java:104)
at gigiosoft.MQTTAlert.main.access$000(main.java:17)
at gigiosoft.MQTTAlert.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8016)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
 
Last edited:

giggetto71

Active Member
Licensed User
I was able to reproduce it even in an almost empty project. The issue seems to be related to the CustomListView. In the Layout I load I have a button and a customlistview (from the xCustomListView library ver. 1.7)..
If I set the target version to 29 it crashes with the same log as my app:

java.lang.NoSuchFieldException: No field mColorStateList in class Landroid/graphics/drawable/GradientDrawable$GradientState; (declaration of 'android.graphics.drawable.GradientDrawable$GradientState' appears in /system/framework/framework.jar)

If I remove from the layout the CustomListView everything goes all right.
the sample project to reproduce the issue is attached.
 

Attachments

Top