ActionBarActivity无法解决的象征象征、ActionBarActivity

2023-09-12 02:14:44 作者:ツ夏小沫ツ

在我的Andr​​oid Studio中,编译器是无法找到ActionBarActivity。因为它,我收到了许多错误。编译器不能导入ActionBarActivity和动作条类。 这些是编译器抛出错误的行:

In my android Studio, Compiler is not able to locate ActionBarActivity. Because of it, I am getting many errors. The compiler is not able to import the ActionBarActivity and ActionBar class. These are the lines where compiler is throwing error:

进口android.support.v7.app.ActionBarActivity; 进口android.support.v7.app.ActionBar;

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

我试图问一个问题之前,计算器上的搜索。得到的答复是这是增加库中的日食。我试着做它的Andr​​oid Stuio,但没有得到任何东西。

I tried to search on stackoverflow before asking a question. The answer i got is for the eclipse which is to add the library. I tried doing it in Android Stuio, but didn't get anything.

谢谢 萨米特

推荐答案

按照提到了使用支持动作条在Android的Studio中的步骤(0.4.2):

这是Android的SDK管理器下载Android的支持库,SDK管理器图标将在Android Studio的工具栏(或工具 - > Android的 - > SDK管理器

Download the Android Support Repository from Android SDK Manager, SDK Manager icon will be available on Android Studio tool bar (or Tools -> Android -> SDK Manager).

下载后,您将在这里找到您的支持库

After download you will find your Support repository here

$SDK_DIR\extras\android\m2repository\com\android\support\appcompat-v7

打开你的主模块的 build.gradle 文件,并添加以下依赖于低级别的API使用操作栏

Open your main module's build.gradle file and add following dependency for using action bar in lower API level

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

使用工具栏中可用的小摇篮图标与摇篮

同步您的项目(或工具 - > Android的 - >同步项目与摇篮文件)。

Sync your project with gradle using the tiny Gradle icon available in toolbar (or Tools -> Android -> Sync Project With Gradle Files).

有一些问题与Android工作室回事0.4.2因此检查这个,如果你面对以及任何问题,而进口类code。

There is some issue going on with Android Studio 0.4.2 so check this as well if you face any issue while importing classes in code.

Import谷歌播放服务库中的机器人工作室

如果必需遵循的步骤,以及:

If Required follow the steps as well :

退出Android的工作室 从删除.idea文件夹内的所有文件.iml和文件的 项目 在重新开张的Andr​​oid工作室,等到完全同步的项目 与摇篮。如果显示在事件日志导入选项,点击导入项目的错误。 Exit Android Studio Delete all the .iml files and files inside .idea folder from your project Relaunch Android Studio and wait till the project synced completely with gradle. If it shows an error in Event Log with import option click on Import Project.

这是在Android的工作室0.4.2错误固定为Android Studio的0.4.3版本。

This is bug in Android Studio 0.4.2 and fixed for Android Studio 0.4.3 release.