Update README.md

pull/3109/head
zsurocking 10 years ago
parent 31be529eae
commit b20a70888b
  1. 31
      java/android/README.md

@ -9,32 +9,32 @@ PREREQUISITES
------------- -------------
- [Java gRPC](https://github.com/grpc/grpc-java) - [Java gRPC](https://github.com/grpc/grpc-java)
- [Android Tutorial](https://developer.android.com/training/basics/firstapp/index.html) If you're new to Android development - [Android Tutorial](https://developer.android.com/training/basics/firstapp/index.html) if you're new to Android development
- We only have Android gRPC client in this example. Please follow examples in other languages to build and run a gRPC server. - We only have Android gRPC client in this example. Please follow examples in other languages to build and run a gRPC server.
INSTALL INSTALL
------- -------
1 Clone the gRPC Java git repo **1 Clone the gRPC Java git repo**
```sh ```sh
$ git clone https://github.com/grpc/grpc-java $ git clone https://github.com/grpc/grpc-java
``` ```
2 Install gRPC Java, as described in [How to Build](https://github.com/grpc/grpc-java#how-to-build) **2 Install gRPC Java, as described in [How to Build](https://github.com/grpc/grpc-java#how-to-build)**
```sh ```sh
$ # from this dir $ # from this dir
$ cd grpc-java $ cd grpc-java
$ # follow the instructions in 'How to Build' $ # follow the instructions in 'How to Build'
``` ```
3 [Create an Android project](https://developer.android.com/training/basics/firstapp/creating-project.html) under your working directory. **3 [Create an Android project](https://developer.android.com/training/basics/firstapp/creating-project.html) under your working directory.**
- Set Application name to "Helloworld Example" and set Company Domain to "grpc.io". Make sure your package name is "io.grpc.helloworldexample" - Set Application name to "Helloworld Example" and set Company Domain to "grpc.io". Make sure your package name is "io.grpc.helloworldexample"
- Choose appropriate minimum SDK - Choose appropriate minimum SDK
- Use Blank Activity - Use Blank Activity
- Set Activity Name to HelloworldActivity - Set Activity Name to HelloworldActivity
- Set Layout Name to activity_helloworld - Set Layout Name to activity_helloworld
4 Prepare the app **4 Prepare the app**
- Clone this git repo - Clone this git repo
```sh ```sh
$ git clone https://github.com/grpc/grpc-common $ git clone https://github.com/grpc/grpc-common
@ -48,18 +48,21 @@ $ git clone https://github.com/grpc/grpc-common
``` ```
added outside your appplication tag added outside your appplication tag
5 Add dependencies. gRPC Java on Android depends on grpc-java, protobuf nano, okhttp **5 Add dependencies. gRPC Java on Android depends on grpc-java, protobuf nano, okhttp**
- Copy grpc-java .jar files to your_app_dir/app/libs/: - Copy grpc-java .jar files to your_app_dir/app/libs
- grpc-java/core/build/libs/*.jar ```sh
- grpc-java/stub/build/libs/*.jar $ cp grpc-java/core/build/libs/*.jar your_app_dir/app/libs/
- grpc-java/nano/build/libs/*.jar $ cp grpc-java/stub/build/libs/*.jar your_app_dir/app/libs/
- grpc-java/okhttp/build/libs/*.jar $ cp grpc-java/nano/build/libs/*.jar your_app_dir/app/libs/
- Copy or download other dependencies to your_app_dir/app/libs/: $ cp grpc-java/okhttp/build/libs/*.jar your_app_dir/app/libs/
```
- Copy or download other dependencies to your_app_dir/app/libs/
- [Guava 18](http://search.maven.org/remotecontent?filepath=com/google/guava/guava/18.0/guava-18.0.jar) - [Guava 18](http://search.maven.org/remotecontent?filepath=com/google/guava/guava/18.0/guava-18.0.jar)
- [okhttp 2.2.0](http://repo1.maven.org/maven2/com/squareup/okhttp/okhttp/2.2.0/okhttp-2.2.0.jar) - [okhttp 2.2.0](http://repo1.maven.org/maven2/com/squareup/okhttp/okhttp/2.2.0/okhttp-2.2.0.jar)
- [okio](https://github.com/square/okio)
- protobuf nano: - protobuf nano:
```sh ```sh
$ cp ~/.m2/repository/com/google/protobuf/nano/protobuf-javanano/2.6.2-pre/protobuf-javanano-2.6.2-pre.jar your_app_dir/app/libs/ $ cp ~/.m2/repository/com/google/protobuf/nano/protobuf-javanano/3.0.0-alpha-2/protobuf-javanano-3.0.0-alpha-2.jar your_app_dir/app/libs/
``` ```
- Make sure your_app_dir/app/build.gradle contains: - Make sure your_app_dir/app/build.gradle contains:
```sh ```sh
@ -68,4 +71,4 @@ dependencies {
} }
``` ```
6 [Run your example app](https://developer.android.com/training/basics/firstapp/running-app.html) **6 [Run your Helloworld Example app](https://developer.android.com/training/basics/firstapp/running-app.html)**

Loading…
Cancel
Save