blob: 2b9e483a1aeccdbb29c376bd156d1b7ca255e914 [file] [log] [blame] [view]
Feng Xiao7d550402018-04-12 17:58:55 -07001# Protocol Buffers - Google's data interchange format
2
3Copyright 2008 Google Inc.
4
5https://developers.google.com/protocol-buffers/
6
7## Use Protobuf Java Lite Runtime
8
9Protobuf Java Lite runtime is separated from the main Java runtime because
10it's designed/implemented with different constraints. In particular, Java
11Lite runtime has a much smaller code size which makes it more suitable to
12be used on Android.
13
Hao Nguyen1da2a672019-04-09 13:07:25 -070014Note that in order to achieve maximum performance and code size, we will
15NOT guarantee API/ABI stability for Java Lite. If this is not acceptable
16for your use-case, please use the full Java runtime instead. Note that
17the latest version of Java Lite is not compatible with the 3.0.0 version.
Feng Xiao7d550402018-04-12 17:58:55 -070018
Hao Nguyen1da2a672019-04-09 13:07:25 -070019You can generate Java Lite code for your .proto files:
Feng Xiao7d550402018-04-12 17:58:55 -070020
Hao Nguyen1da2a672019-04-09 13:07:25 -070021 $ protoc --java_out=lite:${OUTPUT_DIR} path/to/your/proto/file
Feng Xiao7d550402018-04-12 17:58:55 -070022
Hao Nguyen1da2a672019-04-09 13:07:25 -070023Note that "optimize_for = LITE_RUNTIME" option in proto file is deprecated
24and will not have any effect any more.
Feng Xiao7d550402018-04-12 17:58:55 -070025
Hao Nguyencf9fe722019-05-08 17:05:58 -070026Include the generated Java files in your project and add a dependency on the
27protobuf Java runtime. If you are using Maven, use the following:
28
29```xml
30<dependency>
31 <groupId>com.google.protobuf</groupId>
32 <artifactId>protobuf-javalite</artifactId>
33 <version>3.8.0</version>
34</dependency>
35```
Hao Nguyen92e824e2019-04-09 15:07:44 -070036
37For the older version of Java Lite (v3.0.0), please refer to:
38
39 https://github.com/protocolbuffers/protobuf/blob/javalite/java/lite.md