安卓:无法解析符号ActionBarActivity符号、ActionBarActivity

由网友(不爱就滚,别浪费老娘青春)分享简介:我收到了错误的的无法解析符号ActionBarActivity 的当我尝试导入(进口android.support.v7.app.ActionBarActivity)。 I'm getting the error "Cannot resolve the symbol ActionBarActivity" when I...

我收到了错误的的无法解析符号ActionBarActivity 的当我尝试导入(进口android.support.v7.app.ActionBarActivity)。

I'm getting the error "Cannot resolve the symbol ActionBarActivity" when I try to import it (import android.support.v7.app.ActionBarActivity;).

我已经读了一些问题,ActionBarActivity无法解析符号和Import谷歌播放服务库中的机器人工作室有关这一点,我已经试过那里介绍的解决方案,但我不能确定我的问题。 我试着targetSdK更改为低,然后我回信说,我有过,但它并没有解决。

I've already read some questions ActionBarActivity cannot resolve a symbol and Import Google Play Services library in Android Studio about it and i've tried the solution described there but I couldn't fix my problem. I tried to change the targetSdK to one lower and then I wrote back that that I had before but it didn't resolve.

我使用的是Android Studio的版本1.0.2。

I'm using Android Studio version 1.0.2.

我的build.grad文件:

My build.grad file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.android.asminhasdespesas"
        minSdkVersion 13
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
}

我的清单文件:

My Manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.asminhasdespesas" >

    <uses-sdk android:minSdkVersion="13" android:targetSdkVersion="21"></uses-sdk>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

你有任何可能的解决方案来解决这个问题,因为我觉得这不应该发生在这个工作室的Andr​​oid版本。谢谢你。

Do you have any possible resolution to fix this issue since I think this shouldn't happen with this Android Studio version. Thanks.

推荐答案

看起来你缺少这种进口的活动:

Looks like you're missing this import in the activity:

import android.support.v7.app.ActionBarActivity;

您可以使用 CTRL + ALT + O 解决这个问题。一期工程重建也可能​​会做的伎俩。

You can fix this by using ctrl + alt + o. A project rebuild might also do the trick.

阅读全文

相关推荐

最新文章