{"id":21899052,"url":"https://github.com/johnsonlee/r8","last_synced_at":"2026-02-13T17:32:18.009Z","repository":{"id":150860992,"uuid":"374257127","full_name":"johnsonlee/r8","owner":"johnsonlee","description":"A fork of Android R8","archived":false,"fork":false,"pushed_at":"2026-01-28T14:30:22.000Z","size":109739,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-29T06:19:07.774Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johnsonlee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-06T03:14:18.000Z","updated_at":"2026-01-28T14:29:35.000Z","dependencies_parsed_at":"2023-04-21T12:02:22.432Z","dependency_job_id":null,"html_url":"https://github.com/johnsonlee/r8","commit_stats":null,"previous_names":[],"tags_count":1010,"template":false,"template_full_name":null,"purl":"pkg:github/johnsonlee/r8","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsonlee%2Fr8","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsonlee%2Fr8/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsonlee%2Fr8/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsonlee%2Fr8/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnsonlee","download_url":"https://codeload.github.com/johnsonlee/r8/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnsonlee%2Fr8/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29413392,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T06:24:03.484Z","status":"ssl_error","status_checked_at":"2026-02-13T06:23:12.830Z","response_time":78,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-28T14:37:15.688Z","updated_at":"2026-02-13T17:32:18.003Z","avatar_url":"https://github.com/johnsonlee.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# D8 dexer and R8 shrinker\n\nThe R8 repo contains two tools:\n\n- D8 is a dexer that converts java byte code to dex code.\n- R8 is a java program shrinking and minification tool that converts java byte\n  code to optimized dex code.\n\nD8 is a replacement for the DX dexer and R8 is an alternative to\nthe [ProGuard](https://www.guardsquare.com/en/proguard) shrinking and\nminification tool.\n\n## Obtaining prebuilts\n\nThere are several places to obtain a prebuilt version without building it\nyourself.\n\nThe stable release versions shipped with Android Studio are available from\nthe Google Maven repository, see\nhttps://maven.google.com/web/index.html#com.android.tools:r8.\n\nOur [CI](https://ci.chromium.org/p/r8/g/main/console) builds for each commit and\nstores all build artifacts in Google Cloud Storage in the bucket r8-releases.\n\nTo obtain a prebuild from the CI for a specifc version (including both\nstable and `-dev` versions), download from the following URL:\n\n    https://storage.googleapis.com/r8-releases/raw/\u003cversion\u003e/r8lib.jar\n\nTo obtain a prebuild from the CI for a specifc main branch hash, download from the\nfollowing URL:\n\n    https://storage.googleapis.com/r8-releases/raw/main/\u003chash\u003e/r8lib.jar\n\nThe prebuilt JARs have been processed by R8, and for each build the corresponding\nmapping file is located together with the prebuild under the name `r8lib.jar.map`.\n\nTo get prebuilds which has not been processed by R8 replace `r8lib.jar` with `r8.jar`\nin the URLs above.\n\nThe Google Cloud Storage bucket r8-releases can also be used as a simple\nMaven repository using the following in a Gradle build file:\n\n    maven {\n        url = uri(\"https://storage.googleapis.com/r8-releases/raw\")\n    }\n\nSee [Running D8](#running-d8) and [Running R8](#running-r8) below on how to invoke\nD8 and R8 using the obtained `r8lib.jar` in place of `build/libs/r8.jar`.\n\n## Downloading source and building\n\nThe R8 project uses [`depot_tools`](https://www.chromium.org/developers/how-tos/install-depot-tools)\nfrom the chromium project to manage dependencies. Install `depot_tools` and add it to\nyour path before proceeding.\n\nThe R8 project uses Java 8 language features and requires a Java 8 compiler\nand runtime system.\n\nTypical steps to download and build:\n\n\n    $ git clone https://r8.googlesource.com/r8\n    $ cd r8\n    $ tools/gradle.py r8\n\nThe `tools/gradle.py` script will bootstrap using depot_tools to download\na version of gradle to use for building on the first run. This will produce\na jar file: `build/libs/r8.jar` which contains both R8 and D8.\n\n## Setting up IntelliJ\n\nFollow the instructions in the above section.\n\n1. Open the project `r8/d8_r8` in IntelliJ\n2. Navigate to \"Settings\" \u003e \"Build, Execution, Deployment\" \u003e \"Build Tools\" \u003e \"Gradle\"\n   1. Select `r8/third_party/gradle` as \"Local installation\" in \"Distribution\" \n   2. Select `r8/third_party/openjdk/jdk-11/linux` as \"Gradle JVM\"\n3. Sync the project using Gradle\n\nIn order to run tests it may currently be necessary to run `tools/test.py` from the command line first.\n\n## \u003ca name=\"running-d8\"\u003e\u003c/a\u003eRunning D8\n\nThe D8 dexer has a simple command-line interface with only a few options.\nD8 consumes class files and produce DEX.\n\nThe most important option is whether to build in debug or release mode.  Debug\nis the default mode and includes debugging information in the resulting dex\nfiles. Debugging information contains information about local variables used\nwhen debugging dex code. This information is not useful when shipping final\nAndroid apps to users and therefore, final builds should use the `--release`\nflag to remove this debugging information to produce smaller dex files.\n\nTypical invocations of D8 to produce dex file(s) in the out directoy:\n\nDebug mode build:\n\n    $ java -cp build/libs/r8.jar com.android.tools.r8.D8 \\\n           --min-api \u003cmin-api\u003e \\\n           --output out \\\n           --lib \u003candroid.jar/rt.jar\u003e \\\n           input.jar\n\nRelease mode build:\n\n    $ java -cp build/libs/r8.jar com.android.tools.r8.D8\n           --release \\\n           --min-api \u003cmin-api\u003e \\\n           --output out \\\n           --lib \u003candroid.jar/rt.jar\u003e \\\n           input.jar\n\nSee [Running R8](#running-r8) for information on options `--min-api` and `--lib`.\n\nThe full set of D8 options can be obtained by running the command line tool with\nthe `--help` option.\n\n## \u003ca name=\"running-r8\"\u003e\u003c/a\u003eRunning R8\n\nR8 is a whole-program optimizing compiler with focus on shrinking the size of\nprograms. R8 uses the\n[ProGuard configuration format](https://www.guardsquare.com/manual/configuration/usage)\nfor configuring the whole-program optimization including specifying the entry points\nfor an application.\n\nR8 consumes class files and can output either DEX for Android apps or class files\nfor Java apps.\n\nTypical invocations of R8 to produce optimized DEX file(s) in the `out` directory:\n\n    $ java -cp build/libs/r8.jar com.android.tools.r8.R8 \\\n           --release \\\n           --min-api \u003cmin-api\u003e \\\n           --output out \\\n           --pg-conf proguard.cfg \\\n           --lib \u003candroid.jar/rt.jar\u003e \\\n           input.jar\n\nThis produce DEX targeting Android devices with a API level of `\u003cmin-api\u003e` and above.\n\nThe option `--lib` is passing the bootclasspath for the targeted runtime.\nFor targeting Android use an `android.jar` from the Android Platform SDK, typically\nlocated in `~/Android/Sdk/platforms/android-XX`, where `XX` should be the latest\nAndroid version.\n\nTo produce class files pass the option `--classfile` and leave out `--min-api \u003cmin-api\u003e`.\nThis invocation will provide optimized Java classfiles in `output.jar`:\n\n    $ java -cp build/libs/r8.jar com.android.tools.r8.R8 \\\n           --release \\\n           --classfile \\\n           --output output.jar \\\n           --pg-conf proguard.cfg \\\n           --lib \u003candroid.jar/rt.jar\u003e \\\n           input.jar\n\n\nWhen producing output targeted for the JVM one can pass `$JAVA_HOME` to `-lib`.\nR8 will then locate the Java bootclasspath from there.\n\nThe full set of R8 options can be obtained by running the command line tool with\nthe `--help` option.\n\nR8 is not command line compatible with ProGuard, for instance keep rules cannot be passed\non the command line, but have to be passed in a file using the `--pg-conf` option.\n\n## \u003ca name=\"replacing-r8-in-agp\"\u003e\u003c/a\u003eReplacing R8 in Android Gradle plugin\n\nAndroid Gradle plugin (AGP) ships with R8 embedded (as part of the `builder.jar` from\n`com.android.tools.build:builder:\u003cagp version\u003e` on https://maven.google.com).\n\nTo override the embedded version with a prebuilt R8 with version `\u003cversion\u003e`, merge\nthe following into the top level `settings.gradle` or `settings.gradle.kts`:\n```\npluginManagement {\n    buildscript {\n        repositories {\n            mavenCentral()\n            maven {\n                url = uri(\"https://storage.googleapis.com/r8-releases/raw\")\n            }\n        }\n        dependencies {\n            classpath(\"com.android.tools:r8:\u003cversion\u003e\")\n        }\n    }\n}\n```\nTo override the embedded version with a downloaded or freshly built `\u003cpath\u003e/r8.jar` merge\nthe following into the top level `settings.gradle` or `settings.gradle.kts`:\n```\npluginManagement {\n    buildscript {\n        dependencies {\n            classpath(files(\"\u003cpath\u003e/r8.jar\"))\n        }\n    }\n}\n```\n\n## Testing\n\nTypical steps to run tests:\n\n    $ tools/test.py --no_internal\n\nThe `tools/test.py` script will use depot_tools to download a lot of tests\nand test dependencies on the first run. This includes prebuilt version of the\nart runtime on which to validate the produced dex code.\n\n## Contributing\n\nIn order to contribute to D8/R8 you have to sign the\n[Contributor License Agreement](https://cla.developers.google.com/about/google-individual).\nIf your contribution is owned by your employer you need the\n[Corporate Contributor License Agreement](https://cla.developers.google.com/about/google-corporate).\n\nSigning the CLA should be enough to be approved as a contributer. However, please send an email to\n[r8-dev@googlegroups.com](mailto:r8-dev@googlegroups.com) to introduce yourself and your plans\nfor contributing to the project.\n\nTo create an account for the code review tool (required for uploading changes)\nplease navigate to https://r8-review.googlesource.com/ and sign in with the\naccount used to sign the CLA. First time you do that you will be asked to\n_Create Gerrit Account_. Plase follow that process.\n\nTo create a branch for a change we recommend to use the `new-branch` git command from the\nChromium `depot_tools`:\n\n    $ git new-branch my-change\n\nThis will make a branch of `origin/main`, so remember to run `git fetch origin main` first.\nMake you changes and commit locally. Once you have a change that you are happy with\nyou should make sure that it passes all tests and then upload the change to our code\nreview tool using:\n\n    $ git cl upload\n\nOn your first upload you will be asked to acquire credentials. Follow the\ninstructions given by `git cl upload` (as of Aug 5 2025 that is running\n`git credential-luci login`, the previous `.gitcookies` based authentication\nscheme has been deprecated.).\n\nOn successful uploads a link to the code review is printed in the\noutput of the `git cl upload` command. In the code review tool you can\nassign reviewers and mark the change ready for review. At that\npoint the code review tool will send emails to reviewers.\n\n## Getting help\n\nFor questions, reach out to us at\n[r8-dev@googlegroups.com](mailto:r8-dev@googlegroups.com).\n\nFor D8, find known issues in the\n[D8 issue tracker](https://issuetracker.google.com/issues?q=componentid:317603)\nor file a new\n[D8 bug report](https://issuetracker.google.com/issues/new?component=317603).\n\nFor R8, find known issues in the\n[R8 issue tracker](https://issuetracker.google.com/issues?q=componentid:326788)\nor file a new\n[R8 bug report](https://issuetracker.google.com/issues/new?component=326788).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnsonlee%2Fr8","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnsonlee%2Fr8","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnsonlee%2Fr8/lists"}