android.support.v7.app.ActionBarActivity 未解决

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23781675/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 07:26:26  来源:igfitidea点击:

android.support.v7.app.ActionBarActivity not resolve

androidadt

提问by user3659451

I just downloaded Android Developer Tools (ADT), which includes Eclipse, etc., and I followed Android's guide to create MyFirstApp. I've just spend over an hour looking for

我刚刚下载了Android Developer Tools(ADT),其中包括Eclipse等,我按照Android的指南创建了MyFirstApp。我只花了一个多小时寻找

android-support-v7-app.jar

but was unable to. Do you have any suggestions on how to handle the fact that for a blank template, android.support.v7.app.ActionBarActivity not resolve.

但无法。你对如何处理这一事实,对于一个空白模板,有什么建议android.support.v7.app.ActionBarActivity无法解决

回答by Jorgesys

The use of ActionBarActivitynow is deprecated, use

使用ActionBarActivity现在已经过时,使用

import android.support.v7.app.AppCompatActivity

your class now must extends AppCompatActivity

你的班级现在必须扩展 AppCompatActivity

    public myClass extends AppCompatActivity{
...
...

if you have the message:

如果你有消息:

cannot resolve symbol AppCompatActivity

无法解析符号 AppCompatActivity

You have to update to the last support libraryin your Android SDK Manager

你必须更新到最后一个支持库在你的Android SDK Manager

回答by Nana Ghartey

Make sure you've downloaded the package android.support.v7. Then, Import the whole appcompat lib (/extras/android/support/v7/appcompat) as a library project to your workspace and then add to your main project as a library:

确保您已下载包 android.support.v7。然后,将整个 appcompat 库(/extras/android/support/v7/appcompat)作为库项目导入到您的工作区,然后作为库添加到您的主项目中:

Here are the steps.

以下是步骤。

First check if android-support-v7-appcompat is already in your workspace. If it is go to Step 2

首先检查 android-support-v7-appcompat 是否已经在您的工作区中。如果是转到第 2 步

Step 1:

第1步:

Select File > Import.

选择文件 > 导入。

Select Existing Android Code Into Workspace and click Next.

选择 Existing Android Code Into Workspace 并单击 Next。

Browse to the SDK installation directory and then to the Support Library folder. /extras/android/support/v7/appcompat/.

浏览到 SDK 安装目录,然后浏览到 Support Library 文件夹。/extras/android/support/v7/appcompat/.

Click Finish to import the project. For the v7 appcompat project, you should now see a new project titled android-support-v7-appcompat.

单击完成以导入项目。对于 v7 appcompat 项目,您现在应该会看到一个名为 android-support-v7-appcompat 的新项目。

Step 2:

第2步:

Right-click on your project -> Properties In Android->Library section click Add Select android-support-v7-appcompat -> Ok

右键单击您的项目 -> 属性在 Android-> 库部分单击添加选择 android-support-v7-appcompat -> 确定

回答by Praveen Patel

first of all in android studio search auto import and https://i.stack.imgur.com/rFUyf.pnglike that click on all option and then you got an error message

首先在android studio中搜索自动导入 https://i.stack.imgur.com/rFUyf.png,然后点击所有选项,然后你收到一条错误消息