I am new to android development, and I have been using the command line tools to create an android project. I followed all the instructions given in the tutorial at android developers. However, they are focused more on IDE users.
When I tried extending my MainActivity class from ActionBarActivity instead of just Activity, it threw the following error.
error: package android.support.v7.app does not exist
It was complaining about this import statement.
import android.support.v7.app.ActionBarActivity;
I made sure to visit the SDK manager, and it says Android Support Library is installed. I am truly stumped on this one, and I would really appreciate any help you guys could give me.
This might help: http://developer.android.com/reference/android/support/v7/app/ActionBarActivity.html
Your project is missing the support library from the SDK.
If you have no installed them, just right click on the
project > Android Tools > Install support library
.Then, just import into workspace, as an Android project,
android-support-v7-appcompat
, located into${android-sdk-path}/extras/android/support/v7
And finally, right click in the Android
project > Properties > Android Tab
. Push theAdd
button and add the support project"android-support-v7-appcompat"
as dependency.Clean your project and the must compile and work properly.
For what it's worth:
I ran in to this issue when using Xamarin, even though I did have the Support packages installed, both the v4 and the v7 ones.
It was resolved for me by doing Build -> Clean All.
Using
Android Studio
you have to add the dependency of the support library that was not indicated in the tutorialtry to copy C:\Program Files\Java\jdk1.8.0_121 && C:\Program Files\Java\jre1.8.0_121 from other working PC then all (clean && rebuild)