我正在使用Android Studio 3.2创建新项目,每次我以空白活动,选项卡式活动或任何其他类型的项目创建新项目时,项目运行都会出错。我尝试清理构建或使项目无效并重新启动android studio。以下是附加的日志:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'SampleApp'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:66)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$100(LifecycleProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator$ConfigureProject.run(LifecycleProjectEvaluator.java:110)
.......
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'. ........
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve org.apache.httpcomponents:httpmime:4.5.2. Required by:
project : > com.android.tools.build:gradle:3.2.0 > com.android.tools.analytics-library:crash:26.2.0
project : > com.android.tools.build:gradle:3.2.0 > com.android.tools.build:builder:3.2.0 > com.android.tools:sdklib:26.2.0 at org.gradle.api.internal.artifacts.ivyservice.ivyresolve ...........
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve org.apache.httpcomponents:httpmime:4.5.2. ......
Caused by: org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MetaDataParseException: Could not parse POM https://jcenter.bintray.com/org/apache/httpcomponents/httpmime/4.5.2/httpmime-4.5.2.pom ......
弹出的错误列表很长。
这是我的应用程序级别build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.sample.example.sampleapp"
minSdkVersion 15
targetSdkVersion 28
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 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
这是我的项目级别gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}