我正在一个项目工作,显然它抛出异常配置'compile'已经过时,已被'implementation'和'api'取代。
这是我的app build.gradle:
apply plugin: 'com.android.application'android {
compileSdkVersion 27
defaultConfig {
applicationId "app.ayon.visiterbook"
minSdkVersion 17
targetSdkVersion 27
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:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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'
compile 'com.android.volley:volley:1.0.0'
compile 'com.intuit.sdp:sdp-android:1.0.3'
compile 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
compile 'com.sdsmdg.tastytoast:tastytoast:0.1.1'}
和我的gradle文件:
buildscript
{
repositories {
google()
jcenter()
}
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 {
google()
jcenter()
}}task clean(type: Delete) {
delete rootProject.buildDir}
答案 0 :(得分:1)
这是一个警告,谷歌已将compile
更改为implementation
,而api
,compile
将于2018年底删除
所以只需将您的compile
更改为implementation
到
compile 'com.android.volley:volley:1.0.0'
compile 'com.intuit.sdp:sdp-android:1.0.3'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.sdsmdg.tastytoast:tastytoast:0.1.1'
此
implementation 'com.android.volley:volley:1.0.0'
implementation 'com.intuit.sdp:sdp-android:1.0.3'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.sdsmdg.tastytoast:tastytoast:0.1.1'
答案 1 :(得分:1)
将compile
文件中的implementation
更改为build.gradle
对我来说有用。