Skip to content

Unofficial YouTube Music / Spotify Premium client for Android, built in Liquid Glass. Audio effects, Spotify Connect, listening history, 8 languages. Rust core on librespot.

Keep Rhino intact under R8

Lelonioc4634f69d1e4
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index 5abc2f1..83166f8 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -29,6 +29,28 @@
-keepattributes Signature, RuntimeVisibleAnnotations
-keep,allowobfuscation interface dev.lelonio.square.data.SpotifyApi
+# NewPipeExtractor carries Rhino, which is a JavaScript engine written for the
+# JVM: it references java.beans, javax.script and jdk.dynalink, none of which
+# exists on Android. Every one of them is behind a path this app never takes,
+# the scripting-engine front end and the invokedynamic optimiser, so they are
+# dead weight rather than a missing dependency and R8 only needs telling not to
+# fail on them. Rhino falls back to its interpreter when the optimiser will not
+# load, which is what already happens on Android.
+-dontwarn java.beans.**
+-dontwarn javax.script.**
+-dontwarn jdk.dynalink.**
+-dontwarn org.mozilla.javascript.engine.**
+-dontwarn org.mozilla.javascript.optimizer.**
+-dontwarn org.mozilla.javascript.tools.**
+
+# Rhino itself must survive intact. It resolves host classes and members by
+# name from the JavaScript it runs, and generates bytecode through
+# ClassFileWriter, so a renamed member is a failure at run time only: YouTube's
+# signature cipher is deciphered by exactly this, and the symptom would be
+# every stream failing while search still worked.
+-keep class org.mozilla.javascript.** { *; }
+-keep class org.mozilla.classfile.ClassFileWriter { *; }
+
# Resolved by name from app/src/main/cpp/stretch.cpp, whose JNI symbols embed
# the fully qualified class name.
-keepclasseswithmembernames class dev.lelonio.square.playback.Stretcher { native <methods>; }