Android - Need a way to create the library(.aar file) without source code

你。 提交于 2019-12-21 18:17:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!