我正在尝试使用 proguard 混淆我的代码。我在我的项目中使用谷歌地图。
但我得到以下例外。
如何解决?
Proguard returned with error code 1. See console
Warning: class [bin/classes/com/google/android/gms/BuildConfig.class] unexpectedly contains class [com.google.android.gms.BuildConfig]
Warning: class [bin/classes/com/google/android/gms/R$attr.class] unexpectedly contains class [com.google.android.gms.R$attr]
Warning: class [bin/classes/com/google/android/gms/R$id.class] unexpectedly contains class [com.google.android.gms.R$id]
Warning: class [bin/classes/com/google/android/gms/R$string.class] unexpectedly contains class [com.google.android.gms.R$string]
Warning: class [bin/classes/com/google/android/gms/R$styleable.class] unexpectedly contains class [com.google.android.gms.R$styleable]
Warning: class [bin/classes/com/google/android/gms/R.class] unexpectedly contains class [com.google.android.gms.R]
Note: there were 1656 duplicate class definitions.
Warning: there were 6 classes in incorrectly named files.
You should make sure all file names correspond to their class names.
The directory hierarchies must correspond to the package hierarchies.
If you don't mind the mentioned classes not being written out,
you could try your luck using the '-ignorewarnings' option.
java.io.IOException: Please correct the above warnings first.
at proguard.InputReader.execute(InputReader.java:133)
at proguard.ProGuard.readInput(ProGuard.java:196)
at proguard.ProGuard.execute(ProGuard.java:78)
at proguard.ProGuard.main(ProGuard.java:492)
Proguard returned with error code 1. See console
proguard.ParseException: Unexpected keyword 'names' in line 30 of file 'D:\redBus_Update_3\proguard-project.txt',
included from argument number 4
at proguard.ConfigurationParser.unknownAccessFlag(ConfigurationParser.java:1048)
at proguard.ConfigurationParser.parseClassSpecificationArguments(ConfigurationParser.java:547)
at proguard.ConfigurationParser.parseKeepClassSpecificationArguments(ConfigurationParser.java:490)
at proguard.ConfigurationParser.parse(ConfigurationParser.java:138)
at proguard.ProGuard.main(ProGuard.java:484)
请在下面找到 proguard 文件的内容。
我也尝试对这些文件使用忽略警告选项
# 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 *;
#}
-libraryjars D:\google-play-services_lib_en
-libraryjars D:\redBus_Update_3\libs\FlurryAgent.jar
-libraryjars D:\redBus_Update_3\libs\gson-2.2.2.jar
-libraryjars D:\redBus_Update_3\libs\bugsense-3.0.1.jar
-libraryjars D:\redBus_Update_3\libs\android-support-v4.jar
-keep class android.location.** { *; }
-keep public class com.google.android.maps.** {*;}
-keep public class com.google.android.maps.** {*;}
-keep public class com.google.android.gms.maps.** {*;}
-dontwarn com.google.android.maps.GeoPoint
-dontwarn com.google.android.maps.MapActivity
-dontwarn com.google.android.maps.MapView
-dontwarn com.google.android.maps.MapController
-dontwarn com.google.android.maps.Overlay