Java Question Resource not found

Informatix

Expert
Licensed User
Longtime User
I'm trying to wrap the Vitamio library v3 and it's a bit complicated. I solved already many problems but I'm stuck on a problem with a resource. The library contains a file named libarm.so which is in fact a 7z file containing many .so files. The library want to load this file (which is located among its resources) to uncompress it and choose the right .so for the device. But that fails with the message:
android.content.res.Resources$NotFoundException: Resource ID #0x7f040000
at android.content.res.Resources.getValue(Resources.java:892)
at android.content.res.Resources.openRawResource(Resources.java:817)
at io.vov.vitamio.Vitamio.copyCompressedLib(Vitamio.java:204)

How can I go further? I usually stay away from resources (or I let B4A handle them), so I don't know how they must be packed in the jar.
 

warwound

Expert
Licensed User
Longtime User
I have a wrapped and working version of the newer Vitamio library - created November last year so that makes it the version 3 that you are trying to wrap i think?

I never got around to uploading the library to the forum, though a few forum members have a copy.
I see a version 4 was promised on 21st March but has yet to materialise, maybe i'll try and wrap that too when it is available.

I'll send you a PM with a link to my version - if you're interested in how i worked around all the Vitamio resources i can let you have a copy of the Eclipse project.

Martin.
 

warwound

Expert
Licensed User
Longtime User
It is possible to embed some resources in a library jar file.

OSMDroid has a few PNG images embedded in it for example.
Take a look at the getBitmap() method of it's DefaultResourceProxyImpl class: DefaultResourceProxyImpl.java - osmdroid - OpenStreetMap-Tools for Android - Google Project Hosting
Lines 104 to 131 show how it uses the ClassLoader getResourceAsStream() method to do so.

As far as i know you cannot embed android resources such as XML layout files into a library jar file.

Though you can embed an XML file that is not an android resource in a library jar file - the MapsForge InternalRenderTheme class does this.

Martin.
 
Top