Reputation: 1046
What is the best way to distribute android Library. I dont want the user to see my code, library has images and layout xml. Here is my understanding. Please correct if I am wrong.
So my question is that how can I distribute my library to user without giving access to my code while adding images and layout files as part of that library.
Upvotes: 2
Views: 677
Reputation: 862
Actually you can't, even if it's a jar there is a tons of tools to reverse engineer it (one of the tools)
The only thing you can do is obfuscated your code so it turns to unreadable code. Read here about proGuard with android(proGuard)
For the distribution part with res I recommend using gradle. For example Jake Wharton has a library named butterknife. He distributed it using gradle so the user could just add
compile 'com.jakewharton:butterknife:6.1.0'
in his gradle files and be good to go.
Another example with res files distrbuted in gradle is the android support libs which can be grabbed by adding:
compile "com.android.support:support-v4:18.0.+"
Upvotes: 1
Reputation: 489
Use Jar U may have to get the image file and res files through a constructor if that is null use default
Upvotes: 1