-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Realm does not support Kotlin ByteArray type (java byte[]) #6153
Comments
Have you tried |
same thing: open class TestModel(
@RealmField(name = "test")
var test: ByteArray = ByteArray(0)
): RealmObject() gives java class: @kotlin.Metadata(mv = {1, 1, 11}, bv = {1, 0, 2}, k = 1, d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0012\n\u0002\b\u0005\b\u0016\u0018\u00002\u00020\u0001B\u000f\u0012\b\b\u0002\u0010\u0002\u001a\u00020\u0003\u00a2\u0006\u0002\u0010\u0004R\u001e\u0010\u0002\u001a\u00020\u00038\u0006@\u0006X\u0087\u000e\u00a2\u0006\u000e\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\u0004\u00a8\u0006\b"}, d2 = {"Lch/sherpany/boardroom/model/encryption/TestModel;", "Lio/realm/RealmObject;", "test", "", "([B)V", "getTest", "()[B", "setTest", "app_debug"})
public class TestModel extends io.realm.RealmObject {
@org.jetbrains.annotations.NotNull()
@io.realm.annotations.RealmField(name = "test")
private byte[] test;
@org.jetbrains.annotations.NotNull()
public final byte[] getTest() {
return null;
}
public final void setTest(@org.jetbrains.annotations.NotNull()
byte[] p0) {
}
public TestModel(@org.jetbrains.annotations.NotNull()
byte[] test) {
super();
}
public TestModel() {
super();
}
} I think that annotation |
I've done little research and: |
I had the same error after updating some library versions. These two caused it:
I tried with realm 4.1.1 and 5.8.0, but it didn't help. conductor and timber were the problems for me. I assume this behavior is a bug in annotation processing from some other library or plugin, so your solution might be different than mine, but I suggest you check whether you updated any libraries. |
I've got this after adding
|
Maybe this is related? |
Changing the nullable import from |
Same here, issue appeared after updating Timber to 4.7.1 |
Having the same issue with |
It seems to be the only solution now is to downgrade Timber to 4.5.0 |
i can confirm that byte[] instead of nullable byte[] works |
Does the thing |
I'm new to Kotlin and Android. I'm trying to compile a project that uses Realm and there's a class that produces the same error about "@org.jetbrains.annotations.NotNull byte[] is not supported". I want to try replacing the jetbrains Nullable annotation with the android annotation but I can't figure out how to do that. It seems that no matter what I try, the class is always compiled with the jetbrains annotation and I get the error. I'm sure there's something basic I'm missing but I've spent several hours searching stack overflow and other sites without any luck. Can anyone point me in the right direction? Thanks! |
@paulelias it's probably imported somewhere else 🤔 I would search the entire project for it (if recall the shortcut in android studio for search everywhere is shift+shift, you can search for the import or review all nullable annotations in the project just to be sure) Intellij/Android Studio also might have added it to build gradle (don't think that it does this.. but doesn't hurt to give a look), but since you said it gives this error in a class it might be cache... |
I solved my problem by creating a small Java class that contained the byte array. It avoids the annotation. Thanks! |
subprojects {
configurations.all {
resolutionStrategy.force 'org.jetbrains:annotations:13.0'
}
} also works |
Just adding constraint layout library for compose to project breaks the build. What!? |
Goal
example:
open class TestModel( @RealmField(name = "test") var test: ByteArray? = ByteArray(0)): RealmObject()
Expected Results
Actual Results
Code Sample
Version of Realm and tooling
Realm version(s): ?=5.5.0
Realm sync feature enabled: no
Android Studio version: 3.2
Which Android version and device: emulator 8.0
The text was updated successfully, but these errors were encountered: