第三方Gradle插件可能是导致错误的原因

时间:2018-07-25 21:48:13

标签: android android-studio gradle gradle-plugin

我知道之前曾有人问过这个问题,但是没有一个答案能解决我的问题。错误“ 3rd-party Gradle插件可能是原因”仍然在android studio中出现,并且我已经尝试了所有方法:取消了Instant App Provisioning,使缓存无效并重新启动android studio ...无济于事。

这是我的代码

apply plugin: 'com.android.application'
apply plugin: 'android-apt'

android {
    compileSdkVersion 25
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "android.example.com.squawker"
        minSdkVersion 16
        targetSdkVersion 25
        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'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:25.1.0'
    testImplementation 'junit:junit:4.12'

    // RecyclerView
    implementation 'com.android.support:recyclerview-v7:25.1.0'

    // Schematic dependencies for ContentProvider
    apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
    implementation 'net.simonvt.schematic:schematic:0.6.3'

    // Preferences Dependencies
    implementation 'com.android.support:preference-v7:25.1.0'

    // Firebase dependency
    implementation 'com.google.firebase:firebase-messaging:10.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.0'
}
// Apply the Google Services plugin. Make sure to add the google-services.json file in the app
// folder. You download it from the Firebase console
apply plugin: 'com.google.gms.google-services'


// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2'
        classpath 'com.android.tools.build:gradle:3.1.3'

        // Google Services plugin
        classpath 'com.google.gms:google-services:4.0.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

提前谢谢!

1 个答案:

答案 0 :(得分:0)

就在错误上方,您是否看到其中包含“ kaptKotlin”的文件路径?如果您这样做,请查看此跟踪的issue

"The root issue with Kapt is that the Kapt resolver in IDEA from JetBrains registers those folders as 'being in a invalid path'. This is a misuse of the API."

解决方法似乎是检查消息并隐藏有关实际有效路径的消息。