Created
November 25, 2019 02:45
-
-
Save vivekvinodh/c71d39d431bfc405fd59b721b5647756 to your computer and use it in GitHub Desktop.
Gradle file for gRPC and protobuf v1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
apply plugin: 'com.google.protobuf' | |
apply plugin: 'kotlin-android' | |
apply plugin: 'kotlin-android-extensions' | |
android { | |
compileSdkVersion 29 | |
buildToolsVersion "29.0.2" | |
defaultConfig { | |
applicationId "com.vivekvinodh.protoexample" | |
minSdkVersion 19 | |
targetSdkVersion 29 | |
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.10.0' } | |
plugins { | |
javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" } | |
grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.25.0' // CURRENT_GRPC_VERSION | |
} | |
} | |
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.2' | |
implementation 'androidx.core:core-ktx:1.0.2' | |
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' | |
testImplementation 'junit:junit:4.12' | |
androidTestImplementation 'androidx.test:runner:1.1.1' | |
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' | |
api 'com.google.protobuf:protobuf-lite:3.0.1' | |
api 'io.grpc:grpc-okhttp:1.25.0' // CURRENT_GRPC_VERSION | |
api 'io.grpc:grpc-protobuf-lite:1.25.0' // CURRENT_GRPC_VERSION | |
api 'io.grpc:grpc-stub:1.25.0' // | |
api 'javax.annotation:javax.annotation-api:1.3.2' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try compiling your Gradle with latest protobuf gradle plugin and protoc compiler, it may give you similar error reported in this thread - google/protobuf-gradle-plugin#315.
If you face the same error follow the solution discussed in above thread, it will the compilation errors.