Android Gradle issues



大家好,我刚刚打开我的安卓工作室并遇到了这些问题,尝试了研究,但没有找到摆脱这个问题的方法,请帮助我。

选项"android.enableAapt2"已被弃用,不应再使用。使用 'android.enableAapt2=true' 删除此警告。它将在2018年底被删除。无法解析:ch.acra:acra:4.9.0 在文件中显示 在"项目结构中显示"对话框 无法解析: com.astuetz:pagerslidingtabstrip:1.0.1 在文件中显示 在"项目结构中显示"对话框 无法解决: uk.co.chrisjenx:书法:2.3.0 在文件中显示 在"项目结构"对话框中显示 无法解析: com.mcxiaoke.volley:library:1.0.19 在文件中显示 在"项目结构"对话框中显示 无法解决: com.itextpdf:itextg:5.5.9 在文件中显示 在项目结构对话框中显示 无法解决: org.greenrobot:eventbus:3.0.0 在文件中显示 在项目结构对话框中显示 无法解决: com.adeel:easyFTP:1.0 在文件中显示 在项目结构中显示对话框 无法解析: cz.msebera.android:httpclient:4.4.1.2 打开"文件"在"项目结构中显示"对话框 无法解析: com.github.bumptech.glide:滑行:3.7.0 在"项目结构"对话框中打开文件显示 无法解析: com.squareup:javawriter:2.1.1 在"项目结构"对话框中打开文件显示 无法解析:javax.inject:javax.inject:1 在"项目结构"对话框中打开文件显示 无法解析:org.hamcrest:hamcrest-library:1.3 在"项目结构"对话框中打开文件显示 无法解析:org.hamcrest:hamcrest-integration:1.3 在"项目结构"对话框中打开文件显示 无法解决: com.google.code.findbugs:jsr305:2.0.1 "打开文件显示在项目结构"对话框中 无法解析:javax.annotation:javax.annotation-api:1.2 在"项目结构"对话框中打开文件显示 无法解决: Junit:Junit:4.12 在文件中显示 在"项目结构"对话框中显示

这是我的 gradle 文件

顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。

buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url 'https://maven.google.com'
}
/*jcenter()
google()*/
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

这是应用级的 gradle

应用插件:"com.android.application">

android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
multiDexEnabled true
applicationId "com.t4s.apl_test"
minSdkVersion 17
targetSdkVersion 26
versionCode 16
versionName "1.6.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
}
repositories {
maven { url "http://jzaccone.github.io/SlidingMenu-aar" }
maven { url "https://jitpack.io" }
}
}
configurations.all {
// Check for updates every build
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// Volley (HTTP library)
// Crash Reports Library (ACRA)
implementation('ch.acra:acra:4.9.0') {
exclude group: 'org.json'
}
// Volley (HTTP library)
// Volley (HTTP library)
implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.3.0'
//compile 'com.jeremyfeinstein.slidingmenu:library:1.3@aar'
implementation 'com.android.support:support-v4:26.3.0'
implementation 'com.android.support:cardview-v7:26.3.0'
implementation 'com.astuetz:pagerslidingtabstrip:1.0.1'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.google.code.gson:gson:2.7'
implementation 'com.mcxiaoke.volley:library:1.0.19'
// compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
implementation 'com.github.PhilJay:MPAndroidChart:v2.1.6'
implementation 'com.itextpdf:itextg:5.5.9'
implementation 'org.greenrobot:eventbus:3.0.0'
testImplementation 'junit:junit:4.12'
//Image Picker
implementation 'com.github.esafirm.android-image-picker:imagepicker:1.7.5'
implementation 'com.adeel:easyFTP:1.0'
implementation files('libs/simpleftp.jar')
implementation group: 'cz.msebera.android' , name: 'httpclient' , version: '4.4.1.2'
implementation 'com.android.support:multidex:1.0.3'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}

在位于项目根文件夹中的 gradle.properties 文件中,尝试替换以下行

android.enableAapt2 = false

android.enableAapt2 = true

希望这有帮助。

终于找到了解决方案。

刚刚添加了这两行

jcenter()
mavenCentral()

在应用级别分级 和在 gradle.properties

android.enableAapt2 = false

最新更新