Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using on Android #5

Open
DsVortex opened this issue Apr 1, 2017 · 11 comments
Open

Using on Android #5

DsVortex opened this issue Apr 1, 2017 · 11 comments

Comments

@DsVortex
Copy link

DsVortex commented Apr 1, 2017

Hi when loading the library on android i get the following error.

Caused by: java.lang.ClassNotFoundException: Didn't find class "java.nio.file.Paths"

When i do this call.

        Importer importer = new Importer();
        AiScene scene = importer.readFile(new URI(path), 1 | 8);
@elect86
Copy link
Collaborator

elect86 commented Apr 5, 2017

Are you using raw or assets?

@DsVortex
Copy link
Author

DsVortex commented Apr 5, 2017

Im doing something weird and i cant remember why...

AssetFileDescriptor assetFileDescriptor = assetManager.openFd("cube.obj");
FileDescriptor fileDescriptor = assetFileDescriptor.getFileDescriptor();
FileInputStream raw = new FileInputStream(fileDescriptor);
final File tempFile = File.createTempFile("cube", ".obj");
tempFile.deleteOnExit();
try (FileOutputStream out = new FileOutputStream(tempFile)) {
      IOUtils.copy(raw, out);
}

Model plain = new Model(tempFile.getAbsolutePath(), false);

Model just calls

Importer importer = new Importer();
AiScene scene = importer.readFile(new URI(path), 1 | 8);

@elect86
Copy link
Collaborator

elect86 commented Apr 6, 2017

Try this

@DsVortex
Copy link
Author

DsVortex commented Apr 10, 2017

This Importer importer = new Importer().readFile(); doesnt support an input stream...

@elect86
Copy link
Collaborator

elect86 commented May 2, 2017

So, apparently there are some classes, such as java.nio.files.*, that are not present on Android..

I am investigating for a solution...

Would you prefer loading your meshes from your res or assets folder?

@DsVortex
Copy link
Author

DsVortex commented May 2, 2017

Yea its a pain at times.
Either, currently I'm trying use assets folder but either are fine.

@elect86
Copy link
Collaborator

elect86 commented May 2, 2017

Ok, I am evaluating to make a branch for Android.

In the meanwhile, could you confirm me that the lenght you get on the files loaded from assets it's not UNKNOWN for you? If you test one of your assets file length, do you get the right size?

For reference

@elect86
Copy link
Collaborator

elect86 commented May 8, 2017

An update, I am planning to pass the AssetManager (retrievable via getAssets() from within the activity) to the readFile together with the path of the main file in order for assimp to read additional adjacent files. Is this compatible with your app?

@DsVortex
Copy link
Author

DsVortex commented May 8, 2017

You do as you see fit, I will modify my app to sit in with your changes. :-)

@kurtzmarc
Copy link

Has there been a solution for this? We are using assimp-all.jar and are getting the Didn't find class "java.nio.file.Paths" error also. I don't see any AssetManager support in readFile() as of yet.

@elect86
Copy link
Collaborator

elect86 commented Nov 11, 2018

Hi, unfortunately no.

I have a lot of other things with higher priority on my todo list right now and I also lack android experience: deadly combo.

However, we are totally open for contributions: this is the majoy point of this organization :)

If you want to help push the project forward, don't hesitate :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants