无法解析常见的打开文件 gradle.build [英] Failed to resolve common open file gradle.build
问题描述
过去 6 个小时我一直在为这个错误而苦苦挣扎,我无法解决.我直接从 nextgis github 导入了该项目.请找出问题所在以及如何纠正.这里's 错误截图
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'
}
推荐答案
在将工作项目从一台计算机 git pull 到另一台计算机后,我遇到了同样的问题.最终解决的是确保项目 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屋!