Actionbaractivity Cannot Resolve a Symbol

cannot resolve symbol ActionBarActivity in android studio 2.1.1

Solution of this kind of problem:

  1. Download the Android Support Repository from Android SDK Manager, SDK Manager icon will be available on Android Studio tool bar (or Tools -> SDK Manager).

  2. then go in to extras and download Android support repository
    Then

Open your main module's build.gradle file and add following dependency for using action bar in lower API level

dependencies {
compile 'com.android.support:appcompat-v7:+'
}

Sync your project with gradle using the tiny Gradle icon available in toolbar (or Tools -> Android -> Sync Project With Gradle Files)


  1. If you have done all steps or all are present already then u can change the extends as
    AppBarActivity to AppCompatActivity (Public Class ClassName extends AppCompatActivity) because AppBarActivity has been deprecated.

ActionBarActivity cannot resolve a symbol

Follow the steps mentioned for using support ActionBar in Android Studio(0.4.2) :

Download the Android Support Repository from Android SDK Manager, SDK Manager icon will be available on Android Studio tool bar (or Tools -> Android -> SDK Manager).

enter image description here

After download you will find your Support repository here

$SDK_DIR\extras\android\m2repository\com\android\support\appcompat-v7

Open your main module's build.gradle file and add following dependency for using action bar in lower API level

dependencies {
compile 'com.android.support:appcompat-v7:+'
}

Sync your project with gradle using the tiny Gradle icon available in toolbar (or Tools -> Android -> Sync Project With Gradle Files).

There is some issue going on with Android Studio 0.4.2 so check this as well if you face any issue while importing classes in code.

Import Google Play Services library in Android Studio

If Required follow the steps as well :

  • Exit Android Studio
  • Delete all the .iml files and files inside .idea folder from your
    project
  • Relaunch Android Studio and wait till the project synced completely
    with gradle. If it shows an error in Event Log with import option click on Import Project.

This is bug in Android Studio 0.4.2 and fixed for Android Studio 0.4.3 release.

cannot resolve symbol actionbaractivity

ActionBarActivity is deprecated for a long time. And your import statement suggests to use AppCompatActivity instead:

public class Game extends AppCompatActivity {

Cannot resolve symbol actionBarActivity - Android

Extend AppCompatActivity instead.

(EDIT: I saw you made a comment about HAX, that's emulator specific. To test your emulator, you would open another AS project and see if it will open in the emulator. It may be possible that HAX isn't supported on your computer.)

android.support.v7.app.ActionBarActivity not resolve

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

Here are the steps.

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

Step 1:

Select File > Import.

Select Existing Android Code Into Workspace and click Next.

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

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

Step 2:

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



Related Topics



Leave a reply



Submit