Stephen
Stephen

Reputation: 10059

AppCompatActivity cannot be resolved to a type in eclipse

I am using version 5.0.1 api level 21.I have added appcompat library in project properties.But I am getting compile error: AppCompatActivity cannot be resolved to a type.

RegisterActivity.java:

import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

public class RegisterDevice extends AsyncTask<String, String, String>{

    AppCompatActivity _activity;

    public RegisterDevice(AppCompatActivity _activity) {
        // TODO Auto-generated constructor stub
        this._activity = _activity;
    }
}

res/values/themes.xml:

error: Error: No resource found that matches the given name: attr 'buttonStyle'.

<resources xmlns:android="http://schemas.android.com/apk/res/android">

    <style name="WT_DEFAULT_THEME" parent="@style/Theme.AppCompat.Light">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    .......
    .......
        <item name="buttonStyle">@style/WT_DEFAULT_BUTTON</item>
    </style>

Right Click of project->Properties ->Android :

enter image description here

I am not sure why this error occurred still.I had created new project.Appcompat library was supported for newly created projects.But in this project it is not supported.

Edit:

enter image description here

Upvotes: 2

Views: 3950

Answers (1)

gnarayans
gnarayans

Reputation: 11

please find this below links for proper dependencies into your project.

Cannot resolve symbol 'AppCompatActivity'

AppCompatActivity cannot be resolved to a type

Hope this will help..!!!

Upvotes: 1

Related Questions