2014-02-16 43 views
2

我在我的應用程序中使用外部庫,如foursquare API和ABS庫。在Android應用程序中的proguard

當我在導出應用程序之前啓用proguard時,我在控制檯中看到下面提到的錯誤。

Proguard返回錯誤代碼1.請參閱控制檯 注意:有3686個重複的類定義。 警告:fi.foyt.foursquare.api.io.GAEIOHandler:找不到引用類com.google.appengine.api.urlfetch.HTTPMethod 警告:fi.foyt.foursquare.api.io.GAEIOHandler:can not找到引用類com.google.appengine.api.urlfetch.HTTPMethod fi.foyt.foursquare.api.io.GAEIOHandler:找不到引用類com.google.appengine.api.urlfetch.HTTPRequest 警告:fi.foyt .foursquare.api.io.GAEIOHandler:找不到引用類com.google.appengine.api.urlfetch.FetchOptions $ Builder 警告:fi.foyt.foursquare.api.io.GAEIOHandler:無法找到引用的類com .google.appengine.api.urlfetch.FetchOptions 警告:fi.foyt.foursquare.api.io.GAEIOHandler:找不到引用類com.google.appengine.api.urlfetch.HTTPRequest 警告:fi.foyt.foursquare .API。 io.GAEIOHandler:找不到引用類com.google.appengine.api.urlfetch.URLFetchServiceFactory 警告:fi.foyt.foursquare.api.io.GAEIOHandler:無法找到引用的類com.google.appengine.api。 urlfetch.URLFetchService 警告:fi.foyt.foursquare.api.io.GAEIOHandler:找不到引用類com.google.appengine.api.urlfetch.HTTPResponse 警告:fi.foyt.foursquare.api.io.GAEIOHandler:找不到引用類com.google.appengine.api.urlfetch.HTTPResponse 警告:fi.foyt.foursquare.api.io.GAEIOHandler:找不到引用類com.google.appengine.api.urlfetch.HTTPMethod 警告:fi.foyt.foursquare.api.io.GAEIOHandler:無法找到引用的類com.google.appengine.api.urlfetch.HTTPMethod 警告:fi.foyt.foursquare.api.io.GAEIOHandler:找不到引用類com。 google.appengine.api.urlfetch.FetchOptions $ Builder 警告:fi.foyt.foursquare.api.io.GAEIOHandler:找不到引用類com.google.appengine.api.urlfetch.FetchOptions 警告:fi.foyt。 foursquare.api.io.GAEIOHandler:找不到引用類com.google.appengine.api.urlfetch.URLFetchServiceFactory 警告:fi.foyt.foursquare.api.io.GAEIOHandler:無法找到引用的類com.google。 appengine.api.urlfetch.URLFetchService 警告:fi.foyt.foursquare.api.io.GAEIOHandler:找不到引用的類com.google.appengine.api.urlfetch.HTTPResponse 警告:fi.foyt.foursquare.api。 io.GAEIOHandler:找不到引用類com.google.appengine.api.urlfetch.HTTPMethod 警告:fi.foyt.foursquare.api.io.GAEIOHandler:無法找到引用的類com.google.appengine.api。 urlfetch.HTTPReque st 警告:fi.foyt.foursquare.api.io.GAEIOHandler:找不到引用的類com.google.appengine.api.urlfetch.URLFetchService 警告:fi.foyt.foursquare.api.io.GAEIOHandler:can' t找到引用類com.google.appengine.api.urlfetch.HTTPResponse 警告:fi.foyt.foursquare.example.AuthenticationExample:找不到引用的類javax.servlet.http.HttpServletResponse 警告:fi.foyt.foursquare。 example.AuthenticationExample:找不到引用類javax.servlet.http.HttpServletRequest 警告:fi.foyt.foursquare.example.AuthenticationExample:找不到引用類javax.servlet.http.HttpServletRequest 警告:fi.foyt。 foursquare.example.AuthenticationExample:找不到引用類javax.servlet.http.HttpServletResponse 警告:fi.f oyt.foursquare.example.AuthenticationExample:找不到引用類javax.servlet.http.HttpServletResponse 警告:fi.foyt.foursquare.example.AuthenticationExample:找不到引用的類javax.servlet.http。HttpServletRequest fi.foyt.foursquare.example.AuthenticationExample:找不到引用的類javax.servlet.http.HttpServletRequest 警告:fi.foyt.foursquare.example.AuthenticationExample:找不到引用的類javax.servlet.http。 HttpServletResponse 警告:fi.foyt.foursquare.example.AuthenticationExample:找不到引用的類javax.servlet.http.HttpServletRequest 警告:fi.foyt.foursquare.example.AuthenticationExample:找不到引用的類javax.servlet。 http.HttpServletResponse 警告:fi.foyt.foursquare.example.AuthenticationExample:找不到引用的類javax.servlet.http.HttpServletRequest 警告:fi.foyt.foursquare.example.AuthenticationExample:找不到引用的類javax。 servlet.http.HttpServletResponse Warnin g:fi.foyt.foursquare.example.AuthenticationExample:找不到引用的類javax.servlet.http.HttpServletRequest 警告:fi.foyt.foursquare.example.AuthenticationExample:找不到引用的類javax.servlet.http。 HttpServletResponse 您應該檢查是否需要指定其他程序罐。 警告:有35個未解析的對類或接口的引用。 您可能需要指定其他庫罐(使用'-libraryjars')。 java.io.IOException:請先糾正上述警告。 在proguard.Initializer.execute(Initializer.java:321) 在proguard.ProGuard.initialize(ProGuard.java:211) 在proguard.ProGuard.execute(ProGuard.java:86) 在proguard.ProGuard.main( ProGuard.java:492)

我知道我必須提到Proguard屬性文件中的外部庫。我應該提到的是這個問題。

請參閱我的ProGuard文件

-injars  bin/classes 
-outjars  bin/classes-processed.jar 
-libraryjars E:/android/adt-bundle-windows-x86_64-20131030/sdk/platforms/android-19/android.jar 

-dontpreverify 
-repackageclasses '' 
-allowaccessmodification 
-optimizations !code/simplification/arithmetic 
-keepattributes *Annotation* 

-keep public class * extends android.app.Activity 

-keep public class * extends android.app.Service 

-keep public class * extends android.content.BroadcastReceiver 


-keep public class * extends android.content.ContentProvider 

-assumenosideeffects class android.util.Log { 
public static boolean isLoggable(java.lang.String, int); 
public static int v(...); 
public static int i(...); 
public static int w(...); 
public static int d(...); 
public static int e(...); 
} 
+0

可能重複[proguard地獄 - 無法找到引用的類](http://stackoverflow.com/questions/6974231/proguard-hell-cant-find-referenced-class) – 2014-02-16 10:31:47

回答

1

如果你用Android插件導出您的Android應用程序,插件已經指定了你一個標準配置。這個配置包括基本的維護選項和所有必要的-injars和-outjars選項(因此重複類定義的註釋)。這意味着你的proguard-project.txt文件可以是空的;它應該只包含任何項目特定的配置。

警告說明Foursquare庫引用了AppEngine庫,甚至引用了servlet庫,但是後面這些庫在您的項目中不存在。這不是一個問題,因爲你的應用程序可能工作在調試模式精細,如果沒有這些庫,這樣你就可以告訴ProGuard忽略這些問題:

-dontwarn fi.foyt.foursquare.** 

見的ProGuard手冊>故障排除>Warning: can't find referenced class

相關問題