Som*_*ent 16 android gradle kotlin
Google 建议用户从 迁移kotlin-android-extensions到kotlin-parcelize。
但是,Gradle 同步失败并出现以下错误:
Plugin [id: 'kotlin-parcelize'] was not found in any of the following sources:
- Gradle Core Plugins (not a core plugin, please see https://docs.gradle.org/6.1.1/userguide/standard_plugins.html for available core plugins)
- Plugin Repositories (plugin dependency must include a version number for this source)
Run Code Online (Sandbox Code Playgroud)
插件在哪里?
小智 27
kotlin-parcelize附带 Kotlin 插件1.4.20
(发布公告:弃用 Kotlin Android 扩展)
您需要升级 Kotlin 版本并再次运行 Gradle 同步。
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20"
}
Run Code Online (Sandbox Code Playgroud)
Pha*_*inh 15
1、更新你的AndroidStudio kotlin版本
从菜单中选择Tools -> Kotlin -> Configure Kotlin Plugin Updates->选择一个kotlin版本->安装->并重启AS
2,使用新的 kotlin 版本更新您的依赖项类路径,然后同步项目(如 Brown Smith 的回答)
3
build.gradle (:app)
plugins {
...
id 'kotlin-parcelize'
}
Run Code Online (Sandbox Code Playgroud)
我的对象.kt
import kotlinx.parcelize.Parcelize
@Parcelize
class MyObject(val name: String, val age: Int) : Parcelable {
}
Run Code Online (Sandbox Code Playgroud)
小智 8
这是最新的september 2021实施:
如果您使用'org.jetbrains.kotlin.android' version '1.5.20'或以上版本,并且找不到 Parcelize 标签,您可以使用以下插件中的 DSL 添加它settings.gradle:
plugins {
id "org.jetbrains.kotlin.plugin.parcelize" version "1.6.0-M1"
}
Run Code Online (Sandbox Code Playgroud)
然后在您的应用程序中build.gradle这样调用它:
plugins {
id 'org.jetbrains.kotlin.plugin.parcelize'
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8734 次 |
| 最近记录: |