Java Question Issue using third party library

pdmccann

Member
Licensed User
Longtime User
I am having a hard time getting my library to work with a third party library. The 3rd party library is an android jar. I can see it is added to my library when I examine my jar but when I run I am getting "Failed resolving [myclass]; interface 7 followed by reference to external library class". I have seen some posts about adding external lib to my library jar, but it is already there in libs folder. I have also seen "no content provider found for permission revoke." Any help would be appreciated.

Stack trace:
button clicked
exception on create reader: java.lang.NoClassDefFoundError: IDTech.MSR.uniMag.uniMagReaderHelper
at IDTech.MSR.uniMag.uniMagReader.<init>(uniMagReader.java:18)
at com.dsi.b4a.epay.ClientAction.createReader(ClientAction.java:75)
at KCSoft.TestLayout.main._button1_click(main.java:313)
at java.lang.reflect.Method.invokeNative(Native Method)


It almost looks like B4A finds the uniMagReader in the external jar, but cannot find the uniMagReaderHelper which is inside the jar.
 
Last edited:

warwound

Expert
Licensed User
Longtime User
This has been discussed before: http://www.b4x.com/forum/libraries-developers-questions/17767-referncing-wrapped-libs.html

Getting Eclipse to build your library jar and include an external jar in the built library jar is not straightforward.
I always check to see if the external library source code (.java files) is available, if the source is available then i add that to my library project instead of the external jar.
I can now ensure my library jar is compiled and contains the wrapped library.

Martin.
 

pdmccann

Member
Licensed User
Longtime User
You can use @DependsOn annotation to reference the other jar instead of including it inside your jar file, though there is no problem with packaging everything together.

Are you sure that your class is included in the jar file correctly?

This is a duplicate, I posted under "referencing wrapped libs" by mistake

Thanks for the response.

One thing occurred to me: the IDTech library is an android library, but the lib I am building was (as per docs) just an Android project. Could this be relevant?

I have the jar for IDTuniMagSDKAndroid in AdditionalLibs
I did use the deponds on as
@DependsOn(values = { "IDTuniMagSDKAndroid" })

I was using TestLayout as client, my library class is com.dsi.b4a.epay.Client action.

Logcat shows:

I/dalvikvm(11003): Turning on JNI app bug workarounds for target SDK version 4...
I/ActivityManager( 356): Start proc KCSoft.TestLayout for activity KCSoft.TestLayout/.main: pid=11003 uid=10077 gids={3003, 1015, 1028}
I/dalvikvm(11003): Failed resolving Lcom/dsi/b4a/epay/ClientAction; interface 7 'LIDTech/MSR/uniMag/uniMagReaderMsg;'
W/dalvikvm(11003): Link of class 'Lcom/dsi/b4a/epay/ClientAction;' failed
I/dalvikvm(11003): Failed resolving Lcom/dsi/b4a/epay/ClientAction; interface 7 'LIDTech/MSR/uniMag/uniMagReaderMsg;'
W/dalvikvm(11003): Link of class 'Lcom/dsi/b4a/epay/ClientAction;' failed
I/dalvikvm(11003): Failed resolving Lcom/dsi/b4a/epay/ClientAction; interface 7 'LIDTech/MSR/uniMag/uniMagReaderMsg;'
W/dalvikvm(11003): Link of class 'Lcom/dsi/b4a/epay/ClientAction;' failed
I/dalvikvm(11003): Could not find method com.dsi.b4a.epay.ClientAction.initialize, referenced from method KCSoft.TestLayout.main._activity_create
W/dalvikvm(11003): VFY: unable to resolve virtual method 1644: Lcom/dsi/b4a/epay/ClientAction;.initialize (Lanywheresoftware/b4a/BA;Ljava/lang/StringLjava/lang/String;
D/dalvikvm(11003): VFY: replacing opcode 0x6e at 0x0020
I/dalvikvm(11003): Failed resolving Lcom/dsi/b4a/epay/ClientAction; interface 7 'LIDTech/MSR/uniMag/uniMagReaderMsg;'
W/dalvikvm(11003): Link of class 'Lcom/dsi/b4a/epay/ClientAction;' failed
E/dalvikvm(11003): Could not find class 'com.dsi.b4a.epay.ClientAction', referenced from method KCSoft.TestLayout.main._globals
 
Last edited:
Top