InvalidPluginRequestException Gradle AndroidStudio

InvalidPluginRequestException Gradle AndroidStudio

提问人:Sumit Monapara 提问时间:10/17/2021 更新时间:10/17/2021 访问量:233

问:

我在 2 个月后导入了现有的 android 项目,当它开始同步 gradle 时,它给出了一些奇怪的错误,因为早些时候该项目运行正常。 错误是Caused by: org.gradle.plugin.management.internal.InvalidPluginRequestException: Plugin 'com.android.application' is already on the script classpath.

下面是我的 gradle 文件:build.gradle (:app)

plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "com.example.quickshop"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}
repositories {
    mavenCentral()
}



dependencies {
    implementation 'com.hbb20:ccp:2.5.0'
    implementation 'com.steelkiwi:badge-holder-view:1.1.0'

    implementation 'com.mikhaellopez:circularimageview:4.2.0'
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22'
    implementation 'me.himanshusoni.quantityview:quantity-view:1.2.0'
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22'
    implementation 'com.github.MindorksOpenSource:EditDrawableText:2.0'

    implementation 'com.razorpay:checkout:1.6.6'
    implementation 'in.shadowfax:proswipebutton:1.2.2'

    implementation 'com.google.firebase:firebase-auth:20.0.4'
    implementation 'com.google.firebase:firebase-core:17.2.1'
    implementation 'com.google.firebase:firebase-analytics:17.2.1'
    implementation 'com.google.firebase:firebase-config:19.0.3'
    implementation 'com.google.firebase:firebase-messaging'
    implementation platform('com.google.firebase:firebase-bom:26.8.0')
    implementation 'com.firebaseui:firebase-ui-database:3.2.2'
    implementation 'com.google.firebase:firebase-auth:19.2.0'
    implementation 'com.google.firebase:firebase-database:19.6.0'
    implementation 'com.google.firebase:firebase-storage:19.2.1'

    implementation 'cc.cloudist.acplibrary:library:1.2.1'

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.navigation:navigation-fragment:2.3.2'
    implementation 'androidx.navigation:navigation-ui:2.3.2'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
    implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'

    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

build.gradle(项目)

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:3.0.1"
        classpath 'com.google.gms:google-services:4.3.5'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

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

settings.gradle

include ':app'
rootProject.name = "QuickShop"

我试图为此找到解决方案,但没有找到可以解决此问题的正确解决方案,任何人都可以帮助我解决这个问题和这个新的 gradle 插件调用。

Android版本 : Android Studio Arctic Fox |2020.3.1 补丁 3, Gradle 版本:4.1, Android gradle 插件版本:3.0.1

人造人 Gradle android-gradle-插件 安卓工作室-3.0

评论

0赞 KuLdip PaTel 10/17/2021
将 buildToolsVersion “30.0.2” 更改为 buildToolsVersion “30.0.3” 然后它会像魔术一样工作。
0赞 Sumit Monapara 10/17/2021
没有运气,仍然有错误..

答: 暂无答案