1

I am starting development of android apps so i downloaded android studio so, when i imported ActionBarActivity class from the source of android it's giving me error like this:-

Please check the error here:

please check the error here

I have tried many things like changing the path and everything but nothing works here is the image of my installed SDKs in android studio:-

Please check the SDK tools here:

please check the SDK tools here

Please help me if anyone knows what to do about this error

UkFLSUI
  • 5,509
  • 6
  • 32
  • 47
Dev Joshi
  • 73
  • 1
  • 1
  • 8

2 Answers2

25

Change

ActionBarActivity to AppCompatActivity

Like this

public class Game extends AppCompatActivity 
Steffo Dimfelt
  • 870
  • 12
  • 11
2

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.
  • it worked, firstly i followed your steps and then now i have created new project so by default they gave me AppCompatActivity instead of Actionbaractivity thanks bro!! – Dev Joshi Jun 15 '17 at 17:08