build.gradle 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. apply plugin: 'com.android.application'
  2. android {
  3. compileSdkVersion 26
  4. defaultConfig {
  5. applicationId "io.grpc.android.cpp.helloworldexample"
  6. minSdkVersion 21
  7. targetSdkVersion 26
  8. versionCode 1
  9. versionName "1.0"
  10. testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  11. externalNativeBuild {
  12. cmake {
  13. // The paths to the protoc and grpc_cpp_plugin binaries on the host system (codegen
  14. // is not cross-compiled to Android)
  15. def protoc = project.hasProperty('protoc') ?
  16. project.property('protoc') : '/usr/local/bin/protoc'
  17. def grpc_cpp_plugin = project.hasProperty('grpc_cpp_plugin') ?
  18. project.property('grpc_cpp_plugin') : '/usr/local/bin/grpc_cpp_plugin'
  19. cppFlags "-std=c++14 -frtti -fexceptions"
  20. arguments '-DANDROID_STL=c++_static'
  21. arguments '-DRUN_HAVE_POSIX_REGEX=0'
  22. arguments '-DRUN_HAVE_STD_REGEX=0'
  23. arguments '-DRUN_HAVE_STEADY_CLOCK=0'
  24. arguments '-Dprotobuf_BUILD_PROTOC_BINARIES=off'
  25. arguments '-DgRPC_BUILD_CODEGEN=off'
  26. arguments '-Dhelloworld_PROTOBUF_PROTOC_EXECUTABLE=' + protoc
  27. arguments '-Dhelloworld_GRPC_CPP_PLUGIN_EXECUTABLE=' + grpc_cpp_plugin
  28. }
  29. }
  30. ndk.abiFilters 'x86'
  31. }
  32. buildTypes {
  33. debug {
  34. minifyEnabled false
  35. }
  36. release {
  37. minifyEnabled true
  38. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  39. }
  40. }
  41. externalNativeBuild {
  42. cmake {
  43. path "CMakeLists.txt"
  44. }
  45. }
  46. }
  47. dependencies {
  48. implementation fileTree(dir: 'libs', include: ['*.jar'])
  49. implementation 'com.android.support:appcompat-v7:26.1.0'
  50. testImplementation 'junit:junit:4.12'
  51. androidTestImplementation 'com.android.support.test:runner:1.0.1'
  52. androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
  53. }