我试图让Support7Demos构建,但我一直遇到问题。
初始错误:
Error:(23, 21) No resource found that matches the given name: attr 'colorAccent'.
Error:(21, 21) No resource found that matches the given name: attr 'colorPrimary'.
Error:(22, 21) No resource found that matches the given name: attr 'colorPrimaryDark'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.NoActionBar'.
Error:(23, 21) No resource found that matches the given name: attr 'colorAccent'.
Error:(21, 21) No resource found that matches the given name: attr 'colorPrimary'.
Error:(22, 21) No resource found that matches the given name: attr 'colorPrimaryDark'.
Error:(35, 21) No resource found that matches the given name: attr 'alertDialogTheme'.
Error:(21, 21) No resource found that matches the given name: attr 'colorPrimary'.
Error:(22, 21) No resource found that matches the given name: attr 'colorPrimaryDark'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Dialog.Alert'.
Error:(21, 21) No resource found that matches the given name: attr 'colorPrimary'.
Error:(22, 21) No resource found that matches the given name: attr 'colorPrimaryDark'.
Error:(35, 21) No resource found that matches the given name: attr 'alertDialogTheme'.
Error:(21, 21) No resource found that matches the given name: attr 'colorPrimary'.
Error:(22, 21) No resource found that matches the given name: attr 'colorPrimaryDark'.
Error:(35, 21) No resource found that matches the given name: attr 'alertDialogTheme'.
Error:(21, 21) No resource found that matches the given name: attr 'colorPrimary'.
Error:(22, 21) No resource found that matches the given name: attr 'colorPrimaryDark'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog.Alert'.
Error:(21, 21) No resource found that matches the given name: attr 'colorPrimary'.
Error:(22, 21) No resource found that matches the given name: attr 'colorPrimaryDark'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog.Alert'.
Error:(21, 21) No resource found that matches the given name: attr 'colorPrimary'.
Error:(22, 21) No resource found that matches the given name: attr 'colorPrimaryDark'.
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '***'' finished with non-zero exit value 1将compilesDkVersion改为21,我的targetSdkVersion也改为21。没什么区别。
然后我改变了:
compile 'com.android.support:appcompat-v7:18.0.+'
至
compile 'com.android.support:appcompat-v7:21.0.+'
现在我得到了:
Error:(35, 21) No resource found that matches the given name: attr 'alertDialogTheme'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Dialog.Alert'.
Error:(35, 21) No resource found that matches the given name: attr 'alertDialogTheme'.
Error:(35, 21) No resource found that matches the given name: attr 'alertDialogTheme'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog.Alert'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog.Alert'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '***'' finished with non-zero exit value 1最后,compile 'com.android.support:appcompat-v7:21.0.+'改为v23,因为它是recommended...But --这是我碰到墙的地方。最后的错误:
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '***'' finished with non-zero exit value 1我最好的谷歌搜索导致了Error retrieving parent for item: No resource found that matches the given name after upgrading to AppCompat v23,但如果我将编译版本更改为23,那么我只会得到大量新的错误,我回到了第一步。
下面是我的build.gradle,它提供了最少的错误:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '23.0.1'
defaultConfig {
applicationId "com.example.android.supportv7"
minSdkVersion 7
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.0.+'
}请注意,更改构建工具似乎没有任何作用。
发布于 2015-10-23 15:06:33
一小时前我建造了Support7Demos。这是我在Eclipse工作了几年后第一次尝试迁移到Android。为了使构建在新导入Support7Demos之后工作,我必须这样做:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.android.supportv7"
minSdkVersion 7
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:gridlayout-v7:23.1.0'
compile 'com.android.support:palette-v7:23.1.0'
compile 'com.android.support:mediarouter-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
}我的意思是,您的主要问题是Support7Demos需要更多的依赖关系。并纠正安装在计算机上的compileSdkVersion、targetSdkVersion和buildToolsVersion。
我列出的所有依赖项都是必需的。我一个接一个地添加了它们,每个都解决了一些错误,直到一切都开始工作为止。
https://stackoverflow.com/questions/33293283
复制相似问题