我遇到了S Pen SDK v2.3和ProGuard v4.9的问题,其中非签名APK允许我使用整个画布/注释,而签名的APK则只允许我访问部分注释 - 注意的一半,虽然可见,但不允许我写。
我和proguard配置很多,但我没有运气。我尝试使用简单的S Pen项目创建一个签名的APK,我可以按预期工作。但是,我的包中必须有一些东西阻止我完全访问该笔记。
这是我的proguard.cfg:
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-dontwarn com.google.common.**
-dontwarn org.apache.commons.*
-dontwarn org.scribe.services.*
-dontwarn com.fasterxml.jackson.databind.**
#after updating Android Support Library to rev.18
-dontwarn android.support.v4.**
# Activities, services and broadcast receivers are specified in the manifest file so they won't be automatically included
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keep public class com.crittercism.**
# Hold onto the mapping.text file, it can be used to unobfuscate stack traces in the developer console using the retrace tool
-printmapping mapping.txt
-keep public class * extends android.support.v4.app.Fragment {
*;
}
-keep public class * extends android.widget.FrameLayout {
*;
}
-keep public class * extends android.view.View {
*;
}
-keep public class com.mypackage.fragments.VideoNoteFragment {
public protected *;
}
-keep public class com.mypackage.ui.NotesView {
public protected *;
}
#suggestions from SPen Engineering team
-keep public interface *$* {
public *;
}
#for SPen
-keep public class com.samsung.spensdk.* {
public protected *;
}
-keep public class com.samsung.spensdk.applistener.* {
public protected *;
}
-keep public class com.samsung.samm.common.* {
public protected *;
}
-keep public class com.samsung.spen.lib.image.* {
public protected *;
}
-keep public class com.samsung.spen.lib.input.* {
public protected *;
}
-keep public class com.samsung.spen.lib.gesture.* {
public protected *;
}
-keep public class com.samsung.spen.settings.* {
public protected *;
}
# Also keep - Enumerations. Keep the special static methods that
# are required in enumeration classes.
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
# Keep names - Native method names. Keep all native class/method names.
-keepclasseswithmembers,allowshrinking class * {
native <methods>;
}
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
# Custom view components might be accessed from your layout files
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
# event handlers can be specified in the layout files e.g. android:onClick="nextButton_onClick"
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers public class com.crittercism.* {
*;
}
-keepclassmembers public class com.fasterxml.jackson.** {
*;
}
#pojo
-keep class com.mypackage.data.** {
void set*(***);
void set*(int, ***);
boolean is*();
boolean is*(int);
*** get*();
*** get*(int);
}
-renamesourcefileattribute SourceFile
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
以下是画布的截图,其中右半部分是不可写的:
谢谢!
答案 0 :(得分:0)
简化为修改proguard设置,如下所示:
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
#prints out which classes exactly will be preserved, so we know for sure we're getting what we want
-printseeds
-dontwarn com.google.common.**
-dontwarn org.apache.commons.*
-dontwarn com.samsung.**
-dontwarn org.scribe.services.*
-dontwarn com.fasterxml.jackson.databind.**
# Activities, services and broadcast receivers are specified in the manifest file so they won't be automatically included
-keep public class com.android.vending.licensing.ILicensingService
-keep public class com.crittercism.**
# Hold onto the mapping.text file, it can be used to unobfuscate stack traces in the developer console using the retrace tool
-printmapping mapping.txt
# Also keep - Enumerations. Keep the special static methods that
# are required in enumeration classes.
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
# event handlers can be specified in the layout files e.g. android:onClick="nextButton_onClick"
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers public class com.crittercism.* {
*;
}
-keepclassmembers public class com.fasterxml.jackson.** {
*;
}
-keep class com.mypackage.data.** {
void set*(***);
void set*(int, ***);
boolean is*();
boolean is*(int);
*** get*();
*** get*(int);
}
-renamesourcefileattribute SourceFile
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,
SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
-keep class com.samsung.samm.** { *; }
-keep class com.samsung.sdraw.** { *; }
-keep class com.samsung.spen.** { *; }
-keep class com.samsung.spensdk.** { *; }
-libraryjars libs/libspen23.jar