繁体   English   中英

库 - 找不到 ID 为“com.android.library”的插件

[英]Library - Plugin with id "com.android.library" not found

我刚刚拉了一个旧项目,它是一个图书馆。 我必须对其进行编辑以生成一个新的 aar 并将其再次包含在我的主项目中。

当我拉出项目并试图打开它时,我得到了标题错误。 “错误:找不到 ID 为‘com.android.library’的插件。”

我只有一个 gradle (build.gradle),就是这个。

apply plugin: 'com.android.library'

android {
compileSdkVersion 28

lintOptions {
    abortOnError false
}
defaultConfig {
    minSdkVersion 18
    targetSdkVersion 28
    versionCode 1000000
    versionName "1.0.0"

    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        buildConfigField "String", 'BASE_URL', '"https://d.api.redlink.com.ar/redlink/desarrollo/"'

    }
    debug {
        buildConfigField "String", 'BASE_URL', '"https://d.api.redlink.com.ar/redlink/desarrollo/"'
    }
}

configurations {
    retrofit
}

}

dependencies {
api fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'

implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.0'
implementation 'com.android.support:appcompat-v7:28.0.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'

}

对我来说,我还需要指定一个类路径。 与 Abhishek 非常相似,但我补充说:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
    }
}

现在找到com.android.library

您可以尝试在您的 build.gradle 文件中添加以下代码(与 defaultConfig 处于同一级别)

buildscript {
    repositories {
        mavenCentral()
    }
}

它应该可以解决您的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM