11

我刚刚在这个文件夹中安装了 gradle:/Users/joanet/Development/gradle-2.3

编辑文件launchd.conf

sudo vim /etc/launchd.conf

设置变量 GRAILS_HOME

setenv GRAILS_HOME /Users/joanet/Development/gradle-2.3

然后我已经导入了项目https://github.com/NordicSemiconductor/Android-nRF-Toolbox

使用文件 -> 导入项目

但我收到此错误: Gradle 项目同步失败错误:Android Studio 中未找到名称为“默认”的配置

我试过这个https://www.youtube.com/watch?v=8RwVvZtNTaM 但没有奏效

在此处输入图像描述

这里是 build.gradle 文件:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

在这里/app/build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion '22.0.0'
    defaultConfig {
        applicationId "no.nordicsemi.android.nrftoolbox"
        minSdkVersion 18
        targetSdkVersion 22
        versionCode 30
        versionName "1.12.1"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile project(':..:DFULibrary:dfu')
    compile files('libs/achartengine-1.1.0.jar')
    compile files('libs/nrf-logger-v2.0.jar')
}

这里 settings.gradle:

include ':app', '..:DFULibrary:dfu'

这里 gradle-wrapper.properties:

#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip


// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
4

1 回答 1

5

我刚刚下载了项目。

首先看一下settings.gradle

include ':app', '..:DFULibrary:dfu'

..:DFULibrary:dfuGithub 项目中没有提供一个项目, 。

其次,看app/build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile project(':..:DFULibrary:dfu') // <-- You do not have this
    compile files('libs/achartengine-1.1.0.jar')
    compile files('libs/nrf-logger-v2.0.jar')
}

该行compile project(':..:DFULibrary:dfu')正在尝试编译您没有的项目。

第三,阅读README.md

依赖项

为了编译项目,需要 DFU 库。这个项目可以在这里找到: https ://github.com/NordicSemiconductor/Android-DFU-Library 。请将 nRF 工具箱和 DFU 库克隆到同一个根文件夹。依赖项已在 gradle 中配置并设置为 ..:DFULibrary:dfu 模块。

nRF 工具箱还使用 nRF Logger API 库,可在此处找到:https ://github.com/NordicSemiconductor/nRF-Logger-API 。该库(jar 文件)位于 libs 文件夹中,并且一个 jar 及其源代码位于 app 模块的源文件夹中。该库允许应用程序在 nRF Logger 应用程序中创建日志条目。请阅读 GitHub 上的库文档以获取有关使用和权限的更多信息。

HRM 配置文件中的图表是使用基于 Apache 2.0 许可证提供的 AChartEngine v1.1.0 创建的。

owner项目在此处为您提供其他项目站点的 URL:https ://github.com/NordicSemiconductor/Android-DFU-Library 。

结论:

只需按照他在与您当前项目相同git clone https://github.com/NordicSemiconductor/Android-DFU-Library.git的文件夹中的说明进行操作即可。之后一切都应该正常工作。

如何:

  1. git clone https://github.com/NordicSemiconductor/Android-nRF-Toolbox.git

  2. git clone https://github.com/NordicSemiconductor/Android-DFU-Library.git

  3. 重命名Android-DFU-LibraryDFULibrary. (mv Android-DFU-Library DFULibrary)

你应该准备好了!

于 2015-04-14T21:22:00.390 回答