Porting a Java server to Android

I am working on a medical records system using OpenMRS as a backend for Android. OpenMRS depends on some seriously heavy libraries, including Hibernate and Spring.

"Dexing" the entire OpenMRS application generates a file that is too large even for the Android classes.dex file format (this size limit is already well documented). To get around this, I am currently working on creating multiple dex files from dependencies and loading them at runtime using the Android dex class loader.

Due to the fact that the mobile version of the server will be used in practice, the actual processing requirements will be very low, despite the huge dependencies. I am not trying to start the corporate server on my phone here.

Before I spent more than a week trying to predict this, I just wanted to ask the developer community: is this strategy just a dream? If I download all these libraries, will the whole binary file be loaded into RAM and just break the system? Is there a good way to optimize such an application? Is there some obvious problem or solution that I'm missing here?

+6
source share
1 answer

Short answer: Do not.

The long answer is that most devices still allocate a relatively small amount (between 40-128 megabytes of RAM) memory for each heap. You really need to think about the architecture of the application, so the bulk of the logic and therefore the libraries and heavy code are still on the server, and the mobile application just reads the light data (JSON?) From the server for display. Devices should really only use their own elements, such as location data, and provide an interface to a user that is consistent with the rest of the Android universe. In addition, you should look for ways to make the most of logic from your own application. If not for any other reason than to ensure safety. Android reverse engineering applications are trivial, and the more you stay on the server side, the more secure you will be.

+1
source

Source: https://habr.com/ru/post/896676/


All Articles