我的Android应用程式Gradle版本无法同步,因为我将Android Studio更新至3.2。我已经更新了依赖项中的所有内容,但仍然收到相同的错误。这是我使用的依赖文件(包括第三方库)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "myappid"
minSdkVersion 19
targetSdkVersion 28
versionCode 32
versionName "3.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.11"
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:design:28.0.0-alpha1'
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha1'
implementation 'com.android.support:cardview-v7:28.0.0-alpha1'
implementation 'com.android.support:support-v4:28.0.0-alpha1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-crash:28.0.0-alpha1'
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'
implementation "org.jetbrains.anko:anko:$anko_version"
implementation 'com.github.GrenderG:Toasty:1.2.5'
implementation 'com.github.scottyab:showhidepasswordedittext:0.8'
implementation 'com.daimajia.easing:library:2.1@aar'
implementation 'com.daimajia.androidanimations:library:2.3@aar'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.google.gms:google-services:4.2.0'
implementation 'com.github.sd6352051:NiftyDialogEffects:v1.0.3'
implementation 'net.steamcrafted:load-toast:1.0.12'
implementation 'com.android.support:animated-vector-drawable:28.0.0-alpha1';
}
//apply plugin: 'com.google.gms.google-services'
//classpath 'com.google.gms:google-services:4.2.0'
但是,我收到以下错误
在此版本中使用了不推荐使用的Gradle功能,使其与Gradle 5.0不兼容。
使用“--warning-mode all”来显示各个弃用警告。
我已经尝试了大多数可以通过Google/Youtube搜索获得的功能。也实现了StackOverflow中给出的一些答案。但归根结底,这是同样的错误。我所缺少的。
请指教,如何解决问题。谢谢
最佳答案
因此,问题不一定存在于您的应用程序级别的build.gradle脚本(您发布的脚本)中。它也可以在项目一级,甚至在maven-publish-aar.gradle一级(如果有)。这意味着,您可能在任何Gradle脚本上使用了不赞成使用的Gradle功能。
最有可能的是,一旦您识别并替换了引起您此麻烦的任何不推荐使用的Gradle功能,该警告就会消失。为此,它将帮助您将提到的--warning-mode=all
标志实际上添加到Gradle命令行选项中(在Android Studio编译器设置中):
这将为您打印适当的警告,以使您知道应用程序正在使用哪些特定的不赞成使用的功能。
就我而言(例如),我只是在settings.gradle文件中添加了enableFeaturePreview('STABLE_PUBLISHING')
设置,并且做到了神奇(我正在使用publishing{}
)。
另外,我知道您在一个月前问了这个问题,但是,这对于面临相同问题的其他人可能很有用。