1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.protobuf'
android {
compileSdkVersion 27
defaultConfig {
applicationId "io.grpc.helloworldexample"
// API level 14+ is required for TLS since Google Play Services v10.2
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
debug { minifyEnabled false }
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
disable 'GoogleAppIndexingWarning', 'HardcodedText', 'InvalidPackage'
textReport true
textOutput "stdout"
}
// Android Studio 3.1 does not automatically pick up '<src_set>/kotlin' as source input
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
androidTest.java.srcDirs += 'src/androidTest/kotlin'
}
lintOptions {
// Do not complain about outdated deps, so that this can javax.annotation-api can be same
// as other projects in this repo. Your project is not required to do this, and can
// upgrade the dep.
disable 'GradleDependency'
// The Android linter does not correctly detect resources used in Kotlin.
// See:
// - https://youtrack.jetbrains.com/issue/KT-7729
// - https://youtrack.jetbrains.com/issue/KT-12499
disable 'UnusedResources'
textReport true
textOutput "stdout"
}
}
protobuf {
protoc { artifact = 'com.google.protobuf:protoc:3.11.0' }
plugins {
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.26.0' // CURRENT_GRPC_VERSION
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
java { option 'lite' }
}
task.plugins {
grpc { // Options added to --grpc_out
option 'lite' }
}
}
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'javax.annotation:javax.annotation-api:1.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// You need to build grpc-java to obtain these libraries below.
implementation 'io.grpc:grpc-okhttp:1.26.0' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-protobuf-lite:1.26.0' // CURRENT_GRPC_VERSION
implementation 'io.grpc:grpc-stub:1.26.0' // CURRENT_GRPC_VERSION
}
repositories { mavenCentral() }
|