سؤال

Please don't close this as a duplicate!

I have tried upgrading to proguard 4.11

I have tried adding my the libraries I use and the libraries the libraries i use use (does that make sense :O)

I have tried adding -keep class com.google.** and keeping other classes

I have tried -dontwarn fi.foyt.*

Here are the related files:

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:
-libraryjars libs/android-support-v4.jar
-libraryjars libs/crashlytics.jar
-libraryjars libs/libGoogleAnalyticsServices.jar
-libraryjars other/easyfoursquare4android/easyFoursquare4Android/bin/easyfousquareactivity.jar
-libraryjars other/foursquare-android-oauth/foursquare-oauth-library/bin/foursquare-oauth-library.jar
-libraryjars other/easyfoursquare4android/easyFoursquare4Android/libs/foursquare-api-1.0.2.jar
-libraryjars other/easyfoursquare4android/easyFoursquare4Android/libs/gson-2.2.1.jar
#-keep class com.google.** { *; }
#-keep class fi.foyt.foursquare.** { *; }
#-keep class javax.** { *; }
#-keep class org.** { *; }
#-dontwarn fi.foyt.*
#-keep class fi.foyt.**
#-keep public class android.content.Context
#-keep public interface fi.foyt.**
#-keep public class fi.foyt.**

#-dontwarn android.support.v4.**
#-keep class java.lang.reflect.**

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

project.properties

# 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-19
android.library.reference.1=other/foursquare-android-oauth/foursquare-oauth-library
android.library.reference.2=other/easyfoursquare4android/easyFoursquare4Android

Related console log: (click me for full log)

[2014-03-26 01:25:30 - MyAppName] Note: duplicate definition of library class [com.google.gson.JsonSerializationContext]
[2014-03-26 01:25:30 - MyAppName] Reading library jar [/Users/shereef/android-sdks/platforms/android-19/android.jar]
[2014-03-26 01:25:31 - MyAppName] Note: there were 1486 duplicate class definitions.
[2014-03-26 01:25:31 - MyAppName] Initializing...
[2014-03-26 01:25:31 - MyAppName]       (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
[2014-03-26 01:25:31 - MyAppName] Note: the configuration refers to the unknown class 'com.google.vending.licensing.ILicensingService'
[2014-03-26 01:25:31 - MyAppName] Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService'
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.FetchOptions$Builder
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.FetchOptions
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.URLFetchServiceFactory
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.FetchOptions$Builder
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.FetchOptions
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.URLFetchServiceFactory
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletResponse
[2014-03-26 01:25:32 - MyAppName] Note: android.support.v4.text.ICUCompatIcs: can't find dynamically referenced class libcore.icu.ICU
[2014-03-26 01:25:32 - MyAppName] Note: com.google.gson.internal.UnsafeAllocator: can't find dynamically referenced class sun.misc.Unsafe
[2014-03-26 01:25:32 - MyAppName] Note: there were 2 references to unknown classes.
[2014-03-26 01:25:32 - MyAppName]       You should check your configuration for typos.
[2014-03-26 01:25:32 - MyAppName]       (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
[2014-03-26 01:25:32 - MyAppName] Warning: there were 35 unresolved references to classes or interfaces.
[2014-03-26 01:25:32 - MyAppName] Note: there were 2 unresolved dynamic references to classes or interfaces.
[2014-03-26 01:25:32 - MyAppName]       You should check if you need to specify additional program jars.
[2014-03-26 01:25:32 - MyAppName]       (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
[2014-03-26 01:25:32 - MyAppName]          You may need to add missing library jars or update their versions.
[2014-03-26 01:25:32 - MyAppName]          If your code works fine without the missing classes, you can suppress
[2014-03-26 01:25:32 - MyAppName]          the warnings with '-dontwarn' options.
[2014-03-26 01:25:32 - MyAppName]          (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
[2014-03-26 01:25:32 - MyAppName] java.io.IOException: Please correct the above warnings first.
[2014-03-26 01:25:32 - MyAppName]   at proguard.Initializer.execute(Initializer.java:369)
[2014-03-26 01:25:32 - MyAppName]   at proguard.ProGuard.initialize(ProGuard.java:211)
[2014-03-26 01:25:32 - MyAppName]   at proguard.ProGuard.execute(ProGuard.java:86)
[2014-03-26 01:25:32 - MyAppName]   at proguard.ProGuard.main(ProGuard.java:483)
[2014-03-26 01:25:32 - MyAppName] Proguard returned with error code 1. See console
[2014-03-26 01:25:32 - MyAppName] Note: there were 1486 duplicate class definitions.
[2014-03-26 01:25:32 - MyAppName]       (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.FetchOptions$Builder
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.FetchOptions
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.URLFetchServiceFactory
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.FetchOptions$Builder
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.FetchOptions
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.URLFetchServiceFactory
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.URLFetchService
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.api.io.GAEIOHandler: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletResponse
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletRequest
[2014-03-26 01:25:32 - MyAppName] Warning: fi.foyt.foursquare.example.AuthenticationExample: can't find referenced class javax.servlet.http.HttpServletResponse
[2014-03-26 01:25:32 - MyAppName] Warning: there were 35 unresolved references to classes or interfaces.
[2014-03-26 01:25:32 - MyAppName]          You may need to add missing library jars or update their versions.
[2014-03-26 01:25:32 - MyAppName]          If your code works fine without the missing classes, you can suppress
[2014-03-26 01:25:32 - MyAppName]          the warnings with '-dontwarn' options.
[2014-03-26 01:25:32 - MyAppName]          (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
[2014-03-26 01:25:32 - MyAppName] java.io.IOException: Please correct the above warnings first.
[2014-03-26 01:25:32 - MyAppName]   at proguard.Initializer.execute(Initializer.java:369)
[2014-03-26 01:25:32 - MyAppName]   at proguard.ProGuard.initialize(ProGuard.java:211)
[2014-03-26 01:25:32 - MyAppName]   at proguard.ProGuard.execute(ProGuard.java:86)
[2014-03-26 01:25:32 - MyAppName]   at proguard.ProGuard.main(ProGuard.java:483)
[2014-03-26 01:25:32 - EasyFousquareActivity] Using default Build Tools revision 19.0.3

Check my proguard-project.txt I have commented the lines I have tried but didn't make sense

هل كانت مفيدة؟

المحلول

Some classes like com.google.appengine.api.urlfetch.HTTPMethod are missing from your libraries. Apparently, your application doesn't use them anyway, so you can tell ProGuard it's okay. For instance:

-dontwarn fi.foyt.foursquare.**

-dontnote libcore.icu.ICU
-dontnote sun.misc.Unsafe

See the ProGuard manual > Troubleshooting > Warning: can't find referenced class.

Furthermore, you shouldn't specify -injars or -libraryjars options in your configuration file. The Ant/Eclipse/Gradle build process already automatically specifies all the necessary -injars, -outjars, and -libraryjars for you, based on the contents of your project.

See the ProGuard manual > Troubleshooting > Note: duplicate definition of program/library class

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top