当前位置:  开发笔记 > Android > 正文

在OSX上的Android Studio旧版和新版上,Gradle构建失败

如何解决《在OSX上的AndroidStudio旧版和新版上,Gradle构建失败》经验,为你挑选了0个好方法。

当我在我的PC上工作时,我有一个成功的构建项目,并且我已经提交并将其推送到我的Git仓库,然后再迁移到OSX.

现在,我在OSX上安装了Android studio最新版本并试图构建同一个项目,它在构建资源时出错.在Manifest中构建资源时,会出现多个错误

找不到与给定名称匹配的资源

对于drawables和字符串.

通过网络浏览,我想可能更新版本的gradle有一些问题.因此,我将AS的安装降级为AS 1.0并使用旧的gradle 2.2.不幸的是,这个版本的gradle也会出现同样的错误.

build.gradle看起来如下:

apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "xxx"
    minSdkVersion 16
    targetSdkVersion 21
    versionCode 4
    versionName "1.3"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets {

    main {
        res.srcDirs = [
                "/src/main/res"
        ]
    }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/thermodosdk-1.0.18.jar')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.android.support:support-v4:21.0.3'

build.gradle在顶层有以下类路径:

dependencies {
    classpath 'com.android.tools.build:gradle:1.0.0'
}

堆栈跟踪:

Information:Gradle tasks [:app:generateDebugSources,     :app:generateDebugTestSources]
:app:preBuild
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42103Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices6587Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources
/Users/vidhigoel/AndroidStudioProjects/OMGAndroid/app/build/intermediates/manifests/full/debug/AndroidManifest.xml
Error:(24, 23) No resource found that matches the given name (at 'icon' with value '@drawable/omg_app_icon').
Error:(25, 24) No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(27, 24) No resource found that matches the given name (at 'theme' with value '@style/AppTheme').
Error:(30, 28) No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(86, 28) No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(105, 28) No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(123, 28) No resource found that matches the given name (at 'label' with value '@string/app_name').
Error:(137, 28) No resource found that matches the given name (at 'label' with value '@string/title_activity_register_user').
...
Information:BUILD FAILED
Information:Total time: 4.462 secs
Information:17 errors
Information:0 warnings
Information:See complete output in console

请帮我解决这个问题.

推荐阅读
低调pasta_730
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有