Realm-java: in android studio 3.0 Warnings:Transform 'RealmTransformer' uses scope PROJECT_LOCAL_DEPS which is deprecated and replaced with EXTERNAL_LIBRARIES error

Created on 18 May 2017  ·  26Comments  ·  Source: realm/realm-java

I regaled realm with android studio 2.7, it worked fine, but after upgrading to android studio 3.0 gradle gives warnings `Warning:Transform 'RealmTransformer' uses scope PROJECT_LOCAL_DEPS which is deprecated and replaced with EXTERNAL_LIBRARIES

Warning:Transform 'RealmTransformer' uses scope SUB_PROJECTS_LOCAL_DEPS which is deprecated and replaced with EXTERNAL_LIBRARIES
Warning:Transform 'RealmTransformer' uses scope PROJECT_LOCAL_DEPS which is deprecated and replaced with EXTERNAL_LIBRARIES
Warning:Transform 'RealmTransformer' uses scope SUB_PROJECTS_LOCAL_DEPS which is deprecated and replaced with EXTERNAL_LIBRARIES
Warning:Transform 'RealmTransformer' uses scope PROJECT_LOCAL_DEPS which is deprecated and replaced with EXTERNAL_LIBRARIES
Warning:Transform 'RealmTransformer' uses scope SUB_PROJECTS_LOCAL_DEPS which is deprecated and replaced with EXTERNAL_LIBRARIES
T-Bug

Most helpful comment

waiting for the fix 🙏

All 26 comments

And i saw that because of this when i create my objects without the getters and setters, just public fields, when i do object.variable it doesnt call the respective object.realm$getVariable generated method on the proxy object, and so i always get 0. But, if i debug and manually execute the generated getter then i get the real value.

Are you saying field access is not transformed to the proxy method calls AT ALL?

@zhuinden exactly, is just getting the value from the field, instead of calling the transformed method.

Thanks for pointing this out, @yombunker , @Axrorxoja . We had very little warning about this breaking change. We'll have a release to fix the problem ASAP.

@bmeike yeah no problem breaking changes on a canary release are expected to happen :)

waiting for the fix 🙏

i also facing same issues
Warning:Transform 'RealmTransformer' uses scope SUB_PROJECTS_LOCAL_DEPS which is deprecated and replaced with EXTERNAL_LIBRARIES

I talked about this warnings with Xav (tech lead of android tools team) at this Google I/O and he said that android gradle plugin should not print warnings against Scope.PROJECT_LOCAL_DEPS and Scope.SUB_PROJECTS_LOCAL_DEPS if the scope set contains Scope.EXTERNAL_LIBRARIES.

He said that he would suppress those warnings in alpha2 plugin when above conditions are satisfied.

I notice that alpha2 is out and no fix for this issue. Is there any way around this or just wait for the fix to come through?

Yes, apparently the fix didn't make it for alpha2. Right now we are still waiting for a fix from Googles side. If this hasn't been fixed once they start making beta releases we will probably revive #4678

So is there a way to work with realm in android studio canary2? I have a blocking error "Warning:Transform 'RealmTransformer' uses scope SUB_PROJECTS_LOCAL_DEPS which is deprecated and replaced with EXTERNAL_LIBRARIES"

@dkachan1941 It should just be a warning. So while annoying to see, it shouldn't prevent you from building?

@cmelchior well, for me it was not working, literally. i was using the method without getters and setters, and i will see the classes generated, but, when running it will get the value from the fields instead of calling the proxy getters, i could debbug and call the generated getter manually and the correct result will come, but, during app running it would always say 0.

@yombunker Is it just the debugger showing the wrong thing? Did you see https://realm.io/docs/java/latest/#testing-and-debugging ?

@yombunker you need to use the getters for the values in the debugger, fields will always be default value (0 and null)

@Zhuinden what i mean is that if i do Toast... and send the value, it will say 0, but if i call the getters it actually has a value. But, maybe this is related to some other issue and maybe not this one. I still have the branch with Realm in place, i'll try it tonight to see if still repros this behavior.

Anyways i was having other bigger issues with integration with RxJava that i had to exchange to Room to unblock me that day. My feelings towards Realm are still the same, is kind of a love-hate situation. I love to use it, but, when the magic doesn't work it just a huge blocker.

Well the magic tends to work out for me but it might just be experience with the tool :D

I used RxJava2 with it and wrapped it similarly to what the RealmObservableFactory does by default (which btw is configurable)
https://github.com/realm/realm-java/issues/3497#issuecomment-275375789

@Zhuinden interesting that you say that, cause in the RealmWorldTour that happened here in Seattle, i asked the guys in there what was the recommended way to use Realm + RxJava and they say that the recommended way is to abstract Realm from Rx, which meant to do the queries and take the objects out of the Realm and then use those new objects in Rx, and the same on the way back, get normal objects, turn them into Realm counter parts and then save them.

Would be good guys if you pointed out to good practices from the documentation. Because i sure love the speed from Realm, so i use it whenever i don't find conflicts with the other libraries in the project.

@yombunker mapping RealmObjects out to immutable domain models means losing lazy evaluation of Realm, by default you'd want to use RealmObjects as your domain models so that you can use the lazy-loaded proxies.

It's a trade-off between lazy evaluation + thread-confined proxies that mutate in place versus eager evaluation + immutability.

The default asObservable() method is a short-hand for addChangeListener and removeChangeListener.

This warning is still present in 3.0.0-alpha3, but now looks different 😞

AGPBI: {"kind":"warning","text":"Transform \u0027RealmTransformer\u0027 uses scope PROJECT_LOCAL_DEPS which is deprecated and replaced with EXTERNAL_LIBRARIES","sources":[{},{}]}

Instead of raw text, now it's JSON?

Can't tell if that's an improvement

Facing same issue with FirebasePerformance.

Warning:Transform 'FirebasePerformancePlugin' uses scope PROJECT_LOCAL_DEPS which is deprecated and replaced with EXTERNAL_LIBRARIES
Warning:Transform 'FirebasePerformancePlugin' uses scope SUB_PROJECTS_LOCAL_DEPS which is deprecated and replaced with EXTERNAL_LIBRARIES
Warning:Transform 'FirebasePerformancePlugin' uses scope PROJECT_LOCAL_DEPS which is deprecated and replaced with EXTERNAL_LIBRARIES
Warning:Transform 'FirebasePerformancePlugin' uses scope SUB_PROJECTS_LOCAL_DEPS which is deprecated and replaced with EXTERNAL_LIBRARIES

just ignore the warning and waiting for the fix guys.
I'm still facing this problem on Android Studio 3.0 Canary 3

This issue has been solved I think in latest update of Android Studio 3.0 Canary 4. No warnings now.

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]
Information:BUILD SUCCESSFUL in 9s
Information:0 errors
Information:0 warnings

Wow, happy to hear that.

I confirmed that 3.0.0-alpha4 does not generate these warnings.
I'm closing this issue.

Was this page helpful?
0 / 5 - 0 ratings