Issue
I am trying to annotate a data class with @parcelize and get the following error -
Here is my gradle file -
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
android {
signingConfigs {
config {
keyAlias 'verte_internal_keystore'
keyPassword ANDROID_STORE_PASSWORD
storeFile file('verte_internal_keystore.jks')
storePassword ANDROID_KEY_PASSWORD
}
}
lintOptions {
abortOnError false
}
compileSdkVersion 29
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.twoverte"
minSdkVersion 21
targetSdkVersion 29
versionCode 16
versionName ".3.4.0"
multiDexEnabled true
buildConfigField "java.util.Date", "BUILD_TIME", "new java.util.Date(" + System.currentTimeMillis() + "L)"
}
File signFile = project.file('keyInfos.properties')
if (signFile.exists()) {
Properties properties = new Properties()
properties.load(new FileInputStream(signFile))
signingConfigs {
release {
storeFile file(project.file(properties['keystore.filename']))
storePassword properties['keystore.password']
keyAlias properties['keystore.alias']
keyPassword properties['keystore.password']
}
}
}
buildTypes {
....
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
productFlavors {
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.0.0'
configurations {
all {
exclude group: 'org.json', module: 'json'
exclude group: 'xpp3', module: 'xpp3'
}
}
//Room components
implementation 'androidx.room:room-runtime:2.2.3'
annotationProcessor 'androidx.room:room-compiler:2.2.3'
//Lifecycle components
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.1.0'
fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.cocosw:bottomsheet:1.0@aar'
implementation 'org.igniterealtime.smack:smack-android:4.1.4'
implementation 'org.igniterealtime.smack:smack-tcp:4.1.4'
implementation 'org.igniterealtime.smack:smack-im:4.1.4'
implementation 'org.igniterealtime.smack:smack-extensions:4.1.4'
implementation 'org.igniterealtime.smack:smack-sasl-provided:4.1.4'
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.amazonaws:aws-android-sdk-s3:2.6.30'
implementation 'com.squareup.okhttp:okhttp:2.6.0'
implementation 'io.michaelrocks:libphonenumber-android:8.9.14'
// Preferred for scheduling background jobs when new push notifications are received.
// It provides a JobScheduler-compatible API that works on all recent versions of
// Android (API level 14+) that have Google Play services installed.
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
implementation 'com.facebook.stetho:stetho:1.3.1'
implementation 'com.facebook.stetho:stetho-okhttp3:1.3.1'
implementation 'com.github.ksoichiro:android-observablescrollview:1.5.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-identity:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'de.greenrobot:greendao:2.1.0'
implementation 'io.github.rockerhieu:emojicon:1.4.2'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
implementation 'com.github.nkzawa:socket.io-client:0.4.2'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'com.github.chrisbanes.photoview:library:1.2.4'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.github.nkzawa:socket.io-client:0.4.2'
implementation 'net.opacapp:multiline-collapsingtoolbar:27.1.1'
implementation 'org.webrtc:google-webrtc:1.0.23295'
implementation 'com.github.clans:fab:1.6.4'
implementation 'io.branch.sdk.android:library:3.0.0'
implementation 'org.jsoup:jsoup:1.10.3'
implementation 'com.squareup.retrofit2:retrofit:2.7.0'
implementation 'com.squareup.retrofit2:converter-gson:2.7.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'me.relex:circleindicator:2.1.4'
implementation 'jp.wasabeef:picasso-transformations:2.2.1'
implementation 'com.github.ganfra:material-spinner:2.0.0'
implementation(name: 'appbase', ext: 'aar')
implementation(name: 'greendao', ext: 'aar')
implementation(name: 'chat', ext: 'aar')
implementation(name: 'ffmpeg', ext: 'aar')
implementation(name: 'imagecropper', ext: 'aar')
implementation(name: 'imagepicker', ext: 'aar')
implementation(name: 'webrtc', ext: 'aar')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
repositories {
mavenCentral()
}
What am I missing? I can't seem to get the compiler to know @Parcelize annotation
I have tried to update the kotlin version, checked multiple previous questions about this issue and did not find anything relevant to assist me.
Solution
Updated Answer:
kotlin-android-extensions
plugin is deprecated.
Now you have to add dependency in app
level build.gradle
file like below:
implementation "org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.7.10
Old Answer:
Change your build.gradle
to add kotlin-android-extensions
in below order.
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
Beside this you have enable experimental feature to use it
androidExtensions {
experimental = true
}
Answered By - Md. Asaduzzaman
Answer Checked By - Senaida (JavaFixing Volunteer)