HalBuilder / halbuilder-core

HalBuilder Core
38 stars 26 forks source link

Dalvikvm: Could not find method java.beans.Introspector.getBeanInfo #29

Closed sebastianmacarescu closed 8 years ago

sebastianmacarescu commented 8 years ago

On Android 4.4 the library does not work, it crashes with the following trace error:

02-12 15:05:59.842 14367-15000/ro.assist.bookingbugandroid I/dalvikvm: Could not find method java.beans.Introspector.getBeanInfo, referenced from method com.theoryinpractise.halbuilder.impl.representations.MutableRepresentation.withBean 02-12 15:05:59.842 14367-15000/ro.assist.bookingbugandroid W/dalvikvm: VFY: unable to resolve static method 46929: Ljava/beans/Introspector;.getBeanInfo (Ljava/lang/Class;)Ljava/beans/BeanInfo; 02-12 15:05:59.842 14367-15000/ro.assist.bookingbugandroid D/dalvikvm: VFY: replacing opcode 0x71 at 0x0004 02-12 15:05:59.852 14367-15000/ro.assist.bookingbugandroid W/dalvikvm: VFY: unable to resolve exception class 5409 (Ljava/beans/IntrospectionException;) 02-12 15:05:59.852 14367-15000/ro.assist.bookingbugandroid W/dalvikvm: VFY: unable to find exception handler at addr 0x33 02-12 15:05:59.852 14367-15000/ro.assist.bookingbugandroid W/dalvikvm: VFY: rejected Lcom/theoryinpractise/halbuilder/impl/representations/MutableRepresentation;.withBean (Ljava/lang/Object;)Lcom/theoryinpractise/halbuilder/api/Representation; 02-12 15:05:59.852 14367-15000/ro.assist.bookingbugandroid W/dalvikvm: VFY: rejecting opcode 0x0d at 0x0033 02-12 15:05:59.852 14367-15000/ro.assist.bookingbugandroid W/dalvikvm: VFY: rejected Lcom/theoryinpractise/halbuilder/impl/representations/MutableRepresentation;.withBean (Ljava/lang/Object;)Lcom/theoryinpractise/halbuilder/api/Representation; 02-12 15:05:59.852 14367-15000/ro.assist.bookingbugandroid W/dalvikvm: Verifier rejected class Lcom/theoryinpractise/halbuilder/impl/representations/MutableRepresentation; 02-12 15:05:59.862 14367-15000/ro.assist.bookingbugandroid W/dalvikvm: threadid=11: thread exiting with uncaught exception (group=0x41c96d58) 02-12 15:05:59.952 14367-15000/ro.assist.bookingbugandroid E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1 Process: ro.assist.bookingbugandroid, PID: 14367 java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841) Caused by: java.lang.VerifyError: com/theoryinpractise/halbuilder/impl/representations/MutableRepresentation at helpers.hal_addon.CustomJsonRepresentationReader.readResource(CustomJsonRepresentationReader.java:51) at helpers.hal_addon.CustomJsonRepresentationReader.read(CustomJsonRepresentationReader.java:44) at com.theoryinpractise.halbuilder.DefaultRepresentationFactory.readRepresentation(DefaultRepresentationFactory.java:96) at bookingbugAPI.services.HttpService.callApi(HttpService.java:198) at bookingbugAPI.services.HttpService.callApi(HttpService.java:135) at bookingbugAPI.services.HttpService.api_POST(HttpService.java:103) at bookingbugAPI.models.BBRoot.auth(BBRoot.java:69) at ro.assist.bookingbugandroid.data.tasks.AdminLogin.doInBackground(AdminLogin.java:59) at ro.assist.bookingbugandroid.data.tasks.AdminLogin.doInBackground(AdminLogin.java:14) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)  at java.lang.Thread.run(Thread.java:841) 

sebastianmacarescu commented 8 years ago

openbeans may be a replacement

talios commented 8 years ago

Just noticed this ticket - sorry I should have noticed sooner. Whats openbeans? The current develop branch is now all JDK8 based, so any change will need to be a backport/support branch.

I'll think about a cleanish way to try extract the use of getBeanInfo, or at least catch that exception and use normal reflection.

sebastianmacarescu commented 8 years ago

You can find more details about it here: https://github.com/melix/openbeans. It's a ported version of java.beans. I think you could catch that exception, as you specified, and use plain java reflection. Please let me know as the app I'm creating is unusable in android 4. Thanks

talios commented 8 years ago

@sebastianmacarescu are you able to build that feature branch and give the resulting lib a bash in your project? Basically I just ripped out the introspector/property descriptor and went with basic reflection ( and added a missing test covering it ).

talios commented 8 years ago

Just released 4.0.5 which doesn't use introspector, openbeans is unfortunately available in central to use otherwise I would have pulled it in ( altho it also pulls in A LOT of code ).