1apply plugin: 'com.android.application' 2apply plugin: 'com.google.protobuf' 3 4android { 5 compileSdkVersion 27 6 7 defaultConfig { 8 applicationId "io.grpc.helloworldexample" 9 // API level 14+ is required for TLS since Google Play Services v10.2 10 minSdkVersion 14 11 targetSdkVersion 27 12 versionCode 1 13 versionName "1.0" 14 } 15 buildTypes { 16 debug { minifyEnabled false } 17 release { 18 minifyEnabled true 19 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 } 21 } 22 lintOptions { 23 disable 'GoogleAppIndexingWarning', 'HardcodedText', 'InvalidPackage' 24 textReport true 25 textOutput "stdout" 26 } 27} 28 29protobuf { 30 protoc { artifact = 'com.google.protobuf:protoc:3.5.1-1' } 31 plugins { 32 javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" } 33 grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.16.1' // CURRENT_GRPC_VERSION 34 } 35 } 36 generateProtoTasks { 37 all().each { task -> 38 task.plugins { 39 javalite {} 40 grpc { // Options added to --grpc_out 41 option 'lite' } 42 } 43 } 44 } 45} 46 47dependencies { 48 compile 'com.android.support:appcompat-v7:27.0.2' 49 50 // You need to build grpc-java to obtain these libraries below. 51 compile 'io.grpc:grpc-okhttp:1.16.1' // CURRENT_GRPC_VERSION 52 compile 'io.grpc:grpc-protobuf-lite:1.16.1' // CURRENT_GRPC_VERSION 53 compile 'io.grpc:grpc-stub:1.16.1' // CURRENT_GRPC_VERSION 54 compile 'javax.annotation:javax.annotation-api:1.2' 55} 56