How to set up compile library in android studio. LOMBOK

前端 未结 4 1756
情话喂你
情话喂你 2020-12-31 06:35

Help me to set up comile dependencies in Android Studio in build.gradle. I mean that they not include into final APK.

this build.gradle works fine but i don\'t need

4条回答
  •  难免孤独
    2020-12-31 06:58

    With Android Studio 1.1.0, I couldn't find a consolidated set of instructions for adding Lombok that worked for me. That includes Lombok's own setup page: http://projectlombok.org/setup/android.html

    Here's everything I had to do to get it working (on OS X):

    • Install Lombok plugin in Android Studio
      • Android Studio > Preferences > Plugins
      • Click on Browse repositories...
      • Search for Lombok Plugin
      • Click on Install plugin
      • Restart Android Studio
    • Add to the android/dependencies block in app/build.gradle: provided 'org.projectlombok:lombok:1.16.2'
      • See search.maven.org for latest version, as lombok's instructions don't update as they release new versions
      • I assume the subprojects approach in build.gradle in the project root (from Олександр Самсонов's answer) works also, but it appears that requires moving the configuration from app/build.gradle (you aren't allowed to further extend the configuration in the subprojects). I didn't want to move the entire android configuration, so I kept it in the app/build.gradle instead.
    • Create a lombok.config file in the root of the project containing two lines: lombok.anyConstructor.suppressConstructorProperties = true lombok.addGeneratedAnnotation = false

提交回复
热议问题