Java Question R.txt file missing when include an external jar with its own activity

abilio486software

Member
Licensed User
When I try to call a java library function, at runtime I get this error:

"Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mypos.slavesdk.R$layout" on path: DexPathList[[zip file "/data/app/b4a.example-OuVR1rV5D6tcq-douDcfTQ==/base.apk"],nativeLibraryDirectories=[/data/app/b4a.example-OuVR1rV5D6tcq-douDcfTQ==/lib/arm64, /system/lib64, /vendor/lib64]]"

Library is trying to open its own connection activity.

.jar library was extracted from the .aar where exists the R.txt

In fact I didn't copy the R.txt file, only the res folder and the jar class.

Is this error happening because it's missing the library R.txt ?

Any strategy to bypass this error?
 

Attachments

  • slavesdk.jar.zip
    191.8 KB · Views: 169
  • AditionalRes.zip
    59.5 KB · Views: 181
  • MyPOSCombo_Test_example_with_JAR.zip
    14.4 KB · Views: 177
  • original_slavesdk_release_aar.zip
    393.1 KB · Views: 176

DonManfred

Expert
Licensed User
Longtime User
Can you post a link to the original lib (maybe where one can found a example in java)?
 

DonManfred

Expert
Licensed User
Longtime User
Is this error happening because it's missing the library R.txt ?
It is because you are only referencing the classes.jar which is a mistake. The classes.jar is only needed when buiding a library with java.

In b4a you should always reference the original aar.
 

abilio486software

Member
Licensed User
It is because you are only referencing the classes.jar which is a mistake. The classes.jar is only needed when buiding a library with java.

In b4a you should always reference the original aar.

Ok, But when I use the .aar, I get this error.

Inside the .aar, two lines from the res "values.xml" causes the error.

What could be missing?
 

Attachments

  • error_when_compiling.png
    error_when_compiling.png
    35.6 KB · Views: 195
  • example_with_aar.zip
    10.3 KB · Views: 184
  • original_slavesdk_release_aar.zip
    393.1 KB · Views: 172

abilio486software

Member
Licensed User
Ok, But when I use the .aar, I get this error.

Inside the .aar, two lines from the res "values.xml" causes the error.

What could be missing?


Hi,

I have builded from scratch an Android studio project and when I include the .aar library I get the same error.

I will talk with MyPOS Delvelopment team.

It seems that this is not related with B4A but an error inside the .aar library.

Thanks
 

Attachments

  • error_AndroidStudio.png
    error_AndroidStudio.png
    82.7 KB · Views: 201
Last edited:

abilio486software

Member
Licensed User
Solved!

Missing resources requested from .aar library quickly solved with adicion of:

compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:gridlayout-v7:25.0.1'
compile 'com.android.support:cardview-v7:25.0.1'

Many thanks!
Abilio
 
Top