'Plugin 'kotlin-parcelize' not found

Google is recommending users to migrate from kotlin-android-extensions to kotlin-parcelize.

However, Gradle sync fails with the following error:

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)

Where is the plugin located?



Solution 1:[1]

kotlin-parcelize ships with Kotlin Plugin 1.4.20
(Release Announcement: Deprecation of Kotlin Android Extensions)

You need to upgrade your Kotlin versions and run Gradle sync again.

dependencies {
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20"
}

Solution 2:[2]

1, update your AndroidStudio kotlin version
From menu, select Tools -> Kotlin -> Configure Kotlin Plugin Updates -> choose a kotlin version -> install -> and restart AS

2, update your dependencies classpath with the new kotlin version then sync project (like Brown Smith answer)

3
builld.gradle (:app)

plugins {
    ...
    id 'kotlin-parcelize'
}

MyObject.kt

import kotlinx.parcelize.Parcelize

@Parcelize
class MyObject(val name: String, val age: Int) : Parcelable {

}

Solution 3:[3]

This is the latest september 2021 implementation :

If you're using 'org.jetbrains.kotlin.android' version '1.5.20' or above , and you fail to find the parcelize tag , you can add it using the plugins DSL in the settings.gradle :

plugins {  
 id "org.jetbrains.kotlin.plugin.parcelize" version "1.6.0-M1" 
}

and then call it in your app build.gradle like this :

plugins { 
id 'org.jetbrains.kotlin.plugin.parcelize'
}

Solution 4:[4]

In your module level build.gradle file add,

plugins {
    ...
    id 'kotlin-parcelize'
}

In your project level build.gradle file add,

buildscript {
    ...
    repositories {
        google()
        jcenter()
    }
dependencies {
    ...
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32"
    
    }
}

Here '1.4.32' is the Kotlin package version. You will now be able to find the Parcelize package. Also while importing make sure to import,

'import kotlinx.parcelize.Parcelize' package.

Solution 5:[5]

Try this

in bulid.gradle (Project:*appname*) add:

buildscript {
    
    dependencies {
        ...
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
    }
}

and in bulid.gradle (Module:*appname*) add:

plugins {
    ...
    id 'org.jetbrains.kotlin.plugin.parcelize'
} 

If it didn't work for you check this link (if there's a new update): https://plugins.gradle.org/plugin/org.jetbrains.kotlin.plugin.parcelize

Solution 6:[6]

1. Make sure Gradle should be on Online mode

enter image description here

2. apply plugin: 'kotlin-parcelize'

3. need to upgrade your Kotlin versions 1.4.20 or above and run Gradle sync again.

dependencies {
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
}

Solution 7:[7]

Add this to your app level build.gradle file

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

Solution 8:[8]

in newest android studio in Nov 2021:

in setting.gradle add this line:

id("org.jetbrains.kotlin.plugin.parcelize") version "1.6.0-M1"

and in build.gradle of module:

 id("org.jetbrains.kotlin.plugin.parcelize")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Brown Smith
Solution 2
Solution 3 android gururu
Solution 4 Anubhav
Solution 5
Solution 6 vijay saini
Solution 7 kunal khedkar
Solution 8 Sana Ebadi