无法解析常见的打开文件gradle.build [英] Failed to resolve common open file gradle.build
问题描述
过去6个小时我一直在努力解决这个错误,但我无法解决,我直接从nextgis github导入了该项目. 请确定出什么问题以及如何纠正. 在这里<错误的屏幕截图
I have been struggling with the past 6 hours over this one error, which i am not able to resolve.I imported the project directly from nextgis github. Please identify whats wrong and how to rectify it. here's the screen-shot of the error
此处是导致错误的模块中的build.gradle文件
here the build.gradle file from the module which contiains the error
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 14
targetSdkVersion 26
versionCode 37
versionName '2.5.7.1'
buildConfigField "String", "CLIENT_ID", "\"Im6GFdPPuPM09BnvFb3EacFZyq8TpRBSAAex7JDZ\""
}
productFlavors {
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
mavenCentral()
maven {url "https://maven.google.com"}
maven {
url "http://dl.bintray.com/krazykira/maven"
}
google()
jcenter()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':maplib')
compile 'com.4ert:easypicker:0.2.12'
compile 'com.github.yukuku:ambilwarna:2.0.1'
compile 'com.jzxiang.pickerview:TimePickerDialog:1.0.1'
compile 'com.github.miguelbcr:TableFixHeaders-Wrapper:0.2.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:preference-v7:26.1.0'
compile 'com.appyvet:materialrangebar:1.4'
}
推荐答案
在将一个正在运行的项目从一台计算机拖到另一台计算机后,我遇到了同样的问题.最终解决的问题是,确保项目gradle文件列出了google()
,并在jcenter()
之前包含了该文件. ProjectDir/build.gradle
中的最终工作形式如下:
I was having the same issue after a git pull of a working project from one computer to another. What finally resolved it was making sure the project gradle file listed google()
and had it before jcenter()
. Final working form in ProjectDir/build.gradle
looks like:
allprojects {
repositories {
google()
jcenter()
}
}
我正在使用Gradle 4.4和Android Studio Gradle插件3.1.3
I am using Gradle 4.4 and the Android Studio Gradle plugin 3.1.3
为什么它在一台计算机上而不是另一台计算机上工作,我不知道.
Why it was working on one computer and not on the other one, I have no idea.
这篇关于无法解析常见的打开文件gradle.build的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!