Migrate from 'kotlin-android-extensions' to View Binding and 'kotlin-parcelize'
The 'kotlin-android-extensions' Gradle plugin is no longer supported. To migrate your project and continue using Kotlin for Android development, follow this guide to start working with View Binding and the 'kotlin-parcelize' plugin.
To resolve this issue, you need to perform the following steps:
- Open your project's build.gradle file.
- In the top-level build.gradle file, locate the buildscript section.
- In the dependencies section, find the reference to the 'kotlin-android-extensions' plugin.
- Remove this reference from the dependencies section.
- In the same build.gradle file, find your application module's build.gradle file.
- In the plugins section, replace the reference to the 'kotlin-android-extensions' plugin with the 'kotlin-parcelize' plugin.
- In the same build.gradle file, locate the android section.
- In the android section, add the following code to enable View Binding:
viewBinding { enabled = true } - Ensure all your layout files in the project are converted to use View Binding.
- Build and run your application, making sure there are no errors.
By following these steps, you will successfully migrate your project from the 'kotlin-android-extensions' plugin to View Binding and the 'kotlin-parcelize' plugin.
原文地址: https://www.cveoy.top/t/topic/p0R8 著作权归作者所有。请勿转载和采集!