From 8b7a7cbc813653a3248d6cf3a7779e220957bc85 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 8 May 2017 21:28:02 +0200 Subject: The great rename: the old ‘website’ is now ‘website-old’, and ‘website2’ is now ‘website’. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website-old/setup/android.html | 131 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 website-old/setup/android.html (limited to 'website-old/setup/android.html') diff --git a/website-old/setup/android.html b/website-old/setup/android.html new file mode 100644 index 00000000..9edb9c95 --- /dev/null +++ b/website-old/setup/android.html @@ -0,0 +1,131 @@ + + + + + + + + + Project Lombok + + + Fork me on GitHub +
+

Project Lombok - android instructions

+ +
+

+ Android development with lombok is possible. Lombok should be a compile-time only dependency, as otherwise + the entirety of lombok will end up in your DEX files, wasting precious space on android devices. Also, errors will occur due + to the native libraries present in lombok.jar itself. Unfortunately, android does not (yet) understand the concept of a + compile-time-only dependency, so you need to mess with your build files to make it work. +

+ Android also does not have a complete JRE library stack; in particular, it does not have the @java.beans.ConstructorProperties annotation, therefore you have to stop lombok from generating these: +

    +
  • The suppressConstructorProperties property can be set to false when using @XArgsConstructor Annotations.
  • +
  • Starting with Lombok >= 1.14.0 you can instead a lombok.config file to the root of your project to disable ConstructorProperties project wide. Add the following line to lombok.config:
    +
    lombok.anyConstructor.suppressConstructorProperties = true

    + See the configuration documentation for more information on how to set up your project with a lombok config file. +
+

+ The instructions listed below are excerpts from The + AndroidAnnotations project cookbook. You may wish to refer to that documentation for complete instructions; lombok is just + the equivalent to androidannotations-VERSION.jar; there is no -api aspect. +

+

Eclipse

+
+ In eclipse, create a 'lightweight' lombok jar that contains only the annotations by running:

+
+java -jar lombok.jar publicApi
+ Then, add the lombok-api.jar file created by running this command + to your android project instead of the complete lombok.jar, and, + as usual, install lombok into eclipse by double-clicking lombok.jar. +
+

Ant

+
+
    +
  • Find build.xml in ${ANDROID_SDK_ROOT}/tools/ant/build.xml and copy the -compile target into the paste buffer. +
  • Copy this to the build.xml of your own project, right before the <import file="${sdk.dir}/tools/ant/build.xml"> line. +
  • Create a compile-libs directory in your own project and copy the complete lombok.jar to it. +
  • Now modify the <classpath> entry inside the <javac> task in the -compile target you just copied:
    + add <fileset dir="compile-libs" includes="*.jar" /> to it. +
+
+

Maven

+
+ You should be able to just follow the normal lombok with maven instructions.
+ Note that if you use android, eclipse, and maven together you may have to replace lombok.jar in your eclipse android project's build path + (which you can modify in that project's properties page) with lombok-api.jar, as produced in the procedure explained for Eclipse, + above. +
+

Gradle

+
+
    +
  • Make sure that the version of your android plugin is >= 0.4.3
  • +
  • Add Lombok to your application's dependencies block:

    +
    +	provided "org.projectlombok:lombok:1.12.6"
    +
    +
  • +
  • When using android-apt, you also have to specify Lombok as an annotation processor (with the apt directive) in the dependencies block:

    +
    +	provided "org.projectlombok:lombok:1.12.6"
    +	apt "org.projectlombok:lombok:1.12.6"
    +
    +
  • +
+
+

Android Studio

+
+ Follow the previous instructions (Gradle). In addition to setting up your gradle project correctly, you need to add the Lombok IntelliJ plugin to add lombok support to Android Studio: +
    +
  • Go to File > Settings > Plugins
  • +
  • Click on Browse repositories...
  • +
  • Search for Lombok Plugin
  • +
  • Click on Install plugin
  • +
  • Restart Android Studio
  • +
+
+
+
+ +
+ + + -- cgit