Skip to content

Instantly share code, notes, and snippets.

@wakwak3125
Last active November 29, 2018 01:28
Show Gist options
  • Save wakwak3125/9b7b54e6ee4b67c08dcfab270ef22586 to your computer and use it in GitHub Desktop.
Save wakwak3125/9b7b54e6ee4b67c08dcfab270ef22586 to your computer and use it in GitHub Desktop.
Android + gRPC build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "com.google.protobuf"
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.wantedly.kusudama"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.5.1-1'
}
plugins {
javalite {
artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0"
}
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.16.1'
}
}
generateProtoTasks {
all().each { task ->
task.plugins {
javalite {}
grpc { // Options added to --grpc_out
option 'lite'
}
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
// gRPC dependencies
implementation "io.grpc:grpc-okhttp:1.16.1"
implementation "io.grpc:grpc-protobuf-lite:1.16.1"
implementation "io.grpc:grpc-stub:1.16.1"
implementation "javax.annotation:javax.annotation-api:1.2"
protobuf 'com.google.protobuf:protobuf-java:3.4.0'
protobuf 'com.google.api.grpc:proto-google-common-protos:1.12.0'
}
buildscript {
ext.kotlin_version = '1.3.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-beta04'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.7'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment