Could not find com.android.tools.build:gradle:3.1.4
1780 ワード
最新のAndroid Studio 3.1をダウンロードしました.4、メインインタフェースのメニューオプションを直接使用し、Eclipseプロジェクトをインポートし、Android StudioのTerminalを開き、gradlewコマンドを入力し、エラーが発生しました.
./gradlew tasks
FAILURE: Build failed with an exception.
* What went wrong: A problem occurred configuring root project 'FitQRDebug'. > Could not resolve all files for configuration ':classpath'. > Could not find com.android.tools.build:gradle:3.1.4. Searched in the following locations: https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.jar Required by: project :
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
プロジェクトのbuild.gradleファイルは次のとおりです(Android Studioは自動的に作成され、変更されていません):
解決方法:
プロジェクトのbuild.gradleファイルにgoogle()依存項目を追加します.以下のようにします.
再実行OK.
./gradlew tasks
FAILURE: Build failed with an exception.
* What went wrong: A problem occurred configuring root project 'FitQRDebug'. > Could not resolve all files for configuration ':classpath'. > Could not find com.android.tools.build:gradle:3.1.4. Searched in the following locations: https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.jar Required by: project :
* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
プロジェクトのbuild.gradleファイルは次のとおりです(Android Studioは自動的に作成され、変更されていません):
// 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:3.1.4'
}
}
allprojects {
repositories {
jcenter()
}
}
解決方法:
プロジェクトのbuild.gradleファイルにgoogle()依存項目を追加します.以下のようにします.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
再実行OK.