I've viewed a ton of posts regarding this issue, but everything here checks out.
Code:
Actionbar:
<style name="CustomActionBarTheme"
parent="#android:style/Theme.AppCompat">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
Gradle:
compileSdkVersion 'android-L'
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 8
targetSdkVersion 'android-L'
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:21+'
compile 'com.android.support:support-v4:20+'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.http-client:google-http-client-jackson2:1.18.0-rc'
compile 'com.google.apis:google-api-services-calendar:v3-rev75-1.17.0-rc'
compile 'com.google.api-client:google-api-client-android:1.17.0-rc'
compile 'com.google.http-client:google-http-client-gson:1.17.0-rc'
compile 'com.google.apis:google-api-services-oauth2:v2-rev63-1.17.0-rc'
compile 'com.google.android.gms:play-services:3.1.+'
compile files('libs/app-AppEngine-endpoints-android.jar')
}
Using Android Studio
YES I have support library installed
YES I have tried moving SDK versions all the way up to sdk-18
EDIT
Ctrl-Clicking on the ".../Theme.AppCompat" takes me to the correct lines in values.xml, see below:
<style name="Theme.AppCompat" parent="Theme.Base.AppCompat">
<item name="isLightTheme">false</item>
<!-- Required for use of support_simple_spinner_dropdown_item.xml -->
<item name="spinnerDropDownItemStyle"> #style/Widget.AppCompat.DropDownItem.Spinner</item>
<item name="dropdownListPreferredItemHeight">?attr/listPreferredItemHeightSmall</item>
<item name="searchResultListItemHeight">58dip</item>
Changing this to parent="#style/Theme.AppCompat" causes an error, but by defining that theme in "styles" I managed to fix it at it worked as intended.
I think it's your use of the #android prefix that's causing the problem. I struggled with it for ages until I found this answer:
https://stackoverflow.com/a/19507892/1123654
Related
I am beginner in android development so this might have simple solution that i am not aware of.
I have updated android studio to newer version (1.5.1) and i have some complications with building my project from older version. So first i run build and get stopper right here :
Warning:Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.2.0) and test app (23.1.1) differ.
This is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "hidden"
minSdkVersion 8
targetSdkVersion 23
versionCode 1
versionName "1.0"
// tests
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':library')
// tests
androidTestCompile 'com.android.support:support-annotations:23.1.1'
androidTestCompile 'com.android.support.test:runner:0.4'
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
}
The obvious solution is to rewrite version to 23.2.0
But then i rerun build and the real problem starts:
if file \res\values-v11\values-v11.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MD_Dark" parent="Theme.AppCompat.Dialog.Alert">
<item name="android:windowMinWidthMajor">#dimen/abc_dialog_min_width_major</item>
<item name="android:windowMinWidthMinor">#dimen/abc_dialog_min_width_minor</item>
<item name="md_divider">#color/md_divider_white</item>
<item name="md_list_selector">#drawable/md_selector_dark</item>
<item name="md_btn_stacked_selector">#drawable/md_selector_dark</item>
<item name="md_btn_positive_selector">#drawable/md_btn_selector_dark</item>
<item name="md_btn_neutral_selector">#drawable/md_btn_selector_dark</item>
<item name="md_btn_negative_selector">#drawable/md_btn_selector_dark</item>
<item name="android:actionModeBackground">#color/primary_material_dark</item>
<item name="android:actionModeCloseDrawable">#drawable/abc_ic_ab_back_mtrl_am_alpha</item>
<item name="android:windowAnimationStyle">#style/MD_WindowAnimation</item>
<item name="android:backgroundDimEnabled">true</item>
</style>file continues...
following error:
Error:(15, 54) No resource found that matches the given name (at 'android:actionModeCloseDrawable' with value '#drawable/abc_ic_ab_back_mtrl_am_alpha').
Now i did my research and according to Update support library 23.2.0 build bug I should just rename the resource by its new file name but the file is generated and should not be changed and after rebuild it gets regenerated so i cant seem to fing a way out of this trouble.
Thanks for any help.
Solution is to change this external library to newest version supporting changes in new support library v23.2.0
compile ('com.github.afollestad.material-dialogs:core:0.8.5.6#aar')
For some reason it has to be done manually.
You can resolve the warning using the 23.2.0.
androidTestCompile 'com.android.support:support-annotations:23.2.0'
About the issue.
Error:(15, 54) No resource found that matches the given name (at 'android:actionModeCloseDrawable' with value '#drawable/abc_ic_ab_back_mtrl_am_alpha').
You are referring a private resource.
As you can check in the google tracker a possible solution is
to try change the reference of abc_ic_ab_back_mtrl_am_alpha to abc_ic_ab_back_material in your style.
i am using Android Studio and despite all the projects in the old projects folder are working fine, when i try to
create a new project, AS could not recognise AppCompatActivity class
please have a look at the build.gradle and the style folders
please let em know how solve it
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.com.myapplication"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
}
style:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
</resources>
update: after : com.android.support:appcompat-v7:23.1.1
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not resolve com.android.support:appcompat-v7:23.1.1.
Required by:
MyApplication4:app:unspecified
> Could not resolve com.android.support:appcompat-v7:23.1.1.
> Could not get resource
'https://jcenter.bintray.com/com/android/support/appcompat-
v7/23.1.1/appcompat-v7-23.1.1.pom'.
> Could not GET
'https://jcenter.bintray.com/com/android/support/appcompat-
v7/23.1.1/appcompat-v7-23.1.1.pom'.
> Connection to https://jcenter.bintray.com refused
Hello developers friends!
I am studying development for Android in recent months.
But just this last week came the question . How can I solve the problem of the image below ?
ActionBar is deprecated in the latest android api... If you need to use it make sure your theme read as follow:
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
you can find this in:
res > values > styles.xml
I was also getting these errors.
Solved by setting similar versions to the fields in gradle file as below
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.intplus.hijackid"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.0'
}
Observe the versions compileSdkVersion, buildToolsVersion, targetSdkVersion also the support v7 version.
I was having appcompat-v7:21.0.3. Changes as shown above fixed the issues!
I am fighting against Android and compatibility library AppCompat and I am loosing. I come here crying for help.
Since I would like to use a NavigationDrawer (using the code automatically generated by Android Studio) I have to start using the AppCompat library. My app does not work any more because the builder cannot find the theme AppCompat.
I followed all the steps here: https://developer.android.com/tools/support-library/setup.html#add-library
This is the gradle file "Module:app":
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "19.1"
defaultConfig {
applicationId "it.misc.application"
minSdkVersion 19
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(':another-library-here.')
}
And this is the res/values/style.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
The error is:
Error:Error retrieving parent for item: No resource found
that matches the given name
'android:Theme.AppCompat.Light.DarkActionBar'.
Since I did everything the doc says and I also removed/reinstalled the compatibility library as suggested in an answer to another StackOverflow question, I do not know what else I could try.
Could it be related to the fact that I am using API and build tools ver. 19 and the the Android Support Library 21.0.3? (I think not, but ...)
This is the new gradle, but building keeps failing:
android {
compileSdkVersion 19
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "it.autostradetech.orchestra.negoziante"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(':orchestra.autostradetech.it.')
}
Nothing changes if I set minSdkVersion to 14, 7, 8, or any other random number.
It's not android:Theme.AppCompat just Theme.AppCompat. Only resources from framework have the prefix.
Also change the compile SDK version to 21. The support library version, target SDK and compile SDK versions should correspond.
Replace:
<style name="AppTheme" parent="android:Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
with:
<style name="AppTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
Try changing compileSdkVersion and targetSdkVersion to 21, and change this in your Project Settings also. If you really want to use the appcompat-v7 library, then I suppose minSdkVersion should be at least 14.
EDIT: And it needs to be Theme.AppCompat.Light.DarkActionBar, not android:Theme.AppCompat.Light.DarkActionBar.
Try this solution as suggested in this question.
File->Import (android-sdk\extras\android\support\v7). Choose
"appcompat"
Project-> properties->Android. In the section library "Add" and
choose "appCompat"
I'm new to Android programming. I want to use Android Studio (I have the newest one, version 0.8.2), and style my Action Bar.
The Gradle throws the following error during the build process:
Error:Error retrieving parent for item: No resource found that matches the given name '#android:style/Theme.AppCompat.Light.DarkActionBar'.
Here's my style.xml file:
<resources>
<!-- Base application theme. -->
<style
name="AppTheme"
parent="#android:style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/SocialExitActionBar</item>
</style>
<style
name="SocialExitActionBar"
parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#drawable/tranparent</item>
</style>
</resources>
It's the same as the Google's documentation. In every question, I found, the answer was to add the appcompat Library. But I have the appcompat library added in my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.procode.socialexit"
minSdkVersion 11
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
}
Here's on pic:
link
Thanks for your help!
I had to remove the #android:style/ before each parent value.