Android的Proguard的语法错误 [英] Android Proguard Syntax Error
问题描述
我试图使用ProGuard使用Android SDK混淆我的code。我在一个.pro文件得到一个语法错误。我曾尝试更新的ProGuard JAR文件,但没有任何帮助。我搜索SO,发现一个问题,但没有答案的帮助。
我已经包括控制台日志和我的proguard.cfg。我该如何解决这个问题?
我的控制台日志:
[2012-05-11 20时12分09秒 - WrtsMobile] Proguard的错误code返回1.见控制台
[2012-05-11 20点12分09秒 - WrtsMobile]错误:@C:\\用户\\ SEBAST〜1 \\应用程序数据\\本地的\\ Temp \\ android_5842287394885430823.pro(德大成范·德·bestandsnaam,volumenaam的mapnaam是onjuist)
[2012-05-11 20点14分19秒 - WrtsMobile] Proguard的错误code 1.见控制台返回
[2012-05-11 20点14分19秒 - WrtsMobile]错误:@C:\\用户\\ SEBAST〜1 \\应用程序数据\\本地的\\ Temp \\ android_5684176843163078198.pro(德大成范·德·bestandsnaam,volumenaam的mapnaam是onjuist)
[2012-05-11 20点15分47秒 - WrtsMobile] Proguard的错误code 1.见控制台返回
[2012-05-11 20点15分47秒 - WrtsMobile]错误:@C:\\用户\\ SEBAST〜1 \\应用程序数据\\本地的\\ Temp \\ android_9001247977726315753.pro(德大成范·德·bestandsnaam,volumenaam的mapnaam是onjuist)
[2012-05-11 20点16分55秒 - WrtsMobile] Proguard的错误code 1.见控制台返回
[2012-05-11 20点16分55秒 - WrtsMobile]错误:@C:\\用户\\ SEBAST〜1 \\应用程序数据\\本地的\\ Temp \\ android_3864890478425790438.pro(德大成范·德·bestandsnaam,volumenaam的mapnaam是onjuist)
[2012-05-11二十点21分14秒 - WrtsMobile] Proguard的错误code 1.见控制台返回
[2012-05-11二十点21分14秒 - WrtsMobile]错误:@C:\\用户\\ SEBAST〜1 \\应用程序数据\\本地的\\ Temp \\ android_7512228833969245252.pro(德大成范·德·bestandsnaam,volumenaam的mapnaam是onjuist)
我proguard.cfg:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dont preverify
-verbose
-optimizations!code /简化/算术!现场/ * ,!类/合并/ *-keepattributes LineNumberTable-keep公共类*扩展android.app.Activity
-keep公共类*扩展android.support.v4.app.FragmentActivity
-keep公共类*扩展android.app.Application
q若要删除调试日志:
-assumenosideeffects类android.util.Log {
公共静态*** D(...);
公共静态*** V(...);
公共静态*** W(......);
}#Maintain Java本地方法
-keepclasseswithmembernames类* {
天然的所述;方法&gt ;;
}
q若要认为是在布局XML中使用自定义组件的名称:
-keep公共类*宽android.view.View {
公众和LT; INIT>(android.content.Context);
}
-keep公共类*宽android.view.View {
公众和LT; INIT>(android.content.Context,android.util.AttributeSet);
}
-keep公共类*宽android.view.View {
公众和LT; INIT>(android.content.Context,android.util.AttributeSet,INT);
}#Maintain枚举
-keepclassmembers枚举* {
公共静态** []值();
公共静态**的valueOf(java.lang.String中);
}q若要保持parcelable类(连载 - 反序列化对象通过发送意图)
-keep类*实现android.os.Parcelable {
公共静态最终android.os.Parcelable $造物主*;
}-keepclassmembers类**。R $ * {
公共静态<领域取代;
}
由(4.8)解决了这一问题的最新版本替换Proguard的,在文件名中的@是错误的说法只是部分:看来这里
I am trying to obfuscate my code using Proguard using the Android SDK. I'm getting a syntax error on a .pro file. I have tried to update the proguard jar files but nothing helped. I searched SO and found a question but none of the answers helped.
I have included the Console log and my proguard.cfg. How do I fix this problem?
My console log:
[2012-05-11 20:12:09 - WrtsMobile] Proguard returned with error code 1. See console
[2012-05-11 20:12:09 - WrtsMobile] Error: @C:\Users\SEBAST~1\AppData\Local\Temp\android_5842287394885430823.pro (De syntaxis van de bestandsnaam, mapnaam of volumenaam is onjuist)
[2012-05-11 20:14:19 - WrtsMobile] Proguard returned with error code 1. See console
[2012-05-11 20:14:19 - WrtsMobile] Error: @C:\Users\SEBAST~1\AppData\Local\Temp\android_5684176843163078198.pro (De syntaxis van de bestandsnaam, mapnaam of volumenaam is onjuist)
[2012-05-11 20:15:47 - WrtsMobile] Proguard returned with error code 1. See console
[2012-05-11 20:15:47 - WrtsMobile] Error: @C:\Users\SEBAST~1\AppData\Local\Temp\android_9001247977726315753.pro (De syntaxis van de bestandsnaam, mapnaam of volumenaam is onjuist)
[2012-05-11 20:16:55 - WrtsMobile] Proguard returned with error code 1. See console
[2012-05-11 20:16:55 - WrtsMobile] Error: @C:\Users\SEBAST~1\AppData\Local\Temp\android_3864890478425790438.pro (De syntaxis van de bestandsnaam, mapnaam of volumenaam is onjuist)
[2012-05-11 20:21:14 - WrtsMobile] Proguard returned with error code 1. See console
[2012-05-11 20:21:14 - WrtsMobile] Error: @C:\Users\SEBAST~1\AppData\Local\Temp\android_7512228833969245252.pro (De syntaxis van de bestandsnaam, mapnaam of volumenaam is onjuist)
My proguard.cfg:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keepattributes LineNumberTable
-keep public class * extends android.app.Activity
-keep public class * extends android.support.v4.app.FragmentActivity
-keep public class * extends android.app.Application
#To remove debug logs:
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
public static *** w(...);
}
#Maintain java native methods
-keepclasseswithmembernames class * {
native <methods>;
}
#To maintain custom components names that are used on layouts XML:
-keep public class * extends android.view.View {
public <init>(android.content.Context);
}
-keep public class * extends android.view.View {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keep public class * extends android.view.View {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
#Maintain enums
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
#To keep parcelable classes (to serialize - deserialize objects to sent through Intents)
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
-keepclassmembers class **.R$* {
public static <fields>;
}
Replacing Proguard by the latest version (4.8) fixed the problem, the @ in the filename is just part of the error saying: "It appeared here"
这篇关于Android的Proguard的语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!