-
Notifications
You must be signed in to change notification settings - Fork 236
Description
Hi guys,
I encounter the following exception at runtime when trying to run an Android app using random-beans 3.7.0:
java.lang.NoSuchMethodError: No static method valueOf(Ljava/time/LocalDate;)Ljava/sql/Date; in class Ljava/sql/Date; or its super classes (declaration of 'java.sql.Date' appears in /system/framework/core-oj.jar)
at io.github.benas.randombeans.randomizers.registry.InternalRandomizerRegistry.init(InternalRandomizerRegistry.java:95)
at io.github.benas.randombeans.EnhancedRandomBuilder.lambda$setupRandomizerRegistries$5$EnhancedRandomBuilder(EnhancedRandomBuilder.java:448)
at io.github.benas.randombeans.EnhancedRandomBuilder$$Lambda$0.accept(Unknown Source:4)
at java.lang.Iterable.forEach(Iterable.java:75)
at io.github.benas.randombeans.EnhancedRandomBuilder.setupRandomizerRegistries(EnhancedRandomBuilder.java:448)
at io.github.benas.randombeans.EnhancedRandomBuilder.build(EnhancedRandomBuilder.java:432)
at io.github.benas.randombeans.EnhancedRandomBuilder.aNewEnhancedRandom(EnhancedRandomBuilder.java:87)
at org.nla.dbtests.LoadDataIntentService.onHandleIntent(LoadDataIntentService.java:40)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:68)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
The code that generates this exception is pretty basic :p
EnhancedRandom enhancedRandom = EnhancedRandomBuilder.aNewEnhancedRandom();
The problem is related to a call to the static method java.sql.Date.valueOf() I don't get it because it seems this method exists, at least it's found by me IDE. Maybe a class loader problem on Android ?
I use Android Studio 3 beta 5 so the project can use java 8 features like lambdas and streams (without having to use jack compiler).
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "org.nla.dbtests"
minSdkVersion 24
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.android.support:design:26.+'
implementation 'com.couchbase.lite:couchbase-lite-android:1.4.0'
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.code.gson:gson:2.7'
implementation 'com.google.firebase:firebase-database:9.0.0'
implementation 'io.realm:realm-android:0.82.1'
implementation 'io.github.benas:random-beans:3.7.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
annotationProcessor 'io.realm:realm-android:0.82.1'
}
Note the lib is not included in test path, but in actual compile path, because I want to use it for a specific feature in the actual app.
Any idea regarding this issue ?
Thanks in advance guys :)