android - Proguard with AAR library issue -


i have android library 1 class , want make .aar library. when set minifyenabled true, android project cannot use library (it fine if minifyenabled set false). ask correct configuration of proguard aar library

helloworld.java

package com.example.hello;  import android.util.log;  public class helloworld {     public static void hello(){         log.v("helloworld","hello world!");     } } 

build.grandle

apply plugin: 'com.android.library'  android {     compilesdkversion 24     buildtoolsversion "24.0.0"      defaultconfig {         minsdkversion 15         targetsdkversion 24         versioncode 1         versionname "1.0"     }     buildtypes {         release {             minifyenabled true             proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'         }     } }  dependencies {     compile filetree(dir: 'libs', include: ['*.jar'])     testcompile 'junit:junit:4.12'     compile 'com.android.support:appcompat-v7:24.0.0' } 

proguard-rules.pro

-dontwarn android.support.v7.** -keep class android.support.v7.** { *; } -keep interface android.support.v7.** { *; }  -keep class com.example.hello {public *;} 

try changing last line in proguard-rules

-keep class com.example.hello.** {public *;} 

as android studio being able decompile, can't prevent that. if want protect code, suppose best can obfuscate of it, , extend desired functionality through interfaces not obfuscate adding relevant proguard rules.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -