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

abilio486software

Active 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: 225
  • AditionalRes.zip
    59.5 KB · Views: 240
  • MyPOSCombo_Test_example_with_JAR.zip
    14.4 KB · Views: 246
  • original_slavesdk_release_aar.zip
    393.1 KB · Views: 251

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

Active 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: 280
  • example_with_aar.zip
    10.3 KB · Views: 257
  • original_slavesdk_release_aar.zip
    393.1 KB · Views: 235

abilio486software

Active 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: 286
Last edited:

abilio486software

Active 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