|
|
@ -4,27 +4,26 @@ Copyright 2008 Google Inc. |
|
|
|
|
|
|
|
|
|
|
|
https://developers.google.com/protocol-buffers/ |
|
|
|
https://developers.google.com/protocol-buffers/ |
|
|
|
|
|
|
|
|
|
|
|
## Use Protobuf Java Lite Runtime |
|
|
|
## Use the Protobuf Java Lite Runtime |
|
|
|
|
|
|
|
|
|
|
|
Protobuf Java Lite runtime is separated from the main Java runtime because |
|
|
|
The Protobuf Java Lite runtime is separated from the main Java runtime because |
|
|
|
it's designed/implemented with different constraints. In particular, Java |
|
|
|
it's designed and implemented with different constraints. In particular, the Java |
|
|
|
Lite runtime has a much smaller code size which makes it more suitable to |
|
|
|
Lite runtime is much smaller which makes it more suitable to be used on Android. |
|
|
|
be used on Android. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note that in order to achieve maximum performance and code size, we will |
|
|
|
In order to achieve maximum performance and code size, we do |
|
|
|
NOT guarantee API/ABI stability for Java Lite. If this is not acceptable |
|
|
|
NOT guarantee API/ABI stability for Java Lite. If this is not acceptable |
|
|
|
for your use-case, please use the full Java runtime instead. Note that |
|
|
|
for your use-case, use the full Java runtime instead. Note that |
|
|
|
the latest version of Java Lite is not compatible with the 3.0.0 version. |
|
|
|
the latest version of Java Lite is not compatible with the 3.0.0 version. |
|
|
|
|
|
|
|
|
|
|
|
You can generate Java Lite code for your .proto files: |
|
|
|
You can generate Java Lite code for your .proto files: |
|
|
|
|
|
|
|
|
|
|
|
$ protoc --java_out=lite:${OUTPUT_DIR} path/to/your/proto/file |
|
|
|
$ protoc --java_out=lite:${OUTPUT_DIR} path/to/your/proto/file |
|
|
|
|
|
|
|
|
|
|
|
Note that "optimize_for = LITE_RUNTIME" option in proto file is deprecated |
|
|
|
The "optimize_for = LITE_RUNTIME" option in the .proto file no longer has any |
|
|
|
and will not have any effect any more. |
|
|
|
effect on Java code. |
|
|
|
|
|
|
|
|
|
|
|
Include the generated Java files in your project and add a dependency on the |
|
|
|
Include the generated Java files in your project and add a dependency on the |
|
|
|
protobuf Java runtime. If you are using Maven, use the following: |
|
|
|
protobuf Java Lite runtime. If you are using Maven, include the following: |
|
|
|
|
|
|
|
|
|
|
|
```xml |
|
|
|
```xml |
|
|
|
<dependency> |
|
|
|
<dependency> |
|
|
|