2

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

Mocktheduck
  • 1,333
  • 1
  • 22
  • 43
  • 2
    have you tried specifying an explicit version rather than a version range? – pvg Jan 14 '17 at 14:58
  • Ok, that worked. I dont understand why because before it worked with the range but removing the .+ made my app work again. Thank you – Mocktheduck Jan 14 '17 at 15:04
  • This syntax isn't super-well documented but I think your range describes a four part version and the library just has a standard three part semver version. So it is not found. – pvg Jan 14 '17 at 15:47
  • Switching to `0.83.0` is a bad idea :( you should switch at least to 0.87.5, at least anything higher than 0.87.2 (inclusive), but lower than 0.89.0 (exclusive) – EpicPandaForce Jan 14 '17 at 22:04

1 Answers1

3

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.

Community
  • 1
  • 1
EpicPandaForce
  • 79,669
  • 27
  • 256
  • 428