proguard-r8-without-gradle

A method for using Android's R8 tool directly, without Gradle, to process an APK's code. R8 can remove unused code, rename code, reduce debugging information, and convert Java bytecode to Android DEX files.

In plain words
What is it for?
Use it to run R8 from the command line on Android build inputs, apply a keep-rules configuration, and produce smaller or obfuscated DEX output.
Why use it?
It lets you shrink and obfuscate an Android application without installing a separate ProGuard or R8 package. The required R8 program is already included in the Android SDK's d8.jar.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/promastergame/tinyapk-lab/proguard
Any agent
npx skills add Promastergame/tinyapk-lab --skill proguard
Clone the repo
git clone --depth 1 https://github.com/Promastergame/tinyapk-lab

Made for: Claude Code, Codex.

Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,506 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00041 $0.02506
Opus 5 $0.00020 $0.01253
Sonnet 5 $0.00008 $0.00501
Haiku 4.5 $0.00004 $0.00251

Measured 3d ago against content hash 77792c3acde2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

proguard-r8-without-gradle scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

manual-build/proguard/SKILL.md · 287 lines

How it starts

The opening of the file, as written. The whole thing — 287 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SKILL: ProGuard / R8 Without Gradle

Key insight: R8 is already inside d8.jar!

You do NOT need to download ProGuard or R8 separately. Google's R8 compiler (which replaced ProGuard in all modern Android builds) is bundled inside d8.jar from the Android SDK build-tools. Same jar, different main class:

# D8 mode — just converts .class → .dex (no shrinking)
java -cp d8.jar com.android.tools.r8.D8 ...

# R8 mode — shrinks + obfuscates + converts .class → .dex
java -cp d8.jar com.android.tools.r8.R8 ...

R8 does everything ProGuard does plus DEX conversion in one step — no separate ProGuard pass needed.


What R8 does

Feature Result
Tree shaking Removes unused classes, methods, fields
Obfuscation Renames classes/methods to a, b, c...
Minification Removes debug info, line numbers
DEX conversion Outputs classes.dex directly

Typical size reduction on a real app: 30-50%. On already-minimal apps (like a 16KB Tetris): 15-27% — most of the weight is APK structure and signing overhead.


ProGuard config file

Create proguard.pro — tells R8 what to keep (don't obfuscate entry points):

# Keep all Android entry points
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Service
-keep public class * extends android.view.View
-keep public class * extends android.view.SurfaceView

# Keep lifecycle methods on Activities
-keepclassmembers class * extends android.app.Activity {
    protected void onCreate(android.os.Bundle);
    protected void onDestroy();
    protected void onPause();
    protected void onResume();
    protected void onActivityResult(int, int, android.content.Intent);
}

# Keep SurfaceView callbacks
-keepclassmembers class * extends android.view.SurfaceView {
    public void surfaceCreated(android.view.SurfaceHolder);
    public void surfaceDestroyed(android.view.SurfaceHolder);
    public void surfaceChanged(android.view.SurfaceHolder, int, int, int);
    public boolean onTouchEvent(android.view.MotionEvent);
}

# Keep View constructors (needed for inflation)
-keepclassmembers class * extends android.view.View {
    public <init>(android.content.Context);
    public <init>(android.content.Context, android.util.AttributeSet);
}

# Don't warn about missing classes from android.jar stubs
-dontwarn **

# Allow R8 to make members more accessible for optimization
-allowaccessmodification

# Skip preverification (not needed for Android/DEX)
-dontpreverify

Read the full file on GitHub · 287 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 287 lines · 41 tokens per session scan A 77792c3acde2

Subscribe to this mod's changes

proguard-r8-without-gradle is a skill published in the GitHub repository Promastergame/tinyapk-lab (24 stars, last pushed 29d ago), licensed MIT. It adds 41 tokens to every session and 2,506 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

analyzing-android-malware-with-apktool

Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically…

mukul975/Anthropic-Cybersecurity-Skills · 84 tokens

Mobile Application Security

Android and iOS application security testing — static and dynamic analysis, APK/IPA inspection, OWASP MASVS/MASTG verification, secure-storage and transport review, and mobile malware triage for authorized assessments.

Masriyan/Claude-Code-CyberSecurity-Skill · 46 tokens

capture-app-flow-media

Use to record or convert ApkAnalyzer app flows into screenshots or GIFs for the README or product docs. Triggered by phrases like "add screenshots", "convert videos to gifs", "record a gif of this flow", "capture app screenshots", "update the README screenshots", "make a demo gif".

MartinStyk/apk-analyzer · 66 tokens

sync-design-changes

Use when translating tweaks made in the "Apk Analyzer Design System" Claude Design project (claude.ai/design) back into actual Kotlin/Compose code in this repo. Triggered by phrases like "sync design changes", "bring in the Claude Design edits", "implement what I changed in Claude Design", "apply the design tweaks"…

MartinStyk/apk-analyzer · 80 tokens

appfunctions

Use when discovering, implementing, documenting, or testing Android App Functions (androidx.appfunctions) that expose app capabilities to on-device AI agents like Gemini. Triggered by phrases like "add an app function", "implement AppFunctions", "expose this as an app function", "discover app function candidates"…

MartinStyk/apk-analyzer · 98 tokens

navigate-app-adb

Use to drive ApkAnalyzer's UI on a connected device/emulator via adb — dumping the screen, finding a tappable element by its visible text or content description, and tapping it — to inspect or verify a change without a human touching the device. Triggered by phrases like "navigate to X screen", "tap through the app"…

MartinStyk/apk-analyzer · 101 tokens