android - android studio 3.6 中的 Gradle 同步失败
问题描述
Gradle 同步失败:不知道如何为 org.gradle.tooling.internal.gradle.DefaultGradleBuild@61cdce4 构建模型
**// 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:2.2.3'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://oss.sonatype.org/content/groups/public/" }
}
}
build.gradle(模块:应用程序)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.graphhopper.android"
minSdkVersion 10
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
lintOptions {
disable 'InvalidPackage'
}
}
dependencies {
compile(group: 'com.graphhopper', name: 'graphhopper-core', version: '0.9-SNAPSHOT') {
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'org.openstreetmap.osmosis', module: 'osmosis-osm-binary'
exclude group: 'org.apache.xmlgraphics', module: 'xmlgraphics-commons'
}
compile 'org.mapsforge:vtm:0.6.0'
compile 'org.mapsforge:vtm-android:0.6.0'
compile 'org.mapsforge:vtm-android:0.6.0:natives-armeabi'
compile 'org.mapsforge:vtm-android:0.6.0:natives-armeabi-v7a'
compile 'org.mapsforge:vtm-android:0.6.0:natives-x86'
compile 'org.mapsforge:vtm-jts:0.6.0'
compile 'org.mapsforge:vtm-themes:0.6.0'
compile 'com.caverock:androidsvg:1.2.2-beta-1'
compile 'com.vividsolutions:jts:1.13'
compile 'org.slf4j:slf4j-api:1.7.21'
compile 'org.slf4j:slf4j-android:1.7.21'
}
我正在使用安卓工作室 3.6。我无法构建项目。我试图使缓存/重启无效,但没有奏效。
解决方案
请将类路径更新到最新版本并检查
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
至
buildscript {
repositories {
google() //add here
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
}
}
allprojects {
repositories {
google() //and here also
jcenter()
maven { url "https://jitpack.io" }
}
}
构建.gradle(应用程序:)
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.graphhopper.android"
minSdkVersion 16
targetSdkVersion 29
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
disable 'InvalidPackage'
}
}
dependencies {
compile(group: 'com.graphhopper', name: 'graphhopper-core', version: '0.9-SNAPSHOT') {
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'org.openstreetmap.osmosis', module: 'osmosis-osm-binary'
exclude group: 'org.apache.xmlgraphics', module: 'xmlgraphics-commons'
}
compile 'org.mapsforge:vtm:0.6.0'
compile 'org.mapsforge:vtm-android:0.6.0'
compile 'org.mapsforge:vtm-android:0.6.0:natives-armeabi'
compile 'org.mapsforge:vtm-android:0.6.0:natives-armeabi-v7a'
compile 'org.mapsforge:vtm-android:0.6.0:natives-x86'
compile 'org.mapsforge:vtm-jts:0.6.0'
compile 'org.mapsforge:vtm-themes:0.6.0'
compile 'com.caverock:androidsvg:1.2.2-beta-1'
compile 'com.vividsolutions:jts:1.13'
compile 'org.slf4j:slf4j-api:1.7.21'
compile 'org.slf4j:slf4j-android:1.7.21'
}
推荐阅读
- django - 在 django 中翻译模型的一个字段
- python - 如何从另一个数组中减去一个 NumPy 数组,条件是第一个数组的元素
- c# - Difference between Any() and FirstOrDefault() !=null when querying database with EF Core
- google-apps-script - 从 Google 表格中导出图片
- xcode - Xcode:有没有办法添加 *run-phase* pre-action 脚本?(提示:不是构建阶段)
- bash - 使用 mapfile 调用 rsync
- php - PHP Cassandra 随机繁忙的 I/O 线程,请求超时
- typescript - 将任何[] 转换为字符串[] | 将列表(任意)转换为列表(字符串)
- javascript - 在哪些情况下 normalize('NFKC') 方法有效?
- web-services - 码头如何使用“jetty.http.idleTimeout=2000”?