Search code examples
androidgradleandroid-gradle-plugin

Build failed in AGP 8.0, Failed to apply plugin 'realm-android'. API 'android.registerTransform' is removed


Today i updated gradle plugin to 8.0, I am using realm for local database but after updating the plugin i am unable to build the project.

apply plugin: 'realm-android'
FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Work\rc_android_projects\synco\app\build.gradle' line: 15

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'realm-android'.
   > API 'android.registerTransform' is removed.
     
     For more information, see https://developer.android.com/studio/releases/gradle-plugin-api-updates#transform-api.
     To determine what is calling android.registerTransform, use -Pandroid.debug.obsoleteApi=true on the command line to display more information.

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

i tried to use the kotlin sdk but result is same

Update : fixed it by updating realm plugin 10.14.1-transformer-api-SNAPSHOT


Solution

  • Update 21/04/2023 :

    This should be fixed with 10.15.1 which was just released. or any later release. update your realm classpath in build.gradle to be :

    classpath "io.realm:realm-gradle-plugin:10.17.0"
    

    issue tracked here

    ========================================================

    After this update you may encounter another issues regarding your JDK:

    Cause: class io.realm.processor.Utils (in unnamed module @0x38d68d7c) cannot access class com.sun.tools.javac.code.Symbol$ClassSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x38d68d7c

    solved by editing org.gradle.jvmargs property in gradle.properties :

    org.gradle.jvmargs= ... --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
    

    second issue tracked here