我从旧版本的 eclipse 导入了一个应用程序,在修复了 build.gradle 的所有问题后,我尝试运行该应用程序,但 Android Studio 说:
Execution failed for task ':processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
> Could not isolate value com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskWorkActionParameters_Decorated@ab68ed4 of type LinkApplicationAndroidResourcesTask.TaskWorkActionParameters
> Could not resolve all files for configuration ':detachedConfiguration3'.
> Cannot resolve external dependency com.android.tools.build:aapt2:8.3.2-10880808 because no repositories are defined.
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
但是我当然定义了存储库。
这是我的 build.gradle 文件:
buildscript {
repositories {
google()
mavenCentral()
mavenLocal()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.2'
fileTree(dir: 'libs', include: '*.jar')
}
}
apply plugin: 'com.android.application'
android {
defaultConfig {
compileSdk 21
}
namespace "com.example.app"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
androidTest .setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
dependencies {
//implementation 'com.android.tools.build:aapt2:8.3.2-10880808'
}
现在我有 4 个存储库,但使用 Google 存储库应该可以工作。我尝试将依赖项添加到依赖项中,但错误最终是相同的。
有什么想法吗?我错过了什么吗?而且我也不知道这个依赖用在哪里。
P.D.:这是我的第一篇文章,如果我的解释有点混乱,请告诉我,