I have a big project with few dependencies and I want to add the v7 gridlayout support library too, but after that, i cant build my project anymore.
Adding the library in build.gradle like this (I use Android Studio 1.5.1) :
compile 'com.android.support:gridlayout-v7:21.0.0'
Sync project working, but after that i cant find android.support.v7.widget.GridLayout and when i try to build my project I have the following error :
C:\Users\jgully\AndroidStudioProjects\swingmobile\SwingMobileEngine\res\values\colors.xml
> Error:(2) Attribute "orientation" has already been defined
Error:Execution failed for task ':SwingMobileEngine:processReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\jgull\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1
So I suspect a attribute declared twice in two different dependecies but i dont know how i can fix that.
I have find a similiar problem here with viewpagerindicator: Error:Attribute "android:orientation" has already been defined
colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="blue_light">#2D9DC8</color>
<color name="blue_dark">#314d61</color>
<color name="white">#FFFFFF</color>
<color name="green_light">#308A24</color>
<color name="black">#000000</color>
<color name="black_light">#333</color>
<color name="grey_light">#A1A1A1</color>
<color name="red">#C20031</color>
<color name="green_dark">#496948</color>
<color name="grey">#363636</color>
<color name="grey_dark">#424242</color>
<color name="grey_dark_alpha_50">#88424242</color>
<color name="vpi__background_holo_dark">#ff000000</color>
<color name="vpi__background_holo_light">#fff3f3f3</color>
<color name="vpi__bright_foreground_holo_dark">#color/vpi__background_holo_light</color>
<color name="vpi__bright_foreground_holo_light">#color/vpi__background_holo_dark</color>
<color name="vpi__bright_foreground_disabled_holo_dark">#ff4c4c4c</color>
<color name="vpi__bright_foreground_disabled_holo_light">#ffb2b2b2</color>
<color name="vpi__bright_foreground_inverse_holo_dark">
#color/vpi__bright_foreground_holo_light
</color>
<color name="vpi__bright_foreground_inverse_holo_light">
#color/vpi__bright_foreground_holo_dark
</color>
<!-- To override values in legacy projects (if needed) -->
<color name="dialog_default_text_color">#ffffff</color>
<color name="dialog_default_background_color">#000000</color>
<!-- end of to override values in legacy projects (if needed) -->
<!-- Listview gray divider -->
<drawable name="listview_graydivider">#CCCCCC</drawable>
<!-- Gradient values (Default is SWB) -->
<color name="default_dialog_gradient_firstcolor">#868686</color>
<!-- FFA938 -->
<color name="default_dialog_gradient_secondcolor">#a5a5a5</color>
<!-- FFAF47 -->
<color name="default_dialog_gradient_thirdcolor">#5b5b5b</color>
<!-- D4831A -->
<color name="default_dialog_gradient_fourthcolor">#727272</color>
<!-- F29729 -->
<color name="default_dialog_gradient_dark_firstcolor">#222222</color>
<!-- A97025 -->
<color name="default_dialog_gradient_dark_secondcolor">#2b2b2b</color>
<!-- A9732E -->
<color name="default_dialog_gradient_dark_thirdcolor">#181818</color>
<!-- B55711 -->
<color name="default_dialog_gradient_dark_fourthcolor">#1e1e1e</color>
<!-- 9F6314 -->
All dependecies of the project
Zxing
pdfview
com.android.support:support-v4:21.0.0
itextpdf-5.3.2
com.android.support:appcompat-v7:21.0.3
com.google.android.gms:play-services:6.5.87
com.android.support:multidex:1.0.1
com.crashlytics.sdk.android:crashlytics:2.5.2
note : im not the author of the begin of this project and i dont know where some lib is used
Related
Please help I am getting this error:
Failed to generate resource table for split ''
/storage/emulated/0/Download/simple-keyboard-94/simple-keyboard-94/app/src/main/res/values-v31/colors.xml:3: error: Error: No resource found that matches the given name (at 'background_lxx_system' with value '#android:color/system_neutral1_100').
The text of the colors.xml file:
<resources>
<color name="background_lxx_system">#android:color/system_neutral1_100</color>
<color name="background_secondary_lxx_system">#android:color/system_neutral1_200</color>
<color name="key_text_color_lxx_system">#android:color/system_accent1_800</color>
<color name="key_functional_text_color_lxx_system">#android:color/system_accent1_800</color>
<color name="key_text_inactive_color_lxx_system">#android:color/system_accent1_800</color>
<color name="key_hint_letter_color_lxx_system">#android:color/system_accent2_600</color>
<color name="language_on_spacebar_text_color_lxx_system">#android:color/system_accent1_800</color>
<color name="sliding_key_input_preview_color_lxx_system">#android:color/system_accent1_800</color>
<color name="key_background_normal_lxx_system">#android:color/system_neutral1_50</color>
<color name="key_background_pressed_lxx_system">#android:color/system_neutral1_300</color>
<dimen name="button_corner_radius_lxx_system">4dp</dimen>
</resources>```
I come through his error:
Couldn't resolve resource #color/teal_200
i modify the color resource file
<color name="colorPrimary">#ffe400</color>
<color name="colorPrimaryDark">#ffa600</color>
<color name="colorAccent">#272727</color>
<color name="lightWhite">#f5f5f5</color>
<color name="white">#fff</color>
<color name="black">#000</color>
how I fix this error?
You don't have a color named "teal_200" yet. You need to define one; you can add this to color.xml:
<color name="teal_200">#FF03DAC5</color>
I'm getting these duplicate resources errors.
[color/colorAccent] C:\Users\haide\Documents\androidProjects\SkyrimGenerator\SkyrimScenarioCharacterGenerator\app\src\main\res\values\strings.xml [color/colorAccent] C:\Users\haide\Documents\androidProjects\SkyrimGenerator\SkyrimScenarioCharacterGenerator\app\src\main\res\values\colors.xml: Error: Duplicate resources
[color/colorPrimary] C:\Users\haide\Documents\androidProjects\SkyrimGenerator\SkyrimScenarioCharacterGenerator\app\src\main\res\values\strings.xml [color/colorPrimary] C:\Users\haide\Documents\androidProjects\SkyrimGenerator\SkyrimScenarioCharacterGenerator\app\src\main\res\values\colors.xml: Error: Duplicate resources
[color/colorPrimaryDark] C:\Users\haide\Documents\androidProjects\SkyrimGenerator\SkyrimScenarioCharacterGenerator\app\src\main\res\values\strings.xml [color/colorPrimaryDark] C:\Users\haide\Documents\androidProjects\SkyrimGenerator\SkyrimScenarioCharacterGenerator\app\src\main\res\values\colors.xml: Error: Duplicate resources
[style/AppTheme] C:\Users\haide\Documents\androidProjects\SkyrimGenerator\SkyrimScenarioCharacterGenerator\app\src\main\res\values\strings.xml [style/AppTheme] C:\Users\haide\Documents\androidProjects\SkyrimGenerator\SkyrimScenarioCharacterGenerator\app\src\main\res\values\styles.xml: Error: Duplicate resources
Here is my colors.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
Here is my styles.xml:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
and strings.xml:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
This happened after I changed my strings.xml invalidated cache and restarted because it wouldn't update.
I tried multiple permutations of having just one apptheme and one color in a single file, but I get compilation errors. Say I delete apptheme from strings.xml and colors from color.xml, I'll get compilation error. If I have any two duplicates it'll give me duplicate error...
Does anyone know how to fix the error?
I had same issue once... I noticed that i had declared the variable colorPrimary in the app level build.gradle file and also in colors.xml. I fixed the error by removing the resource value in the build.gradle file
I had this in my app level build.gradle
defaultConfig {
...
resValue 'color', "colorPrimary", "#2196F3"
}
And this in my colors.xml
<color name="colorPrimary">#C41426</color>
I removed one of them problem solved
i am using from android Studio but i don't know problem. so i searched in stack overflow but not useful ...
please Help ...
Error color.xml
I:\New folder\app\src\main\res\values\colors.xml:1:1: Error: Content
is not allowed in prolog.
it looks like the content in color.xml was not in proper as usual format . the content in the auto generated color.xml file has colors value fore project.
for fix,copy and paste this code in color.xml file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
</resources>
if the contnet in the color.xml file is always gone like this whenever you create new android studio project ,then fix will be :-
1)click on new file, Invalidate Cache/Restart
if not then reinstall android studio
I'm trying to use a custom with Theme.AppCompat.NoActionBar but the IDE throws the error that the named resources cannot be found. Kindly assist.Any help would be greatly appreciated.
The styles.xml is as follows:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:windowActionBar">false</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="colorPrimary">#color/primary</item>
<item name="colorPrimaryDark">#color/primary_dark</item>
<item name="colorPrimaryLight">#color/primary_light</item>
<item name="colorAccent">#color/accent</item>
<item name="textColorPrimary">#color/primary_text</item>
<item name="textColorSecondary">#color/secondary_text</item>
<item name="iconColor">#color/icons</item>
<item name="dividerColor">#color/divider</item>
</style>
</resources>
The colors.xml is as follows:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary">#FF9800</color>
<color name="primary_dark">#F57C00</color>
<color name="primary_light">#FFE0B2</color>
<color name="accent">#03A9F4</color>
<color name="primary_text">#212121</color>
<color name="secondary_text">#727272</color>
<color name="icons">#212121</color>
<color name="divider">#B6B6B6</color>
</resources>
Just Build > Clean Project Then File > Invalidate Caches / Restart Project.
Rename Your xml Name, Set color.xml instead colors.xml under values folder. Then Build > Clean Project Then Restart Project .
Or try this way
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<color name="green">#00ff00</color>
Reference
Make sure you don't have any imports like mine below
import android.R
This imports the wrong resource.
I was getting the following error which seems to be similar to yours
error: resource color/color_primary (aka com.example.android.test31july:color/color_primary) not found.
I went to colors.xml and created exactly the color resource named "color_primary" and the problem vanished.
Rebuilding can take a long time.
Simply remove the offending line and re-add it.
make sure you use the color tag instead of any other tag.
<color name="name">#123</color>
try this
ContextCompat.getColor(getContext(), R.color.red800)