carguo/gsyvideoplayer/13-gsy-proguard-r8

Claude Code and agent skill by carguo/gsyvideoplayer

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

在启用了 R8 优化 / Full Mode / Configuration Analyzer 的项目里,为 GSYVideoPlayer 配置正确、最小面积的保留规则。

Install

npx vskill@latest install carguo/gsyvideoplayer/13-gsy-proguard-r8

SKILL.md

The same SKILL.md was published earlier as carguo/gsyvideoplayer/13-gsy-proguard-r8.

gsy-proguard-r8

三个必须的反射热点

分别在源代码里:

  1. PlayerFactory #L11-L13 —— Class.newInstance() 反射构造 IPlayerManager 实现。
  2. CacheFactory —— 同上,构造 ICacheManager 实现(见 CacheFactory)。
  3. GSYBaseVideoPlayer.startWindowFullscreen —— 通过 getConstructor(Context, Boolean) 复刻自身,实现"全屏时另起一份 player",见 GSYBaseVideoPlayer。

推荐 proguard-rules.pro(IJK 内核,含 Media3 抑警)

proguard
# ---- ijkplayer JNI ----
-keep class tv.danmaku.ijk.media.player.** { *; }
-dontwarn tv.danmaku.ijk.media.player.**
# ---- GSYVideoPlayer 反射热点 ----
-keep class * extends com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer {
public <init>(android.content.Context);
public <init>(android.content.Context, java.lang.Boolean);
}
-keep class * implements com.shuyu.gsyvideoplayer.player.IPlayerManager {
public <init>();
}
-keep interface com.shuyu.gsyvideoplayer.player.IPlayerManager { *; }
-keep class * implements com.shuyu.gsyvideoplayer.cache.ICacheManager {
public <init>();
}
-keep interface com.shuyu.gsyvideoplayer.cache.ICacheManager { *; }
# ---- Media3 aar 已自带 consumer rules,仅抑警 ----
-dontwarn androidx.media3.**
-dontwarn com.google.android.exoplayer2.**
# ---- 常规序列化 ----
-keepnames class * implements java.io.Serializable
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
!static !transient <fields>;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}

完整版参照仓库当前的 proguard-rules.pro。

Aliyun 内核追加

proguard
-keep class com.aliyun.player.** { *; }
-keep class com.cicada.player.** { *; }
-dontwarn com.aliyun.player.**

R8 Configuration Analyzer 使用

本仓库 v14 使用 AGP 8.9.1 / Gradle 8.12,settings.gradle 已固定 R8 9.4.14。报告生成命令及历史评分边界见 R8_ANALYZER_REPORT.md。报告 HTML 可直接查看保留范围;历史本地 score.mjs 未随仓库交付,不作为接入前提。

分数对比示例

见 doc/R8_ANALYZER_REPORT.md:本项目将 -keep class com.shuyu.gsyvideoplayer.** { *; } 全量 keep 收敛成 3 条精准 keep 后,Shrinking / Optimization / Obfuscation 三档分数、live class/method 数、APK 尺寸对比。

校验清单(发版前)

步骤命令/操作
release 构建./gradlew :app:assembleRelease
直接安装真机adb install -r app/build/outputs/apk/release/*.apk
手动跑主流程详情播放 → 全屏 → 手势 → seek → 缓存命中 → 列表 → 广告 → 投屏(若集成)
logcatadb logcat -s System.err AndroidRuntime GSYVideoPlayer 无 ClassNotFoundException / NoSuchMethodException

常见崩溃 -> 规则映射

崩溃症状原因增补规则
NoSuchMethodException: xxxVideoPlayer.<init>(Context, Boolean)未保留自定义 View 的 Boolean 构造-keep class * extends GSYBaseVideoPlayer 那条
InstantiationException on switching kernelManager 实现类被去除或改名-keep class * implements IPlayerManager
UnsatisfiedLinkError libijkplayer.soijkplayer JNI 回调找不到 Java 类-keep class tv.danmaku.ijk.media.player.** { *; }
ClassNotFoundException: androidx.media3...*Exo/Media3 未抑警且 aar consumer 未生效-dontwarn androidx.media3.** + 检查 aar 是否 include
List 页 seek 后 seek 失效序列化模型被混淆保留 Serializable / Parcelable

常见坑

  • 用 -allowaccessmodification + Full Mode 时,父子类构造器可见性会被改写;-keep <init> 一定要写。
  • consumer-rules.pro 只在 aar 打包时打入,本地源码模块不生效;如果 SDK 是源码依赖,需要把 keep 规则同时放到 app proguard-rules.pro。
  • Media3 aar 会覆盖旧的 com.google.android.exoplayer2.**,两者规则并存无害,但只用其一时可只保留对应 -dontwarn。

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
21,490
Repository forks
4,315
7-day trend score
50

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/carguo/gsyvideoplayer/13-gsy-proguard-r8/badge)](https://verified-skill.com/skills/carguo/gsyvideoplayer/13-gsy-proguard-r8)

Something wrong with this skill or its page? Tell us.