capacitor-community / admob

Community plugin for using Google AdMob
MIT License
205 stars 66 forks source link

Android: Gradle Compatibility with 8.0.2 #285

Closed studentrk closed 9 months ago

studentrk commented 9 months ago

Describe the bug A clear and concise description of what the bug is. After upgrading gradle to 8.0.2 in my project I got the following error:

Could not determine the dependencies of task ':capacitor-community-admob:bundleLibCompileToJarDebug'. > Could not create task ':capacitor-community-admob:compileDebugKotlin'. > Cannot use @TaskAction annotation on method AbstractKotlinCompile.execute() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.

To solve the issue I had to use gradle version 8.0.2 and compatible kotlin-version 1.8.10 in the build.gradle of the capacitor-community-admob module.

buildscript {
    ext.kotlin_version = '1.8.10'
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.0.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

Will the next update of the admob plugin support gradle version 8.0.2? Or should it already support it and it was a configuration error on my part?

Expected behavior Build in Android should work.

Desktop (please complete the following information):

studentrk commented 9 months ago

After upgrading to the newest version of admob 5.1.1 and using gradle 8.0.0 it worked on my part.

Ricardo385 commented 7 months ago

I faced this issue when migrating from Capacitor v4 to Capacitor v5 and then installing this plugin to v5.1.1. I solved it by going to android -> build.gradle and upgrading kotlin version over dependencies array to v1.8.20. So, should look like:

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20".

Then you can do ionic capacitor sync or npx cap sync and build and run your project. Then just sync your gradle file on Android Studio and the error should be fixed