gpt4 book ai didi

android - “Gradle error after Android Studio update”

转载 作者:行者123 更新时间:2023-12-03 06:26:20 26 4
gpt4 key购买 nike

今天,我将Android Studio更新到了3.0版
之后,我无法成功构建项目。
我收到这些错误:

Unable to resolve dependency for ':app@release/compileClasspath': could not resolve com.android.support:appcompat-v7:27.0.1.

我尝试使用VPN或代理等,但是它们都不起作用。
这是漫长的一天。我希望你能帮助我。

这是我的build.gradle(app):
apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 27
defaultConfig {
applicationId "ir.hetbo.kotlin_tutorial"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}

这是build.gradle(project):
// Top-level build file where you can add configuration options common to 
all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.1.60'
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

我做了很多事情来修复它,但是每次失败。

我使用gradle 4.3.1

这是gradle包装器属性:
#Sat Nov 18 10:16:45 IRST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-all.zip

最佳答案

具有 gradle 4.1 类路径的新功能'com.android.tools.build:gradle:3.0.0'

distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip



这是build.gradle(project):
// Top-level build file where you can add configuration options common to 
all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.1.60'
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()

}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

关于android - “Gradle error after Android Studio update”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47355843/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com