android - Android Studio“运行应用程序时出错”编译已过时
问题描述
当我更新 android studio 并导入该项目时,我有旧的 android studio 项目,它给我这个错误我已经更新了 gradle 文件,但它总是给我这个错误。
配置“编译”已过时,已替换为“实施”和“API”[重复]
我已将所有编译更改为实现,但它总是给我这个错误。请帮我解决这个问题。这是代码....
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.ask4task.easygroc"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.1'
implementation 'com.android.support:recyclerview-v7:26.1.1'
implementation 'com.android.support:design:26.1.1'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.firebase:firebase-ads:9.6.0'
implementation 'com.google.firebase:firebase-analytics:9.6.0'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-messaging:10.2.1'
implementation 'com.android.support:cardview-v7:26.3.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.github.f0ris.sweetalert:library:1.5.1'
implementation 'me.henrytao:smooth-app-bar-layout:24.1.0.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.xiaofeng.android:flowlayoutmanager:1.2.3.2'
implementation 'com.android.support:multidex:1.0.1'
//compile 'com.razorpay:checkout:1.2.0'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
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'
}
}
}
}
apply plugin: 'com.google.gms.google-services'
解决方案
使用 Android Gradle 插件将 Gradle 版本更新到 4.4 到 3.1.4
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
build.gradle(顶级)
classpath 'com.android.tools.build:gradle:3.1.4'
推荐阅读
- ruby-on-rails - Rails 5.1 的 Encoding::UndefinedConversionError (“\xFF” 从 ASCII-8BIT 到 UTF-8) 错误
- r - 如何用文本和数字变量训练套索?
- python - 使用单个全局变量启动多个独立函数
- mysql - 我的查询有什么问题?
- python - 如果凸包是完美的矩形(python 3),如何获得构成凸包的所有点?
- string - 不同的子串计数。子字符串只能通过从字符串的开头或结尾删除来检索
- node.js - 在 mongodb 上加入集合
- opengl - 如果 Blitting 原始像素对硬件加速有任何好处
- java - 关于构造函数的 Java 泛型混淆
- java - 什么时候在 Servlet 中创建 cookie?