在 android 中找不到符号 class TwitterApp twitter4j-core-3.0.3.jar

Cannot find symbol class TwitterApp twitter4j-core-3.0.3.jar in android

当我将旧的 eclipse 项目转换为 android studio 项目时,它会向我显示此类错误,即使我已经在我的文件中添加了 twitter4j-core-3.0.3.jar 文件lib 文件夹,我会将它们添加到我的项目中,然后它们也会向我显示这种错误 他们不能给我 ALT+ENTER 选项来自动导入。

我的代码如下:-

ShareTwitterActivity.java

@SuppressLint("HandlerLeak")
public class ShareTwitterActivity extends Activity {
    private TwitterApp mTwitter;
    private boolean postToTwitter = false;
    private String review = "";
    private EditText editReview;
    private ProgressDialog mProgress;
    private ShareTwitterActivity context;
    private int[] textview = { R.id.textView_header, R.id.text_share_msg, R.id.text_share_head,R.id.shareTwitter_edit_review };

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.share_twitter);

        context = ShareTwitterActivity.this;

        // change font of textview
        if (Utility.tf != null) {
            for (int i = 0; i < textview.length; i++) {
                ((TextView) findViewById(textview[i])).setTypeface(Utility.tf);
            }
        }
        mProgress = new ProgressDialog(ShareTwitterActivity.this);
        editReview = (EditText) findViewById(R.id.shareTwitter_edit_review);

        findViewById(R.id.shareTwitter_btn_post).setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                if (Utility.hasConnection(context)) {
                    review = editReview.getText().toString();
                    if (postToTwitter) {
                        postToTwitter(review + "\nAndroid Applications Here:  " + Consts.APP_LINK);
                    } else {
                        Toast.makeText(ShareTwitterActivity.this, "Please Login to Continue....", Toast.LENGTH_LONG).show();
                        onTwitterClick();
                    }
                } else {
                    Utility.showToast("Internet Connection Failed", context);
                }
            }
        });

        mTwitter = new TwitterApp(ShareTwitterActivity.this, Consts.CONSUMER_KEY, Consts.CONSUMER_SECRET);
        mTwitter.setListener(mTwLoginDialogListener);
    }

    public void postToTwitter(final String review) {
        mProgress.setMessage("Posting on Wall...");
        mProgress.show();
        new Thread() {
            public void run() {
                int what = 0;
                try {
                    mTwitter.updateStatus(review);
                } catch (Exception e) {
                    what = 1;
                }
                mHandler.sendMessage(mHandler.obtainMessage(what));
            }
        }.start();
    }

    private Handler mHandler = new Handler() {

        public void handleMessage(Message msg) {
            mProgress.cancel();
            String text = (msg.what == 0) ? "Posted to Twitter" : "Post to Twitter failed";

            Toast.makeText(ShareTwitterActivity.this, text, Toast.LENGTH_SHORT).show();
            Log.d("CALL", "Call Before Finish");
            // ------------------Test-----------------
            mTwitter.resetAccessToken();

            // ------------------------------------------
            onBackPressed();
        }
    };

    private final TwDialogListener mTwLoginDialogListener = new TwDialogListener() {

        public void onComplete(String value) {
            postToTwitter = true;
            review = editReview.getText().toString();
            postToTwitter(review + "\nAwesome Android Applications Here:  " + Consts.APP_LINK);
        }

        public void onError(String value) {
            Toast.makeText(ShareTwitterActivity.this, "Twitter connection failed", Toast.LENGTH_LONG).show();
        }
    };

    public void onTwitterClick() {
        if (mTwitter.hasAccessToken()) {
            final AlertDialog.Builder builder = new AlertDialog.Builder(ShareTwitterActivity.this);
            builder.setMessage("Delete current Twitter connection?").setCancelable(false)
                    .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            mTwitter.resetAccessToken();
                        }
                    }).setNegativeButton("No", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            dialog.cancel();
                        }
                    });
            final AlertDialog alert = builder.create();
            alert.show();
        } else {
            mTwitter.authorize();
        }
    }

    protected void onDestroy() {
        super.onDestroy();
    }

}

build.gradle(模块:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.example"
        minSdkVersion 18
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:support-v4:26.0.0-alpha1'
    compile 'com.google.android.gms:play-services:11.0.4'
    compile files('libs/signpost-commonshttp4-1.2.1.1.jar')
    compile files('libs/signpost-core-1.2.1.1.jar')
    compile files('libs/signpost-jetty6-1.2.1.1.jar')
    compile files('libs/twitter4j-core-3.0.3.jar')
}

似乎 TwitterApp 和 TwDialogListener 类 是为了示例而制作的,它们不应该是 twitter4j-core lib 的一部分