jMonkeyEngine-Contributions / Lemur

Lemur is a jMonkeyEngine-based UI toolkit.
http://jmonkeyengine-contributions.github.io/Lemur/
BSD 3-Clause "New" or "Revised" License
120 stars 33 forks source link

Lemur crushes game on Android #123

Open octo-kumo opened 1 week ago

octo-kumo commented 1 week ago

So I packed my simple project into APK and installed it on an emulator.

But there is no output, so I checked the logs.

It appears that lemur is causing the crash.

02-05 05:11:32.980  4928  4946 E AndroidRuntime: Process: me.kumo.drone.DroneGroundStation, PID: 4928
02-05 05:11:32.980  4928  4946 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/script/ScriptEngineManager;
02-05 05:11:32.980  4928  4946 E AndroidRuntime:        at com.simsilica.lemur.style.StyleLoader.<init>(StyleLoader.java:72)
02-05 05:11:32.980  4928  4946 E AndroidRuntime:        at com.simsilica.lemur.style.StyleLoader.<init>(StyleLoader.java:62)
02-05 05:11:32.980  4928  4946 E AndroidRuntime:        at com.simsilica.lemur.style.BaseStyles.loadStyleResources(BaseStyles.java:72)
02-05 05:11:32.980  4928  4946 E AndroidRuntime:        at com.simsilica.lemur.style.BaseStyles.loadGlassStyle(BaseStyles.java:62)
02-05 05:11:32.980  4928  4946 E AndroidRuntime:        at me.kumo.drone.game.DroneGroundStation.simpleInitApp(DroneGroundStation.java:32)
02-05 05:11:32.980  4928  4946 E AndroidRuntime:        at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:240)
02-05 05:11:32.980  4928  4946 E AndroidRuntime:        at com.jme3.app.AndroidHarness.initialize(AndroidHarness.java:479)
02-05 05:11:32.980  4928  4946 E AndroidRuntime:        at com.jme3.system.android.OGLESContext.onDrawFrame(OGLESContext.java:358)
02-05 05:11:32.980  4928  4946 E AndroidRuntime:        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1580)
02-05 05:11:32.980  4928  4946 E AndroidRuntime:        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1279)
02-05 05:11:32.980  4928  4946 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.script.ScriptEngineManager" on path: DexPathList[[zip file "/data/app/me.kumo.drone.DroneGroundStation-LHnCArWktkN3hkxJJtH-zA==/base.apk"],nativeLibraryDirectories=[/data/app/me.kumo.drone.DroneGroundStation-LHnCArWktkN3hkxJJtH-zA==/lib/x86_64, /data/app/me.kumo.drone.DroneGroundStation-LHnCArWktkN3hkxJJtH-zA==/base.apk!/lib/x86_64, /system/lib64, /system/vendor/lib64]]
02-05 05:11:32.980  4928  4946 E AndroidRuntime:        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
02-05 05:11:32.980  4928  4946 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
02-05 05:11:32.980  4928  4946 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
02-05 05:11:32.980  4928  4946 E AndroidRuntime:        ... 10 more

Here is my build.gradle files.

For android

plugins {
    id 'com.android.application'
    id "io.github.0ffz.github-packages" version "1.2.1"
    // Plugin for anonymous inclusion of artifacts hosted in github package registry
}

android {
    compileSdk 32
    defaultConfig {
        applicationId "me.kumo.drone.DroneGroundStation"
        minSdk 22
        targetSdk 32
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    signingConfigs {
        release {
            if (project.hasProperty('APP_RELEASE_STORE_FILE')) {
                storeFile file(APP_RELEASE_STORE_FILE)
                storePassword APP_RELEASE_STORE_PASSWORD
                keyAlias APP_RELEASE_KEY_ALIAS
                keyPassword APP_RELEASE_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    configurations.all {
        exclude group: "org.jmonkeyengine", module: "jme3-desktop"
        exclude group: "com.google.errorprone", module: "error_prone_annotations"
    }
}

ext.jmonkeyengineVersion = '3.7.0-stable'

dependencies {
    implementation 'com.google.guava:guava:33.4.0-android'
    implementation 'androidx.appcompat:appcompat:1.4.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation project(path: ':game')
    implementation "org.jmonkeyengine:jme3-core:" + jmonkeyengineVersion
    implementation "org.jmonkeyengine:jme3-android-native:" + jmonkeyengineVersion

}

For main project

plugins {
    id 'java-library'
    id "io.github.0ffz.github-packages" version "1.2.1"
    // Plugin for anonymous inclusion of artifacts hosted in github package registry
}

java {

    sourceCompatibility = '8'
    targetCompatibility = '8'

}

ext.jmonkeyengineVersion = '3.7.0-stable'

dependencies {
    implementation 'org.jmonkeyengine:jme3-core:' + jmonkeyengineVersion
    runtimeOnly 'org.jmonkeyengine:jme3-jogg:' + jmonkeyengineVersion
    runtimeOnly 'org.jmonkeyengine:jme3-plugins:' + jmonkeyengineVersion

    implementation 'org.jmonkeyengine:jme3-effects:' + jmonkeyengineVersion
    implementation 'org.jmonkeyengine:jme3-terrain:' + jmonkeyengineVersion
    implementation 'org.jmonkeyengine:jme3-testdata:' + jmonkeyengineVersion

    implementation 'com.github.stephengold:SkyControl:1.1.0'
    implementation 'com.fazecast:jSerialComm:2.11.0'
    implementation 'com.simsilica:lemur:1.16.0'
//    implementation 'com.simsilica:lemur-proto:1.13.0'
    implementation 'com.github.stephengold:Minie:8.2.0'
}
octo-kumo commented 1 week ago

implementation 'com.google.guava:guava:33.4.0-android' was added to remove build errors complaining about Duplicate class com.google.common.util.concurrent.ListenableFuture

implementation 'com.simsilica:lemur-proto:1.13.0' was commented to remove build errors complaining about duplicate resources inside lemur.