Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
proguard.ParseException:类成员名称应在'@';在Android Eclipse ADT中_Android_Proguard - Fatal编程技术网

proguard.ParseException:类成员名称应在'@';在Android Eclipse ADT中

proguard.ParseException:类成员名称应在'@';在Android Eclipse ADT中,android,proguard,Android,Proguard,我尝试在MAC上使用Proguard和eclipse ADT v21.1.0-569685优化我的Android应用程序代码。 我使用project->Android Tools->export-asigned Application package选项使用我的私人证书进行签名,在签名完成后,我得到以下错误: 项目属性 # This file is automatically generated by Android Tools. # Do not modify this file -- YOU

我尝试在MAC上使用Proguard和eclipse ADT v21.1.0-569685优化我的Android应用程序代码。 我使用project->Android Tools->export-asigned Application package选项使用我的私人证书进行签名,在签名完成后,我得到以下错误:

项目属性

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-17
android.library.reference.1=../google-play-services_lib
proguard project.txt

# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}
控制台日志:

[2013-04-12 10:41:53 - MyApp] Proguard returned with error code 1. See console
[2013-04-12 10:41:53 - MyApp] proguard.ParseException: Expecting class member name before '@' in line 82 of file '/Users/MyOrg/Android_workspace/MyApp/bin/proguard.txt',
[2013-04-12 10:41:53 - MyApp]   included from argument number 6
[2013-04-12 10:41:53 - MyApp]   at proguard.ConfigurationParser.readNextWord(ConfigurationParser.java:1133)
[2013-04-12 10:41:53 - MyApp]   at proguard.ConfigurationParser.readNextWord(ConfigurationParser.java:1117)
[2013-04-12 10:41:53 - MyApp]   at proguard.ConfigurationParser.parseMemberSpecificationArguments(ConfigurationParser.java:845)
[2013-04-12 10:41:53 - MyApp]   at proguard.ConfigurationParser.parseClassSpecificationArguments(ConfigurationParser.java:697)
[2013-04-12 10:41:53 - MyApp]   at proguard.ConfigurationParser.parseKeepClassSpecificationArguments(ConfigurationParser.java:490)
[2013-04-12 10:41:53 - MyApp]   at proguard.ConfigurationParser.parse(ConfigurationParser.java:139)
[2013-04-12 10:41:53 - MyApp]   at proguard.ProGuard.main(ProGuard.java:484)
  • 如何解决上述问题
  • 我在prouard.project文件中读到
  • 如果您的项目使用带JS的WebView,请取消注释以下内容并 指定JavaScript接口的完全限定类名 类别:


    我在WebAppInterface.java类的两个活动中使用了webview。如何执行上述语句?

    android:onClick布局文件的属性中引用资源名称,如“@string/on\u click\u handler\u name”。但是,proguard无法解析这些引用。

    查看更多详细信息

    在string.xml中找到@string/tha_lf_et_todate_onclick的相应值并更新:

    android:onClick="@string/tha_lf_et_todate_onclick" 
    

    在布局文件中。 关于第二个问题, 取消注释这段代码,并替换“fqcn.of.javascript.interface.for.webview”
    使用类的完全限定名。

    您看过
    /Users/MyOrg/Android\u workspace/MyApp/bin/proguard.txt
    的第82行了吗?-keepclassmembers类*{***@string/tha_lf_et_todate_onclick(…)}
    android:onClick="onClickXXX"