Java Question Library wrapper with aar file

walterf25

Expert
Licensed User
Longtime User
Hi all, i'am creating a library for a gps satellite device which communicates with my tablet via bluetooth (BLE). The company who creates this devices has just sent me a new file which is an .aar file.

Upon doing some reading here on the forums and other outside forums, i have extracted the classes.jar file, renamed it to a different name, and included it this jar file into my eclipse project, I'am also referencing the jar file with the following.
B4X:
@DependsOn(values = { "RockStar_1.2.1" })
the library compiles just fine, it generates the jar and xml files, i have copied both of these files into my additional libraries folder in B4A and i have also copied the original .aar file into the same folder.

The problem is that i get an error, which from what i understand is telling me that it can't find a class.

this is the error i get.

java.lang.NoSuchFieldError: No static field bF of type I in class Luk/rock7/connect/R$string; or its superclasses (declaration of 'uk.rock7.connect.R$string' appears in /data/app/nmfs.industry-2/base.apk)
at uk.rock7.connect.device.R7GenericDevice.<init>(Unknown Source)
at ey.a(Unknown Source)
at uk.rock7.connect.ConnectComms.a(Unknown Source)
at uk.rock7.connect.ConnectComms.z(Unknown Source)
at uk.rock7.connect.ConnectComms.a(Unknown Source)
at uk.rock7.connect.ConnectComms.a(Unknown Source)
at eq.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6914)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
FATAL EXCEPTION: main
Process: nmfs.industry, PID: 23735
java.lang.NoSuchFieldError: No static field bF of type I in class Luk/rock7/connect/R$string; or its superclasses (declaration of 'uk.rock7.connect.R$string' appears in /data/app/nmfs.industry-2/base.apk)
at uk.rock7.connect.device.R7GenericDevice.<init>(Unknown Source)
at ey.a(Unknown Source)
at uk.rock7.connect.ConnectComms.a(Unknown Source)
at uk.rock7.connect.ConnectComms.z(Unknown Source)
at uk.rock7.connect.ConnectComms.a(Unknown Source)
at uk.rock7.connect.ConnectComms.a(Unknown Source)
at eq.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6914)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

From what i have read here in the forums, B4A is supposed to extract the resource folders automatically from the .aar file.

What would the steps be to confirm that in fact this is happening, does anyone have any ideas as to why i'm getting this error, and how to fix this?

Thanks,
Walter
 

walterf25

Expert
Licensed User
Longtime User
You don't need to extract it. You can reference the aar file directly with :

@DependsOn (values= {"YourAAR.aar"})
Thank you Erel, i actually solved the issue, it turns out they had forgotten to Exclude the R file from ProGuard, so strings were being updated to point to obfuscated classes.

They sent me an updated .aar file and all works good now.

Regards,
Walter
 
Top