{"id":3661,"url":"https://github.com/evant/gradle-retrolambda","last_synced_at":"2025-05-14T06:12:45.612Z","repository":{"id":9884760,"uuid":"11888356","full_name":"evant/gradle-retrolambda","owner":"evant","description":"A gradle plugin for getting java lambda support in java 6, 7 and android","archived":false,"fork":false,"pushed_at":"2023-07-24T15:03:12.000Z","size":609,"stargazers_count":5290,"open_issues_count":76,"forks_count":446,"subscribers_count":174,"default_branch":"main","last_synced_at":"2025-04-11T01:41:46.577Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evant.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2013-08-05T02:09:58.000Z","updated_at":"2025-04-01T06:37:49.000Z","dependencies_parsed_at":"2024-04-24T23:33:29.582Z","dependency_job_id":"9fef93df-6120-4c36-be54-3a2da7cd0cdd","html_url":"https://github.com/evant/gradle-retrolambda","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Fgradle-retrolambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Fgradle-retrolambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Fgradle-retrolambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Fgradle-retrolambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evant","download_url":"https://codeload.github.com/evant/gradle-retrolambda/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254080616,"owners_count":22011455,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-01-05T20:16:47.836Z","updated_at":"2025-05-14T06:12:45.542Z","avatar_url":"https://github.com/evant.png","language":"Java","readme":"Gradle Retrolambda Plugin\n========================\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.tatarka/gradle-retrolambda/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/me.tatarka/gradle-retrolambda)\n\nThis plugin will automatically build your java or *android* project with\nretrolambda, giving you lambda goodness on java 6 or 7. It relies on the\nwonderful [retrolambda](https://github.com/orfjackal/retrolambda) by Esko\nLuontola.\n\nNote: The minimum android gradle plugin is `1.5.0` and the minimum gradle plugin is `2.5`.\n\nUsage\n----\n\n1. Download [jdk8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) and set it as your default.\n\n2. Add the following to your build.gradle\n\n   ```groovy\n   buildscript {\n      repositories {\n         mavenCentral()\n      }\n\n      dependencies {\n         classpath 'me.tatarka:gradle-retrolambda:3.7.1'\n      }\n   }\n\n   // Required because retrolambda is on maven central\n   repositories {\n      mavenCentral()\n   }\n\n   apply plugin: 'com.android.application' //or apply plugin: 'java'\n   apply plugin: 'me.tatarka.retrolambda'\n   ```\n   alternatively, you can use the new plugin syntax for gradle `2.1+`\n   ```groovy\n   plugins {\n      id \"me.tatarka.retrolambda\" version \"3.7.1\"\n   }\n   ```\n\n3. There is no step three!\n\nThe plugin will compile the source code with java8 and then replace the class\nfiles with the output of retrolambda.\n\nConfiguration\n-------------\nYou can add a block like the following to configure the plugin:\n```groovy\nretrolambda {\n  javaVersion JavaVersion.VERSION_1_6\n  jvmArgs '-arg1', '-arg2'\n  defaultMethods false\n  incremental true\n}\n```\n\n- `javaVersion` Set the java version to compile to. The default is 6. Only 5, 6 or 7 are accepted.\n- `include 'Debug', 'Release'` Sets which sets/variants to run through\n    retrolambda. The default is all of them.\n- `exclude 'Test'` Sets which sets/variants to not run through retrolambda. Only\n    one of either `include` or `exclude` should be defined.\n- `jvmArgs` Add additional jvm args when running retrolambda.\n- `defaultMethods` Turn on default and static methods in interfaces support. Note: due to a\n   limitation in retrolamba, this will set `incremental` to false. The default is false.\n- `incremental` Setting this to false forces all of your class files to be run through retrolambda\n   instead of only the ones that have changed. The default is true.\n\n### Using a Different Version of the retrolambda.jar\n\nThe default version of retrolambda used is\n`'net.orfjackal.retrolambda:retrolambda:2.5.6'`. If you want to use a different\none, you can configure it in your dependencies.\n\n```groovy\ndependencies {\n  // Latest one on maven central\n  retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:+'\n  // Or a local version\n  // retrolambdaConfig files('libs/retrolambda.jar')\n}\n```\n\n### Deprecated Features\n\nIf you are running with java 6 or 7 you should really consider updating. However, you may use the\nbelow configuration instead.\n\nSet the environment variable `JAVA8_HOME` to point to the java 8 jdk. Alternatively, you can set the\n`jdk` property.\n```groovy\nretrolambda {\n  jdk System.getenv(\"JAVA8_HOME\")\n}\n```\n\nYou can force unit tests to be run with an older version of java by setting\n `JAVA5_HOME`/`JAVA6_HOME`/`JAVA7_HOME` or with the `oldJdk` property.\n```groovy\nretrolambda {\n  oldJdk System.getenv(\"JAVA6_HOME\")\n}\n```\n\nAndroid Studio Setup\n--------------------\nAdd these lines to your `build.gradle` to inform the IDE of the language level.\n\n```groovy\nandroid {\n  compileOptions {\n    sourceCompatibility JavaVersion.VERSION_1_8\n    targetCompatibility JavaVersion.VERSION_1_8\n  }\n}\n```\n\nProguard\n----------\nThis plugin is fully compatible with proguard (since `v2.4.0`). In your proguard file, add\n```\n-dontwarn java.lang.invoke.*\n-dontwarn **$$Lambda$*\n```\n\nKnown Issues\n---------------\n### Lint fails on java files that have lambdas.\nFirst try updating to the latest version of the android gradle plugin. Newer versions of lint are\ncompatible with java 8 sources. If you can't for some reason, you can still use the\n[experimental fork](https://github.com/evant/android-retrolambda-lombok) to fix the issue.\n\n### Using Google Play Services causes retrolambda to fail\nVersion `5.0.77` contains bytecode that is incompatible with retrolambda. This should be fixed in\nnewer versions of play services, if you can update, that should be the preferred solution. To work\naround this issue, you can either use an earlier version like `4.4.52` or add `-noverify` to the jvm\nargs. See [orfjackal/retrolambda#25](https://github.com/orfjackal/retrolambda/issues/25) for more\ninformation.\n\n```groovy\nretrolambda {\n  jvmArgs '-noverify'\n}\n```\n\nUpdates\n-------\nAll updates have moved to the [CHANGELOG](https://github.com/evant/gradle-retrolambda/blob/master/CHANGELOG.md).\n\nLicense\n-------\n\n    Copyright 2013 Evan Tatarka\n    \n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n    \n       http://www.apache.org/licenses/LICENSE-2.0\n    \n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","funding_links":[],"categories":["Plugins","Android Studio","Libraries","Java","Gradle Plugin","Groovy","Android 开发中的日常积累","库","1. Important library","Uncategorized"],"sub_categories":["Language","Plugins","Other","Android Studio专题","[](https://github.com/JStumpp/awesome-android/blob/master/readme.md#other)其他","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevant%2Fgradle-retrolambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevant%2Fgradle-retrolambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevant%2Fgradle-retrolambda/lists"}