I’m trying to port an existing (and relatively large) java application to Android. The application currently uses AWT/Swing as its GUI, which I know I’ll have to replace, but my question is: can I export that existing application into a jar, and use it as a reference in my Android application? My goal is to use the backend which is still being actively developed of the program.
I’ve tried doing that by both adding the .jar to the libs directory/build path, and by adding the Eclipse project to the build path with no success. Every time I try to deploy it, I run into GC issues and NoClassDefFound errors, which ultimately cause the Eclipse workbench to run out of memory and crash.
The original application is written using the M-V-C design pattern, and I was hoping to include the model & controller, and just replace the view. What would be the best way to tackle this problem?
Thanks in advance!
If the application is well architectured, I would get rid of the View components, and keep only controller and model classes. It should then compile on the standard JDK (as in MVC, C and M should not depend on V).
Once that is done, create a new empty Android project, mark it as an Android library, and put your source code into the src folder.
Project should get compiled and you should be able to see which classes are missing and require some porting.
If your project is using reflection on external classes, try to see which classes are used and check they belong to the Android SDK.
If you are using external jars, make sure those jars are compatible with Android too.