问题
My aim is to be able to distribute the android library application only as binary(WITHOUT SOURCE) to other developers. So that they can make their own apps with it.
I am developing two android applications. The first one is library application should act as a kind of SDK. The second one application should use the library application and make the original app.
I am using android studio to develop the applications. I have completed the implementations of the library application and generated the .aar.
Now I am using my own SDK(.aar) to build the second application. I can use the .aar in my second application.
The problem is that, android studio can decompile my SDK(.aar). But I don't want to share the source code.
Note: My librarySDK doesn't contain any UI elements such as Activity, Resources.
Is there any way to create the SDK(.aar) without source code?
回答1:
yup for that you need to use proguard when you build SDK/Library aar file
Change minifyEnabled
to true
in your SDK/Library gradle
buildTypes {
release {
minifyEnabled true //enable proguard
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
Enabling ProGuard in Eclipse for Android
来源:https://stackoverflow.com/questions/35055002/android-need-a-way-to-create-the-library-aar-file-without-source-code