问题
I have spent quite a bit of time converting the CastVideo-android example on github into an AndroidStudio project.
I have run into this error,
Execution failed for task ':chromecast-video:mergeDebugResources'.
/Users/a/AndroidStudioProjects/ChromecastVideoTest/chromecast-video/src/main/res/values/styles_democast.xml: Error: Duplicate resources: /Users/a/AndroidStudioProjects/ChromecastVideoTest/chromecast-video/src/main/res/values/styles_democast.xml:style/TextAppearance.ShowcaseView.Detail.Light, /Users/a/AndroidStudioProjects/ChromecastVideoTest/chromecast-video/src/main/res/values/styles_castvideo.xml:style/TextAppearance.ShowcaseView.Detail.Light
According to a response to the issue I raised on the github repo https://github.com/googlecast/CastVideos-android/issues/2 this might be a an issue with my AndroidStudio setup ... it feels like the build needs to know which styles xml to process ...
Can anyone shed some light on this?
Or possibly suggest an easier way to build the googlecast android demos ?
Many thanks.
UPDATE:
Ok, it's not an answer but it might help someone temporarily until a real answer arrives... In the end I just manually commented out the duplicate definitions from styles_democast.xml
Here is my updated res/styles/styles_democast.xml
Copyright (C) 2011 The Android Open Source Project
Copyright (C) 2012 readyState Software Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<style name="Theme.Democast" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarItemBackground">@drawable/selectable_background_democast</item>
<item name="popupMenuStyle">@style/PopupMenu.Democast</item>
<item name="dropDownListViewStyle">@style/DropDownListView.Democast</item>
<item name="actionBarTabStyle">@style/ActionBarTabStyle.Democast</item>
<item name="actionDropDownStyle">@style/DropDownNav.Democast</item>
<item name="actionBarStyle">@style/ActionBar.Solid.Democast</item>
<item name="actionModeBackground">@drawable/cab_background_top_democast</item>
<item name="actionModeSplitBackground">@drawable/cab_background_bottom_democast</item>
<item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Democast</item>
<!-- item name="android:titleTextStyle">@style/WhiteText</item -->
<!-- Light.DarkActionBar specific -->
<item name="actionBarWidgetTheme">@style/Theme.Democast.Widget</item>
<!-- Seekbar -->
<item name="android:seekBarStyle">@style/SeekBarAppTheme</item>
</style>
<!--
style name="WhiteText" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@android:color/white</item>
</style
-->
<style name="ActionBar.Solid.Democast" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">@drawable/ab_solid_democast</item>
<item name="backgroundStacked">@drawable/ab_stacked_solid_democast</item>
<item name="backgroundSplit">@drawable/ab_bottom_solid_democast</item>
<item name="progressBarStyle">@style/ProgressBar.Democast</item>
</style>
<style name="ActionBar.Transparent.Democast" parent="@style/Widget.AppCompat.ActionBar">
<item name="background">@drawable/ab_transparent_democast</item>
<item name="progressBarStyle">@style/ProgressBar.Democast</item>
</style>
<style name="PopupMenu.Democast" parent="@style/Widget.AppCompat.PopupMenu">
<item name="android:popupBackground">@drawable/menu_dropdown_panel_democast</item>
</style>
<style name="DropDownListView.Democast" parent="@style/Widget.AppCompat.ListView.DropDown">
<item name="android:listSelector">@drawable/selectable_background_democast</item>
</style>
<style name="ActionBarTabStyle.Democast" parent="@style/Widget.AppCompat.ActionBar.TabView">
<item name="android:background">@drawable/tab_indicator_ab_democast</item>
</style>
<style name="DropDownNav.Democast" parent="@style/Widget.AppCompat.Spinner.DropDown.ActionBar">
<item name="android:background">@drawable/spinner_background_ab_democast</item>
<item name="android:popupBackground">@drawable/menu_dropdown_panel_democast</item>
<item name="android:dropDownSelector">@drawable/selectable_background_democast</item>
</style>
<style name="ProgressBar.Democast" parent="@style/Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:progressDrawable">@drawable/progress_horizontal_democast</item>
</style>
<style name="ActionButton.CloseMode.Democast" parent="@style/Widget.AppCompat.ActionButton.CloseMode">
<item name="android:background">@drawable/btn_cab_done_democast</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Democast.Widget" parent="@style/Theme.AppCompat">
<item name="popupMenuStyle">@style/PopupMenu.Democast</item>
<item name="dropDownListViewStyle">@style/DropDownListView.Democast</item>
</style>
<!--
<style name="SeekBarAppTheme" parent="android:Widget.SeekBar">
<item name="android:progressDrawable">@drawable/apptheme_scrubber_progress_horizontal_holo_light</item>
<item name="android:indeterminateDrawable">@drawable/apptheme_scrubber_progress_horizontal_holo_light</item>
<item name="android:minHeight">13dip</item>
<item name="android:maxHeight">13dip</item>
<item name="android:thumb">@drawable/apptheme_scrubber_control_selector_holo_light</item>
<item name="android:thumbOffset">16dip</item>
<item name="android:paddingLeft">16dip</item>
<item name="android:paddingRight">16dip</item>
</style>
-->
<!-- goes below ... item name="android:actionBarStyle">@style/ActionBar.Transparent.Democastoverlay</item -->
<!--
<style name="Theme.DemocastOverlay" parent="@style/Theme.Democast">
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBarOverlay">true</item>
</style>
-->
<!-- goes below .... item name="progressBarStyle">@style/ProgressBar.Democastoverlay</item -->
<!--
<style name="ActionBar.Transparent.Democastoverlay" parent="@style/Widget.AppCompat.ActionBar">
<item name="background">@drawable/ab_solid_democast</item>
<item name="android:titleTextStyle">@style/WhiteText</item>
</style>
<style name="WhiteText" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@android:color/white</item>
</style>
<style name="CastDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowTitleStyle">@style/CastDialogWindowTitle</item>
</style>
-->
<!-- Show Case -->
<!--
<style name="ShowcaseButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:paddingTop">10dp</item>
<item name="android:paddingBottom">15dp</item>
<item name="android:paddingLeft">35dp</item>
<item name="android:paddingRight">35dp</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#000000</item>
<item name="android:background">@color/yellow</item>
</style>
<style name="TextAppearance.ShowcaseView.Title" parent="android:style/TextAppearance.Large">
<item name="android:textColor">#FFFFFF</item>
</style>
<style name="TextAppearance.ShowcaseView.Detail" parent="android:style/TextAppearance">
<item name="android:textColor">#FFFFFF</item>
</style>
<style name="TextAppearance.ShowcaseView.Detail.Light">
<item name="android:textColor">#666666</item>
<item name="android:shadowColor">#FF0000</item>
<item name="android:shadowRadius">0</item>
</style>
<style name="TextAppearance.ShowcaseView.Title.Light">
<item name="android:shadowRadius">0</item>
</style>
-->
</resources>
UPDATE 2:
A comment was made about another post at CastCompanionLibrary-android error code 138 when compiling
That post relates to issues with getting github.com/googlecast/CastCompanionLibrary-android to compile. The CastCompanionLibrary (CCL) is required as a dependency by CastVideos-android so some of the info there might help anyone who is generally running into difficultly building the android chromecast examples in Android Studio.
回答1:
I guess it is because you have TextAppearance.ShowcaseView.Detail.Light
in both styles_democast.xml
and styles_castvideo.xml
来源:https://stackoverflow.com/questions/21784659/castvideos-android-duplicate-resources