Android Question Problem with NinePatch

Creaky

Member
Licensed User
Longtime User
Hi guys!

It's been quite a while since I worked on my apps and today I run into a problem with NinePatch in one of my apps.
This used to work fine, but after dusting off the code and trying to run it on Android 12 I get the next error:

ninepatch_setninepatchbutton (java line: 55)
java.lang.NoSuchFieldException: No field ics_button in class Ljvc/starlog/R$drawable; (declaration of 'jvc.starlog.R$drawable' appears in base.apk)
at java.lang.Class.getDeclaredField(Native Method)
at anywheresoftware.b4a.agraham.reflection.Reflection.GetStaticField(Reflection.java:371)
at jvc.starlog.ninepatch._setninepatchbutton(ninepatch.java:55)
at jvc.starlog.main._initpickscreens(main.java:2898)
at jvc.starlog.main._activity_create(main.java:753)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at jvc.starlog.main.afterFirstLayout(main.java:104)
at jvc.starlog.main.access$000(main.java:17)
at jvc.starlog.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8582)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:563)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1133)
java.lang.NoSuchFieldException: No field ics_button in class Ljvc/starlog/R$drawable; (declaration of 'jvc.starlog.R$drawable' appears in base.apk)

The Ninepatch images are in the same folder as they have always been and cleaning the project doesn't help.
Can somebody please give me a hand with this? :)
 

Creaky

Member
Licensed User
Longtime User
Here is the R.java file. I have yet to find the actual call in the code...
 

Attachments

  • R.java
    79.7 KB · Views: 125
Upvote 0

agraham

Expert
Licensed User
Longtime User
The field ics_button is definitely available in the drawable class in your R.java so I don't understand why it is not accessible by reflection. Check that you don't have an extra space or other non-printable character at the start or end of the DefaultImage or PressedImage parameter strings. Otherwise I am afraid that I have no other suggestion to make.
 
Upvote 0

Creaky

Member
Licensed User
Longtime User
Thanks Agraham, I will go through my code with a fine comb again. I must have missed something. :)
 
Upvote 0
Top