没有这样的属性:在Android Studio中编译为类:java.lang.String

时间:2019-01-19 10:58:56

标签: gradle android-gradle build.gradle gradle-plugin

我的项目到上个月一直运行良好,但由于某些未知原因,它现在尚未运行,它在应用程序级别build.gradle中给出了消息No such property: compile for class: java.lang.String。我的项目将近一个月保持不变。下面是我的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"

    defaultConfig {
        applicationId "com.PSS.pssreminder"
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:27.+'
    compile 'com.android.support:recyclerview-v7:27.+'
    compile 'com.getbase:floatingactionbutton:+'
    compile 'com.wdullaer:materialdatetimepicker:+'.
    compile 'com.bignerdranch.android:recyclerview-multiselect:+'
    compile 'com.amulyakhare:com.amulyakhare.textdrawable:+'

}

能帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

将所有compile关键字替换为implementationcompile已被删除,并在gradle发行版中由implementation取代。它应该看起来像这样:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.+'
    implementation 'com.android.support:recyclerview-v7:27.+'
    implementation 'com.getbase:floatingactionbutton:+'
    implementation 'com.wdullaer:materialdatetimepicker:+'.
    implementation 'com.bignerdranch.android:recyclerview-multiselect:+'
    implementation 'com.amulyakhare:com.amulyakhare.textdrawable:+'
}