Exception: No signature of method android() is applicable for argument types, Build Gradle // Dev Diary

Written by

on

in

, ,

Today I wanted to make a data class a Parcelable so that I could pass it as an argument in Navigation component.

Parcelables, though better in performance than Serializables, take more time to implement! To help us out, there’s a “kotlin-parcelize” plugin that can generate the boilerplate code for us.

There were issues though.

After applying the kotlin-parcelize plugin, I was getting the error:

'kotlin-parcelize' can't be applied together with 'kotlin-android-extensions'

So kotlin-parcelize is like a “successor” to the now deprecated 'kotlin-android-extensions' that I’m still using. So I replaced 'kotlin-android-extensions' with ‘kotlin-parcelize’.

I got another error after attempting to sync with my Gradle files:

org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'
[...]
Caused by: groovy.lang.MissingMethodException: No signature of method: build_54gmhuqjm83le8li4fspjsxlu.android() is applicable for argument types: (build_54gmhuqjm83le8li4fspjsxlu$_run_closure1) values: [build_54gmhuqjm83le8li4fspjsxlu$_run_closure1@3c374eea]
	at build_54gmhuqjm83le8li4fspjsxlu.run([...]\app\build.gradle:11)

The solution was to remove the following code from my android{} block:

androidExtensions {
    experimental = true
}

After removing that, Gradle synced successfull!

References:
Parcelable implementation generator
How to use @Parcelize now that kotlin-android-extensions is being deprecated?

Related Posts

About the author:

Catzie Avatar

The homo sapiens behind these blog posts is “Catzie“

Explore my top blog posts:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *