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

Android support #117

Open
javagl opened this issue Jul 16, 2024 · 2 comments
Open

Android support #117

javagl opened this issue Jul 16, 2024 · 2 comments

Comments

@javagl
Copy link
Owner

javagl commented Jul 16, 2024

There have been several issues asking about Android support. I'm not nearly up to date with the latest state of Android and this "API Level" concept there. This issue is intended for tracking any changes that may be required (or helpful) when trying to get JglTF running under Android.

One project where @mikikg used JglTF in Android is https://github.com/mikikg/AndroidJgltfViewer . I never managed to take a look at the actual changes that have been done there, and how they could be re-integrated into JglTF. But it may be a starting point for someone who wants to address this, and maybe even open a dedicated PR for Android support here.

@BenManwaring
Copy link

Hi,

I've kinda started looking into this but I can't guarantee how quickly it will progress, I'm sharing here incase anyone picks it up before I progress the work any further.

I started by working out what commit I thought the code was copied from for https://github.com/mikikg/AndroidJgltfViewer, it seems to have been based upon 82bb96b.

So what I have done is made a branch of a fork of this repo with the code changes merged back in, they had been reformatted and the newline character changed but I think I got them all, it needs tidying to minimise the changes further but it is a starting point. I have also added the Android build project and relative simlinked the files into (I'm sure there is probably a better integration possible between Maven and Gradle but this works for now).

The code can be found here: BenManwaring#1

it will need updating to use the latest master from this repo and the code improving/solving the TODOs, maturing and making production ready but I hope this serves to at least expose what changes were done by https://github.com/mikikg to make an initial Android version.

All thanks goes to https://github.com/mikikg for these initial changes, I have merely moved code around.

@javagl
Copy link
Owner Author

javagl commented Aug 9, 2024

Thanks @BenManwaring

I have not yet thought about an actual strategy for this. There are certainly different approaches, and which one works "best" is hard to say beforehand. (Specifically: It would require knowledge about the Android build systems and depdendency management that I don't have - for example, I think that ~"this has to use gradle (somehow)", but I don't know anything about the details there).

If I had to tackle this now, my approach would have been roughly

  • Clone this repo
  • Copy everything from https://github.com/mikikg/AndroidJgltfViewer into an jgltf-viewer-android subproject
  • Open that subproject in ~"an Android IDE" (which involves wiring the dependencies from that project down to the parent directory...)
  • Look where the compiler is screaming, and fix these places
    • This might involve non-trivial refactorings....
  • Remove everything that is not required, and commit the result

The last step refers to the fact that there seem to be files like jgltf-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png of which I hope/think that they don't have to be tracked in Git.

And the "refactorings" refers to the fact that I think that there had been some classes used in JglTF that had not been available in Android a few years ago. (I think that something like BufferedImage did not exist back then). So it may be necessary to split some packages into jgltf-...-desktop and jgltf-...-mobile/android or so.


Again: This may not be the smartest way to do this. Maybe updating the state from your PR with the latest master from JglTF could be easier. But ... I don't know whether there have been changes made in AndroidJgltfViewer that could cause merge conflicts.

So... to summarize...:

I've kinda started looking into this but I can't guarantee how quickly it will progress

Same here....

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

2 participants