mybigday / llama.rn

React Native binding of llama.cpp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

llama.rn crashes when proguard is enabled

Vali-98 opened this issue · comments

Crashes were reported in release 0.7.7 of ChatterUI by various individuals on various devices.

Versions tested: 0.3.1, 0.3.2

Issue:

Expo allows the customization of build configurations, allowing the use the following fields:

  • enableProguardInReleaseBuilds
  • enableShrinkResourcesInReleaseBuilds

Source: https://docs.expo.dev/versions/latest/sdk/build-properties/#pluginconfigtypeandroid

Loading models on the release build was still functional, however, once it attempts to emit the first token, the app crashes.

From checking logcat, this crash is caused by a NoSuchMethodException on emitPartialCompletion. Presumably Proguard is inaccurately removing vital llama.rn components, causing a crash.

Removing the build configuration lines above fixes this issue. The addition of proguard rules would be beneficial for better Android build compatibility.

Have you tried to add the proguard rule to extraProguardRules?

It seems that this was a misconfiguration on my part. The extraProguardRules was added in my CD pipeline, but it seemed to overwritten during compilation.