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