在IntellijIDEA
中全部导入。接下来,我想将库android-support-v7-appcompat
连接到我的项目。我是按照说明做的:
和其他许多人。在所有情况下,我都有同样的错误。编译项目时IntellijIDEA
表示没有资源:
错误屏幕http://www.fayloobmennik.net/4303361
Error:android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v2
Error:android-apt-compiler: [android-support-v7-appcompat] 1\themes_base.xml:41: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.Dialog'.
Error:android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\va
Error:android-apt-compiler: [android-support-v7-appcompat] lues-v21\themes_base.xml:153: error: Error: No resource found that matches the given name: attr 'android:colorPrimary'.
C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml
Error:(75, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:75: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
Error:(79, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:79: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'.
Error:(83, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:83: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'.
Error:(25, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:25: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'.
Error:(29, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:29: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'.
Error:(33, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:33: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'.
Error:(37, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:37: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:(41, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:41: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'.
Error:(65, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:65: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'.
Error:(69, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:69: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'.
Error:(45, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:45: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Menu'.
Error:(49, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:49: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(53, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:53: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
Error:(57, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:57: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'.
Error:(61, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:61: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'.
Error:(178, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:178: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'.
Error:(182, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:182: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'.
Error:(113, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:113: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:(115, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:115: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'.
Error:(110, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:110: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.DropDownItem.Spinner'.
Error:(107, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:107: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView.DropDown'.
Error:(121, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:121: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView'.
Error:(126, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:126: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListPopupWindow'.
Error:(138, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:138: error: Error: No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:(143, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:143: error: Error: No resource found that matches the given name: attr 'android:overlapAnchor'.
Error:(129, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:129: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.PopupMenu'.
Error:(132, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:132: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.PopupMenu'.
Error:(146, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:146: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(150, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:150: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(154, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:154: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'.
Error:(158, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:158: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'.
Error:(164, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:164: error: Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Title'.
Error:(168, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:168: error: Error retrieving parent for item: No resource found that matches the given name '@android:TextAppearance.Material.SearchResult.Subtitle'.
Error:(172, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:172: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:(174, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:174: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'.
Error:(93, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:93: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Toolbar.Button.Navigation'.
Error:(97, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:97: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'.
Error:(101, -1) android-apt-compiler: [android-support-v7-appcompat] C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base.xml:101: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'.
C:\Users\Pavel\Desktop\appcompat\res\values-v21\styles_base_text.xml
C:\Users\Pavel\Desktop\appcompat\res\values-v17\styles_rtl.xml
C:\Users\Pavel\Desktop\appcompat\res\values-v21\themes_base.xml
C:\Users\Pavel\Desktop\appcompat\res\values-v11\themes_base.xml
C:\Users\Pavel\Desktop\appcompat\res\values-v14\themes_base.xml
清单
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.navigationdrawerexample"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
<application
android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:theme="@style/Theme.AppCompat.Light">
<activity
android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
答案 0 :(得分:2)
在您的项目中,将Android Build Target更改为5.0
要支持值-v21,您的构建目标应为5.0
转到File -> "Project Structure"
在Platform Settings -> SDKs
下,您可以看到android sdk路径,类路径和构建目标。
使用sdk manager首先使用最新的构建目标更新您的sdk。
如果你的sdk不是最新的,那么在类路径中你可以看到21以下的Android版本。
如果您有最新版本,那么您可以看到,类路径选择为\ android-21 \ android.jar。
或
在您的模块设置中,您可以看到“构建工具版本”。
Android Studio(IntelliJ IDEA)将采用最新版本。所以首先将你的sdk经理更新为最新版本。
答案 1 :(得分:0)
材质样式请求Android Build Tools版本20+并编译sdk版本21+。如果使用Gradle构建系统,请在build.gradle文件中更改compileSdkVersion 21或更高版本。
答案 2 :(得分:0)