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