Android Studio 1.1.0 Gradle项目同步失败在OSX上导入Gradle项目时出错

Bal*_*ick 11 macos android cradle android-studio android-gradle-plugin

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

编辑launchd.conf文件

sudo vim /etc/launchd.conf
Run Code Online (Sandbox Code Playgroud)

设置变量GRAILS_HOME

setenv GRAILS_HOME /Users/joanet/Development/gradle-2.3
Run Code Online (Sandbox Code Playgroud)

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

使用文件 - >导入项目

但我收到此错误: Gradle项目同步失败,错误:在Android Studio中找不到名称为"default"的配置

我试过这个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()
    }
}
Run Code Online (Sandbox Code Playgroud)

和/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')
}
Run Code Online (Sandbox Code Playgroud)

这里是settings.gradle:

include ':app', '..:DFULibrary:dfu'
Run Code Online (Sandbox Code Playgroud)

这里是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()
    }
}
Run Code Online (Sandbox Code Playgroud)

Jar*_*ows 5

我刚下载了这个项目.

首先来看看settings.gradle:

include ':app', '..:DFULibrary:dfu'
Run Code Online (Sandbox Code Playgroud)

有一个项目,..:DFULibrary:dfu在Github项目中没有提供.

二,看看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')
}
Run Code Online (Sandbox Code Playgroud)

该行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文件夹中,其源代码位于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)

你应该全力以赴!