Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
825c5bf4
Unverified
Commit
825c5bf4
authored
Apr 10, 2019
by
Hao Nguyen
Committed by
GitHub
Apr 10, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6003 from haon4/documentation
Update documentation for JavaLite
parents
93a18cf2
92e824e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
33 deletions
+12
-33
lite.md
java/lite.md
+12
-33
No files found.
java/lite.md
View file @
825c5bf4
...
...
@@ -11,42 +11,21 @@ it's designed/implemented with different constraints. In particular, Java
Lite runtime has a much smaller code size which makes it more suitable to
be used on Android.
To use Java Lite runtime, you need to install protoc and the protoc plugin for
Java Lite runtime. You can obtain protoc following the instructions in th
e
toplevel
[
README.md
](
../README.md
)
file. For the protoc plugin, you can
download it from maven:
Note that in order to achieve maximum performance and code size, we will
NOT guarantee API/ABI stability for Java Lite. If this is not acceptabl
e
for your use-case, please use the full Java runtime instead. Note that
the latest version of Java Lite is not compatible with the 3.0.0 version.
https://repo1.maven.org/maven2/com/google/protobuf/protoc-gen-javalite/
You can generate Java Lite code for your .proto files:
Choose the version that works on your platform (e.g., on windows you can
download
`protoc-gen-javalite-3.0.0-windows-x86_32.exe`
), rename it to
protoc-gen-javalite (or protoc-gen-javalite.exe on windows) and place it
in a directory where it can be find in PATH. If you are using unix like OS
then make sure to convert
`protoc-gen-javalite`
to unix executable. For example
`chmod +x protoc-gen-javalite`
$ protoc --java_out=lite:${OUTPUT_DIR} path/to/your/proto/file
Once you have the protoc and protoc plugin, you can generate Java Lite code
for your .proto files:
Note that "optimize_for = LITE_RUNTIME" option in proto file is deprecated
and will not have any effect any more.
$ protoc --javalite_out=${OUTPUT_DIR} path/to/your/proto/file
The latest Java Lite runtime is not yet fully released in any official
version. You will need to build from our master's branch in order to use it.
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:
For the older version of Java Lite (v3.0.0), please refer to:
```
xml
<dependency>
<groupId>
com.google.protobuf
</groupId>
<artifactId>
protobuf-lite
</artifactId>
<version>
3.0.1
</version>
</dependency>
```
Make sure the version number of the runtime matches (or is newer than) the
version number of the protoc plugin. The version number of the protoc doesn't
matter and any version >= 3.0.0 should work.
### Use Protobuf Java Lite Runtime with Bazel
Bazel has native build rules to work with protobuf. For Java Lite runtime,
you can use the
`java_lite_proto_library`
rule. Check out
[
our build files
examples](../examples/BUILD) to learn how to use it.
https://github.com/protocolbuffers/protobuf/blob/javalite/java/lite.md
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment