cannot resolve symbol ActionBarActivity in android studio 2.1.1
Solution of this kind of problem:
Download the Android Support Repository from Android SDK Manager, SDK Manager icon will be available on Android Studio tool bar (or
Tools -> SDK Manager
).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)
- If you have done all steps or all are present already then u can change the extends as
AppBarActivity
toAppCompatActivity
(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
).
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
How to Determine Which Dependency Causes Google Play Openssl Warning
Programmatically Obtain the Android API Level of a Device
How to Access Fragment's Child Views Inside Fragment's Parent Activity
How to Send Broadcast from One App to Another App
What's Wrong with Debugging in Eclipse on Android
Incompatible Plugins for Android-Apt After Upgrading to Android Studio 2.3
Android.Database.Cursorindexoutofboundsexception: Index 0 Requested, with a Size of 0
Android Speech Recognition Continuous Service
How to Resolve "Waiting for Debugger" Message
How to Set Android_Sdk_Home Environment Variable
Error :: Duplicate Files During Packaging of APK
Get Cursor Position in Android in Edit Text
How to Use View.Ontouchlistener Instead of Onclick
Android Type_Linear_Acceleration Sensor - What Does It Show
How to Set Text in an Edittext
How to Style the Standard React-Native Android Picker
How to Implement Drag and Drop in Android 2.2
How to Get a Dialog Style Activity Window to Fill the Screen