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