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