构建应用程序时出现“找不到资源”错误

7
我想把我的Eclipse项目迁移到Android Studio。我以前构建项目时使用的minSdkVersion=8,但我想添加新功能,需要minSdkVersion 10。
我正在运行Android Studio 1.1.0。导入Eclipse项目(在AS主屏幕上“导入项目”),我进入“项目结构”窗口,选择“口味”选项卡,并指定Gingerbread API 10作为min sdk和target sdk。当我重新构建项目时,在控制台中会出现100多个错误,看起来像这样:

Information:Gradle tasks [clean, :jellyWatch:compileDebugSources] :jellyWatch:clean :jellyWatch:preBuild UP-TO-DATE :jellyWatch:preDebugBuild UP-TO-DATE :jellyWatch:checkDebugManifest :jellyWatch:preReleaseBuild UP-TO-DATE :jellyWatch:prepareComAndroidSupportAppcompatV72200Library :jellyWatch:prepareComAndroidSupportMediarouterV72200Library :jellyWatch:prepareComAndroidSupportSupportV42200Library :jellyWatch:prepareComGoogleAndroidGmsPlayServices750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesAds750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesAnalytics750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesAppindexing750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesAppinvite750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesAppstate750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesBase750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesCast750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesDrive750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesFitness750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesGames750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesGcm750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesIdentity750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesLocation750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesMaps750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesNearby750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesPanorama750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesPlus750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesSafetynet750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesWallet750Library :jellyWatch:prepareComGoogleAndroidGmsPlayServicesWearable750Library :jellyWatch:prepareDebugDependencies :jellyWatch:compileDebugAidl :jellyWatch:compileDebugRenderscript :jellyWatch:generateDebugBuildConfig :jellyWatch:generateDebugAssets UP-TO-DATE :jellyWatch:mergeDebugAssets :jellyWatch:generateDebugResValues UP-TO-DATE :jellyWatch:generateDebugResources :jellyWatch:mergeDebugResources /Users/oreilly/Documents/workspace/JellyWatch1/jellyWatch/src/main/res/drawable/creative_commons.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited /Users/oreilly/Documents/workspace/JellyWatch1/jellyWatch/src/main/res/drawable/mapmarker.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited /Users/oreilly/Documents/workspace/JellyWatch1/jellyWatch/src/main/res/drawable/other_29.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited /Users/oreilly/Documents/workspace/JellyWatch1/jellyWatch/src/main/res/drawable/license_label.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited /Users/oreilly/Documents/workspace/JellyWatch1/jellyWatch/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.0.0/res/drawable-hdpi-v4/abc_spinner_mtrl_am_alpha.9.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited /Users/oreilly/Documents/workspace/JellyWatch1/jellyWatch/src/main/res/drawable/mapmarker_large.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited :jellyWatch:processDebugManifest :jellyWatch:processDebugResources /Users/oreilly/Documents/workspace/JellyWatch1/jellyWatch/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.0.0/res/values-v11/values.xml Error:(47, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'. Error:(47, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'. Error:(47, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'. Error:(47, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'. /Users/oreilly/Documents/workspace/JellyWatch1/jellyWatch/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.0.0/res/values-v14/values.xml Error:(17, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'. Error:(17, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'. Error:(17, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'. Error:(17, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'. /Users/oreilly/Documents/workspace/JellyWatch1/jellyWatch/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.0.0/res/values-v17/values.xml Error:(7, 21) No resource found that matches the given name: attr 'android:paddingEnd'. Error:(11, 21) No resource found that matches the given name: attr 'android:layout_marginEnd'. Error:(10, 21) No resource found that matches the given name: attr 'android:paddingStart'. Error:(7, 21) No resource found that matches the given name: attr 'android:paddingEnd'. Error:(10, 21) No resource found that matches the given name: attr 'android:paddingStart'. Error:(7, 21) No resource found that matches the given name: attr 'android:paddingEnd'. Error:(21, 21) No resource found that matches the given name: attr 'android:layout_marginStart'. Error:(24, 21) No resource found that matches the given name: attr 'android:layout_alignParentStart'. Error:(25, 21) No resource found that matches the given name: attr 'android:textAlignment'. Error:(7, 21) No resource found that matches the given name: attr 'android:paddingEnd'. Error:(10, 21) No resource found that matches the given name: attr 'android:paddingStart'. Error:(24, 21) No resource found that matches the given name: attr 'android:layout_alignParentStart'. Error:(35, 21) No resource found that matches the given name: attr 'android:layout_toStartOf'. Error:(38, 21) No resource found that matches the given name: attr 'android:layout_alignParentEnd'. Error:(42, 21) No resource found that matches the given name: attr 'android:layout_toEndOf'. Error:(35, 21) No resource found that matches the given name: attr 'android:layout_toStartOf'. Error:(21, 21) No resource found that matches the given name: attr 'android:layout_marginStart'. /Users/oreilly/Documents/workspace/JellyWatch1/jellyWatch/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.0.0/res/values-v21/values.xml Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Subtitle'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Title'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Menu'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.TextView.SpinnerItem'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material'. Error:(79, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'. Error:(78, 21) No resource found that matches the given name: attr 'android:colorControlNormal'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.ActionBar'. Error:(79, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'. Error:(78, 21) No resource found that matches the given name: attr 'android:colorControlNormal'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Dark'. Error:(79, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'. Error:(78, 21) No resource found that matches the given name: attr 'android:colorControlNormal'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Dark.ActionBar'. Error:(79, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'. Error:(78, 21) No resource found that matches the given name: attr 'android:colorControlNormal'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:ThemeOverlay.Material.Light'. Error:(79, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'. Error:(78, 21) No resource found that matches the given name: attr 'android:colorControlNormal'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Small'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.DropDownItem.Spinner'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.PopupMenu'. Error:(285, 21) No resource found that matches the given name: attr 'android:overlapAnchor'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListPopupWindow'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView.DropDown'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.PopupMenu'. Error:(285, 21) No resource found that matches the given name: attr 'android:overlapAnchor'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.RatingBar'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.TextView.SpinnerItem'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Toolbar.Button.Navigation'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Dialog'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'. Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.Dialog'. Error:(146, 21) No resource found that matches the given name: attr 'android:colorAccent'. Error:(148, 21) No resource found that matches the given name: attr 'android:colorControlActivated'. Error:(79, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'. Error:(78, 21) No resource found that matches the given name: attr 'android:colorControlNormal'. Error:(144, 21) No resource found that matches the given name: attr 'android:colorPrimary'. Error:(145, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'. Error:(146, 21) No resource found that matches the given name: attr 'android:colorAccent'. Error:(148, 21) No resource found that matches the given name: attr 'android:colorControlActivated'. Error:(79, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'. Error:(78, 21) No resource found that matches the given name: attr 'android:colorControlNormal'. Error:(144, 21) No resource found that matches the given name: attr 'android:colorPrimary'. Error:(145, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'. Error:(146, 21) No resource found that matches the given name: attr 'android:colorAccent'. Error:(148, 21) No resource found that matches the given name: attr 'android:colorControlActivated'. Error:(79, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'. Error:(78, 21) No resource found that matches the given name: attr 'android:colorControlNormal'. Error:(144, 21) No resource found that matches the given name: attr 'android:colorPrimary'. Error:(145, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'. Error:(146, 21) No resource found that matches the given name: attr 'android:colorAccent'. Error:(148, 21) No resource found that matches the given name: attr 'android:colorControlActivated'. Error:(79, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'. Error:(78, 21) No resource found that matches the given name: attr 'android:colorControlNormal'. Error:(144, 21) No resource found that matches the given name: attr 'android:colorPrimary'. Error:(145, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'. Error:Execution failed for task ':jellyWatch:processDebugResources'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/oreilly/android-sdk-macosx/build-tools/21.1.2/aapt'' finished with non-zero exit value 1 Blockquote

有什么想法,为什么会出现这些错误?如何解决?
谢谢! 汤姆

你的Android Studio项目中的所有可绘制对象是否都成功复制到了drawable目录中?你提到的第一个错误说找不到actionModeShareDrawable(或者拼写不正确)。为什么你要使用Android Studio 1.1而不是当前版本1.3呢? - joshgoldeneagle
日志格式可能有些混乱,但我认为所有的可绘制资源都已复制过去了。我会升级我的Android Studio到当前版本并再次尝试。 - Tomasso
我升级到了Android Studio 1.3.1,但是仍然出现相同的错误。 - Tomasso
2个回答

8
问题的原因和解决方案是由于我的指定minSdkVersion和app-compat库之间不兼容,如此处所述。

当更改minSdk和appCompat时,可能会遇到与主题相关的问题(例如从23到19.1,就没有Holo themes)。已点赞,对我有用。 - tony gil

6

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接