Darussian Darussian - 2 months ago 30
Android Question

Android Studio Support Library v7

I am attempting to use the Support Action Bar. I have followed all the instructions on how to include the support library in Android Studio v 0.3.0. My build.gradle's dependencies look like:

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':NineOld')
compile project(':Helpshift')
compile project(':SlidingMenu:library')
compile project(':AmbilWarna')
compile 'com.android.support:support-v4:18.0.+'
compile 'com.android.support:appcompat-v7:18.0.+'

When I attempt to use the theme:


Android Studio says it cannot resolve the symbol. I know this used to be an issue, but I believe it was fixed in 0.2.6.

When building the project, I get

Gradle: No resource found that matches the given name (at 'theme' with value '@android:style/Theme.AppCompat').

After I clean the project with the dependencies, I should see the jars in the External Libraries. Correct? At the moment, I only see the support-v4-18.0.0 jar.


Remove the "android:" prefix.

Styles and Themes not included in your minimum API level will not be there. So if you're minimum API level is 8 (Froyo), then any time you prefix a resource with "android:" it's going to look in the android "res" folder for platform-8 (android-sdk\platforms\android-8\data\res).

Lastly, the main reason why you need to use the AppCompat library is because the "Theme.Holo" does not exist in your platform "res" folder unless you raise your minimum API level to 11 (Honeycomb).