android - 此项目的 Gradle 设置尚未配置 - android studio
问题描述
我正在尝试加载现有项目,但遇到了以下问题:
点击确定我会得到这个:
在这里搜索我没有找到 gangle 2.2.2。最小三角为 3.0.0
build.grandle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
app.build.grande:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.prouast.heartbeat"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
// add a task that calls regular ndk-build(.cmd) script from app directory
task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') {
def ndkDir = android.ndkDirectory
commandLine "$ndkDir/ndk-build",
'-C', file('src/main/jni').absolutePath, // relative path to jni source
'NDK_LIBS_OUT=../jniLibs',
'-j', Runtime.runtime.availableProcessors(),
'all',
'NDK_DEBUG=1'
}
task ndkClean(type: Exec, description: 'Clean JNI object files') {
def ndkDir = android.ndkDirectory
commandLine "$ndkDir/ndk-build",
'-C', file('src/main/jni').absolutePath, // relative path to jni source
'NDK_LIBS_OUT=../jniLibs',
'clean'
}
// add this task as a dependency of Java compilation
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn(['ndkBuild'])
}
clean.dependsOn(['ndkClean'])
sourceSets.main {
jni.srcDirs = []
//jniLibs.srcDir 'src/main/libs'
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'org.apache.commons:commons-io:1.3.2'
compile 'com.android.support:appcompat-v7:23.1.1'
compile project(':libraries:opencv')
}
需要我在 app grandle 上更改某些内容或有人有什么建议吗?您能否建议我一些链接来遵循或逐步解释我该如何解决?
编辑
:将 jcenter 添加到 gradle.build 解决了这个问题:buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
解决方案
只需单击 OK 即可让 Studio 自动执行 Gradle 配置。
推荐阅读
- python - Pandas 根据另一列添加增量数字
- python-3.x - 无法让我的服务器响应客户端 | 蟒蛇 | 插座
- python - 使用 Tweepy 将热门词作为流获取
- java - 如何通过keycloak中的属性key(key, value)获取用户?
- node.js - 使用代理 apache 运行套接字 io 服务器
- migration - 从 TFS 2015 迁移到 Azure Devops 服务
- azure - Azure Active Directory 复制数据源与“SharePoint Online”的连接
- loops - 在 xslt 中的循环内重复位置
- wordpress - 如何在 WordPress 标签页面上显示帖子和页面?
- javascript - Laravel:使用 vue.js 提交表单后使用 Flash 消息重定向