Skip to content

Problem on Android during EnhancedRandom initialization - 2 #303

@pozharov

Description

@pozharov

Hi guys,
I get the following exception at runtime when trying to run an Android app

Process: com.example.pozharov.testrandombeans, PID: 2904 java.lang.NoClassDefFoundError: Failed resolution of: Ljava/time/ZoneId; at io.github.benas.randombeans.util.Constants.<clinit>(Constants.java:94) at io.github.benas.randombeans.api.EnhancedRandomParameters.<init>(EnhancedRandomParameters.java:64) at io.github.benas.randombeans.EnhancedRandomBuilder.<init>(EnhancedRandomBuilder.java:69) at io.github.benas.randombeans.EnhancedRandomBuilder.aNewEnhancedRandom(EnhancedRandomBuilder.java:87) at com.example.pozharov.testrandombeans.MainActivity.onCreate(MainActivity.java:20) at android.app.Activity.performCreate(Activity.java:6956) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045) at android.app.ActivityThread.-wrap14(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6776) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408) Caused by: java.lang.ClassNotFoundException: Didn't find class "java.time.ZoneId" on path: DexPathList[[zip file "/data/app/com.example.pozharov.testrandombeans-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.pozharov.testrandombeans-1/lib/arm64, /system/lib64, /vendor/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

The code that generates this exception:
enhancedRandom = EnhancedRandomBuilder.aNewEnhancedRandom();

buiild.gradle file

`apply plugin: 'com.android.application'

buildscript {
    repositories {
        mavenCentral()
    }
}

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.pozharov.testrandombeans"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'io.github.benas:random-beans:3.7.0'
}

Any idea regarding this issue ?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions