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.helloworldexample" 13 minSdkVersion 19 14 targetSdkVersion 33 15 versionCode 1 16 versionName "1.0" 17 } 18 buildTypes { 19 debug { minifyEnabled false } 20 release { 21 minifyEnabled true 22 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 23 } 24 } 25 lintOptions { 26 disable 'GoogleAppIndexingWarning', 'HardcodedText', 'InvalidPackage' 27 textReport true 28 textOutput "stdout" 29 } 30} 31 32protobuf { 33 protoc { artifact = 'com.google.protobuf:protoc:3.22.3' } 34 plugins { 35 grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.56.1-SNAPSHOT' // CURRENT_GRPC_VERSION 36 } 37 } 38 generateProtoTasks { 39 all().each { task -> 40 task.builtins { 41 java { option 'lite' } 42 } 43 task.plugins { 44 grpc { // Options added to --grpc_out 45 option 'lite' } 46 } 47 } 48 } 49} 50 51dependencies { 52 implementation 'com.android.support:appcompat-v7:27.0.2' 53 54 // You need to build grpc-java to obtain these libraries below. 55 implementation 'io.grpc:grpc-okhttp:1.56.1-SNAPSHOT' // CURRENT_GRPC_VERSION 56 implementation 'io.grpc:grpc-protobuf-lite:1.56.1-SNAPSHOT' // CURRENT_GRPC_VERSION 57 implementation 'io.grpc:grpc-stub:1.56.1-SNAPSHOT' // CURRENT_GRPC_VERSION 58 implementation 'org.apache.tomcat:annotations-api:6.0.53' 59} 60