Can you use any Java library with an android app? - java

For example, if I wanted to use EasyModbusJava with my android app, would it be as simple as adding the jar file as a library dependency or are there certain restrictions on libraries?

Related

Calling 3rd party native library in your own android app

Is it possible to write code for native libraries you do not have the source code for in your own android app?
For example - RarLab's android app comes with a native library librarlab_rar.so for at least 4 different platforms.
Assuming that I'm doing this for experimental and copyright isn't an issue and I don't plan to distribute the app externally, is it possible to compile a Java/Kotlin android-based app with only including the native binary in android development tools such as Android Studio or Eclipse?
You would need to disassemble the binary .so file and work out the API yourself. This process is called reverse engineering.
See: How do I reverse engineer .so files found in android APKs? for ideas on how to accomplish the task.
Once you've figured out how to call into the .so file, you can then write your own version of the API which you can then call from Java/Kotlin.
Any lib….so file that you put under jniLibs/$(ABI) folder in your app will automatically get packed to APK and unpacked to the device (provided the ABI matches). You may need to write your own Java wrapper for the libraries, or to reuse the Java classes that you need from the same app.

Using module feature as installable library

Actually, my app features are split into android library and I choose the feature I want include at the compile time. Is it possible to have a default app with very basic features, and an on-demand installable feature shipped as APK ?
I thought I could use module feature which was made for instant app because they are like android library but can generated APK but when I tried it out, the package name was different so it was impossible to use it.
I know it's the proper way to use android feature but can I use my own tricky way ? Otherwise, is there other possibilities to achieve this ?

How to package a closed-source AAR library with stub java files

I'm using Android Studio 2.3 to create a hardware interface library that we can distribute to partners. I would like the inner workings of the library to be closed-source, but provide documented 'stub' classes and methods that can be viewed in Android Studio.
I tried compiling my library and importing the AAR to another project, and Android Studio lets me use the classes correctly, but it doesn't show any java files or documentation in the new project.
Is there a standard practice for how to achieve this? I'm just moving into Android development from C, so I'm used to being able to provide header files with my libraries. It seems like there should be a way to achieve something similar without too much hacking.

Using strings.xml w/o Android

I am planning to separate a variety of functions between a java library project and an android application project.
One thing I liked for Android was how it handled strings: all string values were centralized within strings.xml which provided ease of localization.
I want this to be consistent with my java library (it can also be an android library as well, i'm just not planning to make any application contexts within it), SO...
Is there a way to have that application of strings.xml put on a simple java library?

need source code of libraries to run on android

I need the sourcecode for these libraries:
commons-codec-1.3
commons-httpclient-3.0.1
commons-logging-1.1
log4j-1.2.14
jaxb-ri-2.1
I need the code to recompile it in eclipse in android app and use it with javax.xml packages as you know javax.xml can not be used in eclipse in an android project.
All of this is to use the Amazon-EC2 SDK to access them from android mobile.
all of thes is to use amazon-ec2 sdk to access them from android mobile
Your list of JARs is incorrect. The current AWS Java SDK does not use log4j or jaxb, but does use other libraries.
You may better served finding another way to access the Amazon AWS API that requires fewer third-party dependencies, such as typica, or simply invoking the query API directly using HttpClient.
All of this is to use the Amazon-EC2 SDK to access them from android mobile.
AWS now provides a dedicated AWS SDK for Android developers. I would take a look at this as it may provide the functionality you need without you having to satisfy a lot of other dependencies.

Categories

Resources