简体   繁体   中英

java.lang.Double is not supported Realm Object

Basically I had a working app using realm that would work fine until I tried to import firebase into it and things changed. It wouldnt see realm anymore and after I fixed relam import, now it says

Error:(10, 8) error: Type java.lang.Double of field price is not supported

this is how my class looks like:

public class RealmTruck extends RealmObject {
    @PrimaryKey
    private String name;

    private String location;
    private Double price;
    private Integer registrationYear;
    private String version;

I mention again that this was working. And if I switch realm from 0.82.1 version to 0.83.0.+ I get this:

Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
   > Could not find any version that matches io.realm:realm-android:0.83.0.+.
     Versions that do not match:
         0.87.5
         0.87.4
         0.87.3
         0.87.2
         0.87.1
         + 31 more
     Required by:
         LoginTest:app:unspecified

What is going on? I really didnt change anything to it. I tried recompiling, reimporting, clearing cached indexes, nothing works.

If I try grandle sync now, I get this:

Error:(33, 13) Failed to resolve: io.realm:realm-android:0.83.0.+
<a href="openFile:D:/Projects2016/Android/LoginTest/app/build.gradle">Show in File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

I'm using Android Studio, the latest version I believe

That's because Realm doesn't support Double , Integer , etc. classes before 0.83.0.

0.83.0 and above introduced NULL support , which allows nullable primitives.

Although it's recommended that you upgrade at least to 0.87.5 or 0.88.3 without changing too much existing logic in your Realm code .

If this is a new project, and Realm is newly introduced, then you should go for either 1.2.0 , or the latest version available.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM