Improving .so loading by using the ReLinker library#1771
Conversation
|
We should add ReLinker as a dependency in Gradle and not just copy pasting the file |
|
Agreeded. We can can shadow it the same way we do JavaWriter to avoid versioning conflicts from other libraries |
|
@cmelchior You had the opposite opinion yesterday but I'll be happy to change it back. |
There was a problem hiding this comment.
What happens if the context is null?
There was a problem hiding this comment.
We check in line 245 and throw an exception.
|
Alternative suggestion to the changelog: "Improved .so loading by using ReLinker (link)" |
|
@kneth Yes, I believe I might accidentally have voiced that opinion, sorry. Shadowing does the same thing, except we don't have to add the file to the code base. |
realm/realm-library/build.gradle
Outdated
There was a problem hiding this comment.
remove comment. Doesn't add any info.
There was a problem hiding this comment.
Doesn't this cause problem with our JNI testing? If the case is only about Table, the Builder will not be called. And also, I think put this in a static block would be a good idea since it only needs to be ran once.
There was a problem hiding this comment.
The problem with the static block is that it doesn't have access to a Context.
|
The failed monkeyTest is because of the |
|
I think we need add |
|
@zaki50 That should not be needed as it should be handled as a transitive dependency, just like JavaWriter |
|
@emanuelez make sense. We need to add |
|
Ohhh... yes! That's probably it! |
|
But should we avoid to implicitly add an maven repository? |
|
RealmConfiguration.Builder has another constructor |
Adding @aar at the end of a dependency turns off the transitive dependencies. See https://docs.gradle.org/current/userguide/dependency_management.html , specifically the "Artifact only notation" section
|
Bump @realm/java |
There was a problem hiding this comment.
Missing Javadoc for this method and loadLibrary() so the difference is clear.
|
@diegomontoya When the problem happens, can you please check in the Can you please test if the Relinker solve this problem by calling Relinker to load the I really want to try this by myself but none of my phones can reproduce this issue... And what does below mean?
|
|
@beeender The "NoClassDefNotFound" for io/realm/internal/SharedGroup for my case is not caused as result of the system unable to load the .so file aka System.loadLibrary() throwing errors. That was very strange. Unfortunately I have use builds/installed hundreds of times on the device and yesterday was the first time ever I could reproduce this type of bug on any device. Next time I will make sure to freeze the /data/data path for future inspection. Too bad I wasn't thinking clearly at the time. Opportunity wasted on catching the bigfoot.
|
|
@diegomontoya Do you suggest that corrupted |
…oving-so-loading-using-relinker
…oving-so-loading-using-relinker
|
@kneth Yes, I am suggesting there are two bugs here, one of which relink can fix. The first bug is that the install completely bonks the .so copy so there are no .so file to be found. Relink can fix this. But the issue I encountered appears to be the .so loading was completed without errors but still triggering the cryptic io/ream/internal/SharedGroup not found error. The second bug may be hopeless since it may mean the .so is actually corrupted but loadable. |
|
Fixed the last bug in the unit tests, so should be ready now @realm/java |
|
👍 from me, but I made the last change, so ... ;) |
Conflicts: changelog.txt
|
retest this please |
|
👍 |
…oving-so-loading-using-relinker
There was a problem hiding this comment.
Are you sure the annotations don't need to be added as apt?
…om:realm/realm-java into kg/bug/improving-so-loading-using-relinker
…-relinker Improving .so loading by using the ReLinker library
We have seen a number of reports on problems with loading
.sofiles. The origins can be that the.soloader in Android is known to be unreliable and some end-users do not use Google's Play Store (often the case in China).TODO:
changelog.txt: "Improving .so loading by using the ReLinker library (https://github.com/KeepSafe/ReLinker)"@realm/java