0
votes

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

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.

I'm using Android Studio version 1.0.2.

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>

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

2
Are you using a toolbar?JavierSegoviaCordoba
@Dahnark, I've notice my problem is other one since on my styles.xml I have "Cannot resolve the symbol Theme" and on "parent="Theme.AppCompat.Light.DarkActionBar", Theme appears me in red.porthfind
Can you post your main activity?JavierSegoviaCordoba

2 Answers

0
votes

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

import android.support.v7.app.ActionBarActivity;

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

0
votes

I tried to refresh Gradle and it seemed to work! Maybe some instant problem with android studio and gradle synchronization!