错误:没有这样的属性:类的defaultConfig:java.lang.String

时间:2018-01-23 09:12:57

标签: java android android-studio build.gradle

  

错误:没有这样的属性:类的defaultConfig:java.lang.String

我在同步项目后立即收到此错误,但同一个项目在其他人的计算机上工作正常。 我找不到问题请帮我解决这个问题。

这是build.gradle

 apply plugin: 'com.android.application'
android {
android.defaultConfig.vectorDrawables.setUseSupportLibrary(true)
dexOptions {
    javaMaxHeapSize "4g"
    preDexLibraries false
}
compileSdkVersion 26
buildToolsVersion "25.0.2"
defaultConfig {
    applicationId "com.Aven.andromedia"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 3
    versionName "1.0"
    testInstrumentationRunner"android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
    multiDexEnabled true
    vectorDrawables {
        useSupportLibrary = true
    }
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}


dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})


compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.aurelhubert:ahbottomnavigation:2.1.0'
compile 'com.android.support:support-vector-drawable:26.1.0'
compile 'devlight.io:navigationtabbar:1.2.5'
compile 'com.android.support:support-v4:26.3.1'
compile 'com.leo.simplearcloader:simplearcloader:1.0.+'
compile 'com.github.jd-alexander:LikeButton:0.2.3'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:okhttp:3.7.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2'
compile 'com.jakewharton.timber:timber:3.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.google.android.gms:play-services-auth:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.firebase:firebase-ads:11.8.0'
compile 'com.github.vivchar:ViewPagerIndicator:v1.0.1'
compile 'com.github.GrenderG:Toasty:1.2.5'
compile 'com.anjlab.android.iab.v3:library:1.0.44'
compile 'com.yayandroid:ParallaxRecyclerView:1.1'
compile 'com.facebook.android:facebook-android-sdk:4.29.0'
compile 'pl.bclogic:pulsator4droid:1.0.3'
compile 'com.jaredrummler:animated-svg-view:1.0.5'
compile 'com.miguelcatalan:materialsearchview:1.4.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

2 个答案:

答案 0 :(得分:0)

请问您运行的是哪个gradle版本? 如果更新到gradle 3.0后发生错误,您可能需要查看Gradle 3.0 migration guide以获取帮助。

答案 1 :(得分:0)

您应该删除第android.defaultConfig.vectorDrawables.setUseSupportLibrary(true)