简体   繁体   中英

Does adding Android jars to a jogl or Java 3d project cause problems?

Ive rebuilt a project I once ran on an older Mac and have added the Android jars because I wanted to migrate to that in the future and test it in the project. The program executes but Swing applications, JOGL, and Java 3D programs no longer open or Render. There may be continuous processes. Will they ever execute or what is the problem.

By adding Android jars I assume you mean the Android SDK. Adding these to a Java project will break it as Java != Android. (This part has been discussed countless times in chat and questions. The JDK is not the same as the Android SDK, different bytecode, etc)

Swing doesn't exist in Android. Neither does Java3D 1 . Android either relies on the embedded OpenGL ES support, a framework (eg LibGDX), an engine (eg Unity) or something like LWJGL to access OpenGL API's. Note that Android runs OpenGL ES , which basically is a light-weight OpenGL (less API's is one difference)

JOGL does have Android support, and it looks like it's easier to convert as the API's aren't separated

In addition, android has a completely different system compared to Java. For an instance, there are Activities, the main method isn't used, there are layouts (either .xml or creating a new instance of a View object, for an instance a SurfaceView or a GLSurfaceView, but a Button would also work)

My point is, if you want to convert a desktop OpenGL project into Android, you have to re-write most of it due to major API differences.

So they will not execute unless you take steps to make it runnable on Android. And you're better off starting a new project to make sure you get all the dependencies an Android project needs (the sdk is one thing, but there's also the manifest, the gradle plugin, etc)

1: Java3D has some support for Android, but it's not a fully functional API yet

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM