Reputation: 6187
I want to use realm database in my app for that i add this lines to my build.gradle file in app
apply plugin: 'realm-android'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:1.1.0"
}
}
and this is my table code:
public class Country extends RealmObject {
@Ignore
public static String NAME="name";
@Ignore
public static String POPULATION="population";
@PrimaryKey
private String name;
private int population;
public Country() { }
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getPopulation() {
return population;
}
public void setPopulation(int population) {
this.population = population;
}
}
but when I use this code and nothing else "I mean never use country table" I getting this error when run my app:
An exception has occurred in the compiler (1.8.0_05). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for rx.Observable not found
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
my app.gradle file
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.sss.ddd"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
repositories {
maven { url "https://jitpack.io" }
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
}
and this is my project.gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath "io.realm:realm-gradle-plugin:1.1.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
can anyone help me abou this?
thanks.
Upvotes: 1
Views: 1325
Reputation: 1813
This is how I solved the problem:
1.) Create a new package and name it rx 2.) Inside this package add a class named Observable, empty class.
It compiles fine now.
Upvotes: 0
Reputation: 31
Updating JDK to version 1.8.3 solved the issue. JDK can be downloaded from
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Setting up JDK on android can be done using How to set Java SDK path in AndroidStudio?
Upvotes: 1
Reputation: 6187
Thanks all For your attentions but I found my solution.
I add this lines to my project Gradle file:
allprojects {
repositories {
jcenter()
maven {
url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
}
}
}
and this to my app gradle file
compile 'com.uphyca:stetho_realm:0.9.0'
compile 'io.reactivex:rxjava:1.1.0'
compile 'com.facebook.stetho:stetho:1.3.1'
I don't know why I should add this lines and realm documentation never refer to this but know my project works fine.
I know this is wired behavior but its work.
please share me if you know a better answer.
Upvotes: 5