问题
I'm developping a Samsung Gear
application with Samsung's accessory-v1.0.0.jar
.
When I try to create a signed apk (which preforms proguard steps) I get Unknown verification type [10] in stack map frame
exception, because of Samsung's SAAgent
class in accessory-v1.0.0.jar
.
I couldn't find any solutions, do you have a workaround for this?
Same problem (not answered on Samsung's forum) here.
Similar problem on Samsung's SPen SDK (this problem was solved on a later version of SPen SDK)
What I've tried so far, which didn't help me:
1) Added below proguard elements:
-keepclassmembers class com.samsung.** { *; }
-keep class com.samsung.** { *; }
-dontwarn com.samsung.**
-keepattributes InnerClasses
2) Used proguard 4.7 and 4.11.
3) Created a new Android project, added just accessory-v1.0.0.jar at its libs folder, I didn't write any code and tried to sign the apk. Same error occured.
[2014-05-22 17:13:06 - SAGalleryProguardTest] Proguard returned with error code 1. See console
[2014-05-22 17:13:06 - SAGalleryProguardTest] java.io.IOException: Can't read [C:\Devel\Workspace\SAGalleryProguardTest\libs\accessory-v1.0.0a.jar] (Can't process class [com/samsung/android/sdk/accessory/SAAgent.class] (Unknown verification type [10] in stack map frame))
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.InputReader.readInput(InputReader.java:230)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.InputReader.readInput(InputReader.java:200)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.InputReader.readInput(InputReader.java:178)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.InputReader.execute(InputReader.java:78)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.ProGuard.readInput(ProGuard.java:196)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.ProGuard.execute(ProGuard.java:78)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.ProGuard.main(ProGuard.java:492)
[2014-05-22 17:13:06 - SAGalleryProguardTest] Caused by: java.io.IOException: Can't process class [com/samsung/android/sdk/accessory/SAAgent.class] (Unknown verification type [10] in stack map frame)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.io.ClassReader.read(ClassReader.java:112)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.io.JarReader.read(JarReader.java:65)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.InputReader.readInput(InputReader.java:226)
[2014-05-22 17:13:06 - SAGalleryProguardTest] ... 6 more
[2014-05-22 17:13:06 - SAGalleryProguardTest] Caused by: java.lang.RuntimeException: Unknown verification type [10] in stack map frame
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.classfile.io.ProgramClassReader.createVerificationType(ProgramClassReader.java:890)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.classfile.io.ProgramClassReader.visitFullFrame(ProgramClassReader.java:659)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.classfile.attribute.preverification.FullFrame.accept(FullFrame.java:114)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.classfile.io.ProgramClassReader.visitStackMapTableAttribute(ProgramClassReader.java:452)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.classfile.attribute.preverification.StackMapTableAttribute.accept(StackMapTableAttribute.java:71)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.classfile.io.ProgramClassReader.visitCodeAttribute(ProgramClassReader.java:422)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.classfile.attribute.CodeAttribute.accept(CodeAttribute.java:101)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.classfile.io.ProgramClassReader.visitProgramMethod(ProgramClassReader.java:200)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.classfile.io.ProgramClassReader.visitProgramClass(ProgramClassReader.java:142)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.classfile.ProgramClass.accept(ProgramClass.java:346)
[2014-05-22 17:13:06 - SAGalleryProguardTest] at proguard.io.ClassReader.read(ClassReader.java:91)
[2014-05-22 17:13:06 - SAGalleryProguardTest] ... 11 more
回答1:
I don't think there is anything you can put in your ProGuard config that will fix this. It is an issue with the accessory-v1.0.0.jar
built by Samsung and they will have to fix it in an SDK update.
I've followed the steps set out here (http://sourceforge.net/p/proguard/bugs/420/) to build a proguard.jar
library (based on v.4.11) that will ignore this error. Exporting a signed release apk built with ProGuard then finishes successfully.
I'm also using these config settings:
-keep class com.samsung.** { *; }
-keep class * extends com.samsung.** { *; }
The proguard.jar I built is available here: http://www.codingcaveman.com/download/proguard.jar
You can drop it in your AndroidSDK\tools\proguard\lib
folder, but make a copy of the original - you should probably not use it for other projects. Better yet, modify your proguard.config
path in project.properties
to point to a different path than the normal progaurd library.
Disclaimer: This is a temporary workaround, not a fix - use at your own risk. Samsung should provide a proper fix in an updated SDK. That being said, I've not found any issues in my own testing.
UPDATE: This is no longer an issue with the Samsung Accessory SDK v2.0.19
来源:https://stackoverflow.com/questions/23810219/proguard-error-on-saagent-class