尝试创建 gradle 构建的问题 [英] Problems trying to create gradle build

查看:37
本文介绍了尝试创建 gradle 构建的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近迁移到了 Android Studio(来自 Intellij).我目前正在尝试迁移我们的项目以使用 gradle 进行构建.我已尝试将其调整到我们当前的文件夹结构中,并尝试迁移我们的文件以匹配 gradle 文件结构.

We have recently migrated to Android Studio (from Intellij). I am currently trying to migrate our project to use gradle for builds. I have tried fitting it around our current folder structure, and I have tried to migrate our files to match the gradle file structure.

我在各个方面都有错误,我一直在寻找答案,但找不到与我们所得到的完全匹配的任何内容.

I have had errors each way, I have been looking for an answer, but can't find anything that quite matches what we are getting.

尝试迁移到 gradle 文件结构时遇到的错误是:

The error I get when trying to migrate to the gradle file structure is:

  • 出了什么问题:

  • What went wrong:

配置项目:"时出现问题.

A problem occurred configuring project ':'.

未能通知项目评估侦听器.未找到名为default"的配置

Failed to notify project evaluation listener. Configuration with name 'default' not found

我在使用旧文件结构时遇到的错误是:

The error I get using our old file structure is:

:<project>:processDebugResources
/Users/kbrown/dev/AndroidClient/<project>/build/res/all/debug/values/values.xml:311: error: Error retrieving parent for item: No resource found that matches the given name '@style/Widget.Sherlock.ActionBar.Solid'.
/Users/kbrown/dev/AndroidClient/<project>/build/res/all/debug/values/values.xml:312: error: Error: No resource found that matches the given name: attr 'background'.
/Users/kbrown/dev/AndroidClient/<project>/build/res/all/debug/values/values.xml:314: error: Error: No resource found that matches the given name: attr 'backgroundSplit'.

关于去哪里寻找的任何想法.我们确实有一些对像 ActionBarSherlock 这样的库的引用.

Any ideas on where to look. We do have a couple references to libraries like ActionBarSherlock.

build.gradle

build.gradle

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.4'
    }
}
apply plugin: 'android'

dependencies {
    compile files('libs/android-support-v4.jar')
    compile files('libs/retrofit-1.0.0-SNAPSHOT.jar')
    compile project(':ThirdParty:ActionBarSherlock')
    compile project(':ThirdParty:drag-sort-listview')
    compile project(':ThirdParty:SlidingMenu')
    compile project(':ThirdParty:Android-ViewPagerIndicator')
}


android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 17
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            resources.srcDirs = ['src']
            res.srcDirs = ['res']

        }

        instrumentTest.setRoot('../UnitTests/src')
    }
}

settings.gradle

settings.gradle

include ':library:Android-ViewPagerIndicator',':library:SlidingMenu',':library:drag-sort-listview',':library:ActionBarSherlock',':<project>'

任何想法将不胜感激.

推荐答案

通过查看您的依赖项:

dependencies {
compile files('libs/android-support-v4.jar')
compile files('libs/retrofit-1.0.0-SNAPSHOT.jar')
compile project(':ThirdParty:ActionBarSherlock')
compile project(':ThirdParty:drag-sort-listview')
compile project(':ThirdParty:SlidingMenu')
compile project(':ThirdParty:Android-ViewPagerIndicator')
}

你应该在你的 settings.gradle 中:
include ':ThirdParty:Android-ViewPagerIndicator' .... 而不是 include ':library:Android-ViewPagerIndicator' ....

You should have in your settings.gradle :
include ':ThirdParty:Android-ViewPagerIndicator' .... rather than include ':library:Android-ViewPagerIndicator' ....

这篇关于尝试创建 gradle 构建的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆