How to use ProfoBuf in Android App
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.12'
Add protobuf dependency in app level build.gradleimplementation 'com.google.protobuf:protobuf-lite:3.0.1'
Add plugin in app level build.gradleapply plugin: 'com.google.protobuf'
Add this in app level build.gradleprotobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.0.0'
}
plugins {
javalite {
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
}
}
// this is a task which wil generate classes for our proto files
generateProtoTasks {
all().each { task ->
task.builtins {
remove java
}
task.plugins {
javalite {}
}
}
}
}
sourceSets {
main.java.srcDirs += "${protobuf.generatedFilesBaseDir}/main/javalite"
}
processResources {
exclude('**/*.proto')
}
Add proto files in app -> src -> main-> proto folder.java files will be generated from proto file in the build -> generated folder when you build the project
Reference
이 문제에 관하여(How to use ProfoBuf in Android App), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/tapan/articles/51f62ef3d37321c83b2b텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)