Closed KamilLelonek closed 9 years ago
I'll have to upgrade Android Studio before answering - RC4 was released yesterday so I'm falling behind ;-)
I have created a minimal app (blank activity) using Android Studio 1.0.0-rc4, and I am not able to reproduce the issue.
So what do you recommend? I've cleaned my project already..
Can you share your build.gradle
?
By the way, did you create a new project or did you upgrade from an earlier version of Realm?
It's a brand new project. Never used realm.io
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:0.14.1"
classpath "jp.leafytree.gradle:gradle-android-scala-plugin:1.3.1"
}
}
repositories {
mavenCentral()
jcenter()
}
apply plugin: "com.android.application"
apply plugin: "jp.leafytree.android-scala"
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
multiDexEnabled true
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'decoder.properties'
exclude 'rootdoc.txt'
}
dexOptions {
preDexLibraries false
}
sourceSets {
main.res.srcDirs = [
'src/main/res/main',
'src/main/res/common',
'src/main/res/brands',
'src/main/res/retailers_list',
'src/main/res/single_retailer',
'src/main/res/scanning'
]
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:multidex:1.0.0'
compile 'org.scala-lang:scala-library:2.11.4'
compile 'org.scaloid:scaloid_2.11:3.5-10+'
compile 'com.android.support:support-v4:21.+'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'me.dm7.barcodescanner:zbar:1.5'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'io.realm:realm-android:0.75.1'
}
}
I have uploaded my minimal app at https://www.dropbox.com/s/8md7iomb08bqqv8/rc4test.tar.gz?dl=0. Can you try it and see if it works?
For Java it's OK, for Scala it's not working at all..
Hi, We havn't really done anything yet to verify that it works with Scala or other similar languages. Until then we can't really assume that it does. So I'll just update the issue title a bit to reflect this, and then we will treat this as a Feature request to properly support Scala.
I believe that it's a matter of precompilation process and not Scala itself.
Would it be possible for you to provide us with a minimal sample that illustrates the issue?
On Mon, Dec 8, 2014 at 9:17 AM, Kamil Lelonek notifications@github.com wrote:
I believe that it's a matter of precompilation process and not Scala itself.
— Reply to this email directly or view it on GitHub https://github.com/realm/realm-java/issues/644#issuecomment-66036150.
Here it is: https://copy.com/YpeQLchdkk30U8a3
Hello @KamilLelonek the problem seems to be that you have no model. Can you try and make this.
public class User extends RealmObject {
private String name;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
}
Hope this solves your issue.
Feel free to reopen if you can't get this to work.
Oh, so many hours wasted on finding the solution, which was so simple.
class User(val name: String) extends RealmObject
was enough!
I'm having similar problem running realm with SBT + android-plugin.
What I have
What I see
java.lang.IllegalArgumentException: Class is not part of the schema for this Realm
Important - the problem is only with scala classes, with java classes it works fine
I'm not very familiar with annotation processing, what should I look for to get this working?
upd. According to this example https://github.com/retronym/annotation-processor java annotation processing + scala classes = should work
Hi @aafa This is most likely not related to this issue, so I copied it to a new issue so we can take the discussion there https://github.com/realm/realm-java/issues/1531
@cmelchior sure, thank you
I get the following stacktrace:
Realm version:
compile 'io.realm:realm-android:0.75.1'
Java8
Android Studio1.0.0-rc4