Closed minichouilleur closed 1 year ago
Hello @minichouilleur,
I am preparing a new version and would like to solve your issue.
Can you share your proguard file please ?
I tried to reproduce your issue but my default proguard file does not create any issue when building the project and running it.
Thanks
Hi @ben-j69,
Sorry for the late answer.
Here is the proguard file of my project :
-assumenosideeffects class android.util.Log {
public static boolean isLoggable(java.lang.String, int);
public static int v(...);
public static int d(...);
public static int i(...);
public static int w(...);
public static int e(...);
}
-repackageclasses news
-keep class com.*.*.domain.model.** { *; }
-keep class com.*.*.data.remote.model.** { *; }
-keep class com.*.*.ui.model.** { *; }
-keep class com.*.*.extensions.AnalyticHelper
##---------------Begin: proguard configuration for FollowApps ----------
-keep class com.followanalytics.** { *; }
-keep interface com.followapps.android.** { *; }
-keep class me.leolin.shortcutbadger.impl.** { <init>(...); }
##---------------End: proguard configuration for FollowApps ----------
## Used to keep attributes used by hidden secrets lib
-keepattributes SourceFile,LineNumberTable
## Keep native method "System.loadLibrary("secrets")" used by hidden secrets lib
-keepclasseswithmembernames,includedescriptorclasses class * {
native <methods>;
}
## Used to avoid error shown in my previous comment
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
##---------------Begin: proguard configuration for Gson ----------
-keepattributes *Annotation*
-dontwarn sun.misc.**
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
##---------------End: proguard configuration for Gson ----------
Do not hesitate to ask me for other information if necessary.
Have a nice day.
Thanks.
Hello @minichouilleur ,
I have created a new Android app, included Hidden Secret and your proguard file but I had not issue while building. Did you find a way to fix it ?
Hello @ben-j69,
I'm sorry for the answer delay. Have you tried to remove this proguard rule from the file I send you before ?
## Used to avoid error shown in my previous comment
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
This is the proguard rule we must add to our project to make hidden-secrets-gardle-plugin works. But we want to avoid adding it.
For information, we are using proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
Thanks.
Hello @minichouilleur ,
Sorry but I did not succeed to reproduce your error.
In more there is no Enum in the Hidden Secret code. If you have any other idea feel free to share it.
Thanks.
@minichouilleur are you sure it's due to proguard? I am getting the first error when I use underscores in key names. Check this: https://github.com/klaxit/hidden-secrets-gradle-plugin/issues/72
Hi,
I encounter some conflict between the hidden-secrets-gardle-plugin and proguard obfuscation. I have meet two errors after proguard obfuscation, first is :
This error is due to the native method System.loadLibrary() which is obfuscated.
This error can be fixed by adding this proguard rule :
As it is said by the Proguard documentation (https://www.guardsquare.com/en/products/proguard/manual/examples) :
The second error is :
It seems that an enum class is obfuscated and can't be accessed at runtime.
This proguard rule avoid this error :
The problem with this rule, is that it keeps all enum class of the project deobfuscated.
It seems that the enum class that causes this error is one from hidden-secrets-gradle-plugin or one used by it. Because when I remove the plugin, this error disappear.
I would like to identify which enum class causes this problem to avoid the deobfuscation of all my project enum class.
Do you ever encounter this problem ? And do you have an idea of which enum class causes this problem ?
Thank you