gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:46:51 27 4
gpt4 key购买 nike

我刚刚在这个文件夹中安装了 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 中找不到名称为“default”的配置

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

enter image description here

这里是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')
}

这里设置.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()
}
}

最佳答案

我刚刚下载了项目。

先看settings.gradle:

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

有一个项目,..: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')
}

compile project(':..:DFULibrary:dfu') 行试图编译一个您没有的项目。

三、阅读README.md:

Dependencies

In order to compile the project the DFU Library is required. This project may be found here: https://github.com/NordicSemiconductor/Android-DFU-Library. Please clone the nRF Toolbox and the DFU Library to the same root folder. The dependency is already configured in the gradle and set to ..:DFULibrary:dfu module.

The nRF Toolbox also uses the nRF Logger API library which may be found here: https://github.com/NordicSemiconductor/nRF-Logger-API. The library (jar file) and is located in the libs folder and a jar with its source code in the source folder in the app module. This library allows the app to create log entries in the nRF Logger application. Please, read the library documentation on GitHub for more information about the usage and permissions.

The graph in HRM profile is created using the AChartEngine v1.1.0 contributed based on the Apache 2.0 license.

项目的所有者在这里为您提供了其他项目站点的 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-Library 重命名为 DFULibrary。 (mv Android-DFU-Library DFULibrary)

你应该准备好了!

关于Android Studio 1.1.0 Gradle 项目同步失败在 OSX 上导入 Gradle 项目时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29591375/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com