Discussion:
[osg-users] Can't access to assets in Android
Daniel Ponsoda
2018-07-11 13:40:41 UTC
Permalink
Hi everyone,

I just compiled the example project for Android (osgAndroidExampleGLES2) and can't figure out how to load osgt files I've put inside the apk (assets folder).

I'm trying to load cow.osgt using the load option that appears in the app's menu with no luck (no matter what path I give). The error message appearing in logcat is:

-----------------------------------------
E/Osg Viewer: There are 1 models to load
Loading: cow.osgt
W/Osg Viewer: Error reading file cow.osgt: file not found
E/Osg Viewer: Model not loaded
-----------------------------------------

The file is located inside the assets folder in the apk root: /assets/cow.osgt

I tried these paths when loading:
assets/cow.osgt
/assets/cow.osgt
cow.osgt
/cow.osgt

The last thing I tried after read a solution in another topic on this forum is to copy the file cow.osgt to the external sdcard and set read permissions in the manifest but still appears the same error (file not found). The path I used for this was /storage/emulated/0/cow.osgt (anyway, I don't want to use the sd card in my app)

Any ideas on why is this happening?

Thank you, in advance!

Cheers,
j

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74309#74309
michael kapelko
2018-07-12 10:12:38 UTC
Permalink
Hi.

In OpenSceneGraph cross-platform guide application I first unpacked
the resource into local drive, then accessed it the usual way.
Here's the sample:
https://github.com/OGStudio/openscenegraph-cross-platform-guide-application/blob/master/android/app/src/main/java/org/opengamestudio/osgapp/RenderActivity.java#L27
Post by Daniel Ponsoda
Hi everyone,
I just compiled the example project for Android (osgAndroidExampleGLES2) and can't figure out how to load osgt files I've put inside the apk (assets folder).
-----------------------------------------
E/Osg Viewer: There are 1 models to load
Loading: cow.osgt
W/Osg Viewer: Error reading file cow.osgt: file not found
E/Osg Viewer: Model not loaded
-----------------------------------------
The file is located inside the assets folder in the apk root: /assets/cow.osgt
assets/cow.osgt
/assets/cow.osgt
cow.osgt
/cow.osgt
The last thing I tried after read a solution in another topic on this forum is to copy the file cow.osgt to the external sdcard and set read permissions in the manifest but still appears the same error (file not found). The path I used for this was /storage/emulated/0/cow.osgt (anyway, I don't want to use the sd card in my app)
Any ideas on why is this happening?
Thank you, in advance!
Cheers,
j
------------------
http://forum.openscenegraph.org/viewtopic.php?p=74309#74309
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Loading...