0

我遇到了 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

这是画布的屏幕截图,其中右半部分不可写: 画布的右半部分不可写

谢谢!

4

1 回答 1

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
于 2013-09-03T23:48:24.057 回答