gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:16:32 25 4
gpt4 key购买 nike

使用 Proguard(通过 Eclipse 的 ADT)导出 Android 应用程序时出现以下错误。

“proguard.ParseException:期望在‘name’之前打开‘(’或分隔符‘;’”

我看到其他的ProGuard parse error问题通过升级Proguard和sdk解决了;然而,在所有升级之后这里没有运气。有人见过这个/解决过这个吗?预先感谢您的帮助!

环境

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>;
}

关于java - 使用 ProGuard 导出 Android 应用程序会出现 ParseException 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17582808/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com