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.
Related
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 ?
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?
Kindly help me out with a method by which I can hide the code of a class file in Android Studio from other developers. The other developers can access the functions but they won't be able to see the code inside of that class.
This idea comes from iOS, using a compiled static library. iOS uses a pre-compiled static library with which the developers can only access the functions and get the return values.
Reference Link for NDK static library: Use of prebuild static Library compiled with Android Toolchain
I don't want to use Android NDK for doing this, I am sure Android SDK is capable of doing this on its own.
Using jar file can be a option, but jar can't hide the code. The class files can easily be decompiled and the code will be exposed to everyone.
There is a long list of obfuscation tools for android, beginning with ProGuard which is part of the SDK.
Still, none of these achieves the level of protection you get by using a native library with NDK. But even the latter can not be completely protected from disassembling and reverse engineering. It can not be a substitute to legal protection, like patents and copyrights.
The only way to really completely hide it is to host the code in a web service. And that would probably be easier than learning NDK coding, though it obviously has other drawbacks.
I've been searching for info about it on the internet but I haven't found anything.
The point is that I want to transform my library for android, which I'm using for advertising, into an sdk to make it available for other developers.
My library is mainly an extension of the Application class and I don't know if this should be the way an sdk is made, mainly because it seems weird to me that a .jar extends the Application class.
So, I'm asking for some advices/tips/guidelines or whatever you could tell me in order to build an sdk.
I'm working on a server backend component for an app, and one goal is to log all the messages transmitted through the app (using MQTT). To do this, I wanted to use the app as a library of sorts so that I could use the objects defined within to parse the messages coming through, since none of the messages will be transmitted as standard types. I'm using IntelliJ for the Java development, and Android Studio for the Android development. Is this possible? I was previously able to import the code as a module, which let me use the types defined within, but when I went to build the project it tried to build the Android code as well and failed because IntelliJ hadn't set up Android dependencies. Should I try and set the Android SDK as a dependency in the app module, and then build? Or am I approaching this the wrong way? (if it's even possible) I understand that there are also Library projects which looks like a possible solution, it would just require re-factoring all the applicable code out to a different project and I was hoping that wouldn't be necessary.
Trying to import the entire Android app as a library into a different codebase probably isn't going to work; you don't want a non-Android app to have all that Android code linked in, and with resources and the whole environment it will be tough to get it to compile at all.
A better approach would be to take all of the code that needs to work cross-platform and distill it into a plain Java library that you can include in multiple contexts. On the Android side you could include it as a plain Java library project, or compile it to a jar and include the jar.