[ACCEPTED]-android.support.v7.app.ActionBarActivity not resolve-adt

Accepted answer
Score: 43

The use of ActionBarActivity is now deprecated, use

import android.support.v7.app.AppCompatActivity

your class now must extends 3 AppCompatActivity

    public myClass extends AppCompatActivity{
...
...

if you have the message:

cannot resolve symbol 2 AppCompatActivity

You have to update to the 1 last support library in your Android SDK Manager

Score: 8

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

Here 13 are the steps.

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

Step 1:

Select File > Import.

Select 10 Existing Android Code Into Workspace and 9 click Next.

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

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

Step 2:

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

Score: 3

The use of ActionBarActivity and v7 is outdated now and is 5 no longer supported by latest versions of 4 Android Studio.

To correct the error simply 3 replace

import android.support.v7.app.ActionBarActivity; 

with

import androidx.appcompat.app.AppCompatActivity;

and also replace the parent class 2 ActionBarActivity with AppCompatActivity

For example: (old and not working): public class MainActivity extends ActionBarActivity with 1 (new): public class MainActivity extends AppCompatActivity

More Related questions