我正在开发一个使用不同社交媒体API的Android应用程序,包括Facebook,Twitter,LinkedIn。我试图从一个应用程序管理这三个帐户。我将twitter和LinkedIn以及Facebook API作为.jar文件包含在内,并使用Facebook S.D.K作为参考。但是当我在模拟器中运行应用程序时,它会给出奇怪的verifyError,并且不会显示出错误位置的任何线索。
我的LogCat堆栈跟踪如下;
01-09 06:02:14.192: I/dalvikvm(951): Could not find method
com.facebook.android.Facebook.getAccessToken, referenced from method
com.socialpro.common.SocialMgtProApp.authorizeOnFacebook
01-09 06:02:14.222: W/dalvikvm(951): VFY: unable to resolve virtual method 124:
Lcom/facebook/android/Facebook;.getAccessToken ()Ljava/lang/String;
01-09 06:02:14.222: D/dalvikvm(951): VFY: replacing opcode 0x6e at 0x0004
01-09 06:02:14.254: I/dalvikvm(951): Could not find method
com.google.code.linkedinapi.client.oauth.LinkedInOAuthService.getOAuthAccessToken, referenced
from method com.socialpro.common.SocialMgtProApp.authorizeOnLinkedin
01-09 06:02:14.254: W/dalvikvm(951): VFY: unable to resolve interface method 150:
Lcom/google/code/linkedinapi/client/oauth/LinkedInOAuthService;.getOAuthAccessToken
(Lcom/google/code/linkedinapi/client/oauth/LinkedInRequestToken;Ljava/lang/String;)Lcom/google/code/l inkedinapi/client/oauth/LinkedInAccessToken;
01-09 06:02:14.282: D/dalvikvm(951): VFY: replacing opcode 0x72 at 0x0004
01-09 06:02:14.332: I/dalvikvm(951): Could not find method twitter4j.Twitter.getOAuthAccessToken,
referenced from method com.socialpro.common.SocialMgtProApp.authorizeOnTwitter
01-09 06:02:14.332: W/dalvikvm(951): VFY: unable to resolve interface method 734:
Ltwitter4j/Twitter;.getOAuthAccessToken
(Ltwitter4j/auth/RequestToken;Ljava/lang/String;)Ltwitter4j/auth/AccessToken;
01-09 06:02:14.332: D/dalvikvm(951): VFY: replacing opcode 0x72 at 0x0004
01-09 06:02:14.422: I/dalvikvm(951): Could not find method
com.google.code.linkedinapi.client.oauth.LinkedInOAuthService.getOAuthRequestToken, referenced
from method com.socialpro.common.SocialMgtProApp.beginLinkedInAuthorization
01-09 06:02:14.452: W/dalvikvm(951): VFY: unable to resolve interface method 151:
Lcom/google/code/linkedinapi/client/oauth/LinkedInOAuthService;.getOAuthRequestToken \
(Ljava/lang/String;)Lcom/google/code/linkedinapi/client/oauth/LinkedInRequestToken;
01-09 06:02:14.452: D/dalvikvm(951): VFY: replacing opcode 0x72 at 0x0017
01-09 06:02:14.452: I/dalvikvm(951): Could not find method
com.google.code.linkedinapi.client.oauth.LinkedInRequestToken.getAuthorizationUrl, referenced
from method com.socialpro.common.SocialMgtProApp.beginLinkedInAuthorization
答案 0 :(得分:0)
在proguard-android.txt中输入:
-dontwarn org.twitter4j.**
-dontwarn twitter4j.**
-dontwarn org.simpleframework.**
-dontwarn android.support.**
-dontwarn oauth.signpost.signature.**
-dontwarn com.android.support.**
我不知道您的所有图书馆,也许您应该从此列表中删除相同的图书馆。
在gradle.build中:
compile project(':facebook'){
dependencies {
compile ('com.android.support:support-v13:+'){
exclude group: 'com.android.support', module: 'support-v13'
exclude group: 'com.android.support', module: 'support-v4'
}
compile ('com.android.support:support-v4:+'){
exclude group: 'com.android.support', module: 'support-v4'
}
}}
compile ('org.twitter4j:twitter4j-core:+'){
exclude group: 'twitter4j.management'
}