首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >没有找到id 'kotlin-android‘的插件。颤动

没有找到id 'kotlin-android‘的插件。颤动
EN

Stack Overflow用户
提问于 2020-07-29 10:18:25
回答 1查看 1.5K关注 0票数 1

我正在创建一个与火场相连的项目,但我认为问题不在火场.

当我试图运行这个项目时,我发现了这个错误:

代码语言:javascript
运行
复制
FAILURE: Build failed with an exception.

* Where:
Build file 'D:\Aradi Online\my_project\aol\android\app\build.gradle' line: 25

* What went wrong:
A problem occurred evaluating project ':app'.
> Plugin with id 'kotlin-android' not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4m 24s

这是build.gradle

代码语言:javascript
运行
复制
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 28

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.aol"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

我试图计算这个错误,但是我无法解决它,正如错误在下面一行中所指出的:

代码语言:javascript
运行
复制
apply plugin: 'kotlin-android'

我已经添加了这个插件.

那我该怎么解决呢.

如果有什么东西不见了我很抱歉……

我希望有人能帮助我解决这个问题。

EN

回答 1

Stack Overflow用户

发布于 2022-05-02 22:08:28

Kotlin插件可能不见了。确保在Android构建的顶级build.gradle上添加了依赖项。

代码语言:javascript
运行
复制
buildscript {
    ext.kotlin_version = '1.6.21'
    repositories {
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63151374

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档