Can't import ActionBarCompat from Android Support Library using Android Studio

亡梦爱人 提交于 2019-12-07 18:56:51

问题


I am using Android Studio and have followed this article from google as well as some other articles discussing how to use the new ActionBarCompat.

I have downloaded the support library (Rev. 18) in Android SDK Manager and added the following in my build.gradle

dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:appcompat-v7:18.0.0'
}

Now I'm trying to import the Support Library API and extend ActionBarActivity in my code, however, this is what showed up

which is not what it is supposed to be

import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;

Any Help?


回答1:


I have the same problem. I followed this step to solved it, in Android Studio - Tools -> Android -> Sync Project with Gradle Files.

Edit: Sorry, I forgot add this: After Sync Project with Gradle Files follow this steps:

  • Right mouse click for your project and select Open Module Settings

  • After that, select dependencies tab

  • In the end - selec your library:

This should work.



来源:https://stackoverflow.com/questions/19417666/cant-import-actionbarcompat-from-android-support-library-using-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!