首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在最近的安装上构建Support7Demos

无法在最近的安装上构建Support7Demos
EN

Stack Overflow用户
提问于 2015-10-23 01:05:45
回答 1查看 356关注 0票数 2

我试图让Support7Demos构建,但我一直遇到问题。

初始错误:

代码语言:javascript
复制
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.+'

现在我得到了:

代码语言:javascript
复制
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 --这是我碰到墙的地方。最后的错误:

代码语言:javascript
复制
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,它提供了最少的错误:

代码语言:javascript
复制
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.+'
}

请注意,更改构建工具似乎没有任何作用。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-10-23 15:06:33

一小时前我建造了Support7Demos。这是我在Eclipse工作了几年后第一次尝试迁移到Android。为了使构建在新导入Support7Demos之后工作,我必须这样做:

代码语言:javascript
复制
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。

我列出的所有依赖项都是必需的。我一个接一个地添加了它们,每个都解决了一些错误,直到一切都开始工作为止。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33293283

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档