0

我正在尝试让一个简单的 Android 应用程序为 Twitter 工作。我正在使用图书馆 jtwitter。我正在尝试使用 AndroidTwitterLogin 类。我有一个使用 OAuth 进行身份验证的按钮。它调用此代码。

public void authorizeApp(View v) {
    AndroidTwitterLogin atl = new AndroidTwitterLogin(this,
            MY_TWITTER_KEY,MY_TWITTER_SECRET,MY_TWITTER_CALLBACK) {

        protected void onSuccess(Twitter jtwitter, String[] tokens) {
            jtwitter.setStatus("I can now post to Twitter using my android app !");
            Log.i("TwitterOAuth","successfully authorized app");
            authorizeText.setText("Authorized");

            // Recommended: store tokens in your app for future use
            // with the constructor OAuthSignpostClient(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret)
        }
    };
    atl.run();
}

在运行时,当我到达 AndroidTwitterLogin.run 行时,它会因以下代码而崩溃。

Caused by: java.lang.NoSuchMethodError: No static method i(Ljava/lang/String;Ljava/lang/String;)V in class Landroid/util/Log; or its super classes (declaration of 'android.util.Log' appears in /system/framework/framework.jar)  
at winterwell.jtwitter.android.AndroidTwitterLogin.run(AndroidTwitterLogin.java:78)  
at com.franksapps.twitteroauth.TwitterActivity.authorizeApp(TwitterActivity.java:45)` 

有谁知道这个类是否可以在 jtwitter/Android 中使用,或者如何使这个类可用?

4

1 回答 1

0

也许检查您的应用程序中包含哪些库?

JTwitter 下载包含一个虚拟库,用于允许它在有或没有 Android 的情况下进行编译。您想避免(也许只是删除)以下文件:android.jar, android-dummy.jar. 如果其中一个被意外包含在内,那么它会引起问题。

注意:我承认我已经有几年没有使用过这个特定的类了。

  • 丹尼尔
于 2016-06-17T09:11:57.743 回答