Reputation: 10059
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 :
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:
Upvotes: 2
Views: 3950
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