realm / realm-java

Realm is a mobile database: a replacement for SQLite & ORMs
http://realm.io
Apache License 2.0
11.45k stars 1.75k forks source link

RealmTransformer not executing on with AGP 7.2.0/1 #7685

Closed pedronveloso closed 1 year ago

pedronveloso commented 2 years ago

How frequently does the bug occur?

All the time

Description

Android Studio just updated their stable IDE version. I'm using the recommended Gradle tooling version that came with the IDE update. The app compiles normally, but crashes at runtime - and according to the error it seems fairly clear that the Realm plugin didn't work as expected. Let me know if you need further information.

Stacktrace & log output

java.lang.ExceptionInInitializerError: RealmTransformer doesn't seem to be applied. Please update the project configuration to use the Realm Gradle plugin. See https://docs.mongodb.com/realm/sdk/android/install/#customize-dependecies-defined-by-the-realm-gradle-plugin
        at io.realm.RealmConfiguration.<clinit>(RealmConfiguration.java:80)
        at io.realm.RealmConfiguration.access$000(RealmConfiguration.java:68)
        at io.realm.RealmConfiguration$Builder.initializeBuilder(RealmConfiguration.java:552)
        at io.realm.RealmConfiguration$Builder.<init>(RealmConfiguration.java:538)
        at io.realm.Realm.initializeRealm(Realm.java:320)
        at io.realm.Realm.init(Realm.java:261)
        at com.patreon.android.data.manager.RealmManager.initialize(RealmManager.java:55)


### Can you reproduce the bug?

Yes, always

### Reproduction Steps

_No response_

### Version

10.10.1

### What SDK flavour are you using?

Local Database only

### Are you using encryption?

No, not using encryption

### Platform OS and version(s)

all

### Build environment

Android Studio version: Android Studio Chipmunk | 2021.2.1
Build #AI-212.5712.43.2112.8512546, built on April 28, 2022

Gradle : gradle-7.3.3-all

Realm: 10.10.1
rorbech commented 1 year ago

Closing this issue as it was not an issue with Realm but an issue in AGP 7.2.0 and 7.2.1 ... which is also fixed in later versions of AGP.

Regarding the comments about deprecation (from AGP 7.3) and removal (from AGP 8) of the old transformer API please see https://github.com/realm/realm-java/issues/7714#issuecomment-1262339720 that covers the details of providing a version using the new migrated API from AGP 7.4 and onwards along with a backward compatible version for AGP 7.3 and below.