java – 使用ProGuard导出Android应用程序会出现ParseException错误

前端之家收集整理的这篇文章主要介绍了java – 使用ProGuard导出Android应用程序会出现ParseException错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
使用Proguard导出 Android应用程序(通过Eclipse中的ADT)时出现以下错误.

“proguard.ParseException:期待开放'(‘或分隔符’;’在’名称’之前’”

我看到升级Proguard和sdk解决了其他ProGuard解析错误问题;然而,在所有升级之后没有运气.有谁见过这个/解决过这个问题?预先感谢您的帮助!

环境

ADT 22.0.1

Eclipse SDK 4.2.2

Android SDK 4.2,SDK Tools rev 22

Proguard v4.9

控制台日志

Proguard returned with error code 1. See console
proguard.ParseException: Expecting opening ‘(‘ or separator ‘;’ before
‘name’ in line 155 of file ‘~/project/bin/proguard.txt’,included from
argument number 4 at
proguard.ConfigurationParser.parseMemberSpecificationArguments(ConfigurationParser.java:966)
at
proguard.ConfigurationParser.parseClassSpecificationArguments(ConfigurationParser.java:729)
at
proguard.ConfigurationParser.parseKeepClassSpecificationArguments(ConfigurationParser.java:516)
at proguard.ConfigurationParser.parse(ConfigurationParser.java:165) at
proguard.ProGuard.main(ProGuard.java:476)

项目第55行

-keepclassmembers class * { * method name(…); }

proguard.cfg

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/,!class/merging/

-assumenosideeffects class android.util.Log {
public static boolean isLoggable(java.lang.String,int);
public static int v(…);
public static int d(…); }

-printmapping out.map

-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable

-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

-keepclasseswithmembernames class * {
native ; }

-keepclasseswithmembernames class * {
public (android.content.Context,android.util.AttributeSet); }

-keepclasseswithmembernames class * {
public (android.content.Context,android.util.AttributeSet,int); }

-keepclassmembers enum * {
public static *[] values();
public static *
valueOf(java.lang.String); }

-keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; }

-keepclassmembers class * extends android.content.Context { public void *(android.view.View); public void *(android.view.MenuItem); }

-keepclassmembers class *.R$ {
public static ; }

解决方法

我认为问题可能是:

-keepclasseswithmembernames class * { native ; }

你可以尝试:

-keepclasseswithmembernames class * { 
    native <methods>; 
}
原文链接:https://www.f2er.com/android/129092.html

猜你在找的Android相关文章