Skip to content

Issues when minifying chasm in Android using r8 #87

@basic-bgnr

Description

@basic-bgnr

@CharlieTap Thanks to your project, I've been able to run a demo android app that utilizes running a wasm file without any issues.
Today I decided to build a release version of the app and to my dismay the r8 compiler failed to successfully compile the app, crashing with null pointer exception.

chasm version: 0.9.53

AGPBI: {"kind":"error","text":"java.lang.NullPointerException","sources":[{"file":"/home/user/.gradle/caches/modules-2/files-2.1/io.github.charlietap.chasm/decoder-jvm/0.9.53/a73838c28c6ee7c126768d3c5cd714b1bca3ef0e/decoder-jvm-0.9.53.jar"}],"tool":"R8"}

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:minifyReleaseWithR8'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable
   > Compilation failed to complete, position: Lio/github/charlietap/chasm/decoder/context/scope/SectionScopeKt;SectionScope(Lio/github/charlietap/chasm/decoder/context/DecoderContext;Lkotlin/Pair;)Ljava/lang/Object;, origin: /home/user/.gradle/caches/modules-2/files-2.1/io.github.charlietap.chasm/decoder-jvm/0.9.53/a73838c28c6ee7c126768d3c5cd714b1bca3ef0e/decoder-jvm-0.9.53.jar:io/github/charlietap/chasm/decoder/context/scope/SectionScopeKt.class

I tried keeping the entire chasm dependency without minification using the following proguard rule but couldn't manage to avoid the null pointer exception.

-keep class io.github.charlietap.chasm.** { *; }
-keep interface io.github.charlietap.chasm.** { *; }
-keep enum io.github.charlietap.chasm.** { *; }

Could you point me in the right direction?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions