File tree Expand file tree Collapse file tree 9 files changed +33
-20
lines changed
java/io/grpc/android/integrationtest Expand file tree Collapse file tree 9 files changed +33
-20
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ Some parts of grpc-java depend on Android. Since many Java developers don't have
15
15
the Android SDK installed and don't need to run or modify the Android
16
16
components, the build can skip it. To skip, create the file
17
17
` <project-root>/gradle.properties ` and add ` skipAndroid=true ` .
18
+ Otherwise, create the file ` <project-root>/gradle.properties ` and add ` android.useAndroidX=true ` .
18
19
19
20
Then, to build, run:
20
21
```
Original file line number Diff line number Diff line change @@ -29,12 +29,12 @@ android {
29
29
sourceCompatibility JavaVersion . VERSION_1_8
30
30
targetCompatibility JavaVersion . VERSION_1_8
31
31
}
32
- compileSdkVersion 26
32
+ compileSdkVersion 29
33
33
34
34
defaultConfig {
35
35
applicationId " io.grpc.android.integrationtest"
36
36
minSdkVersion 19
37
- targetSdkVersion 26
37
+ targetSdkVersion 29
38
38
versionCode 1
39
39
versionName " 1.0"
40
40
testInstrumentationRunner " androidx.test.runner.AndroidJUnitRunner"
@@ -47,14 +47,17 @@ android {
47
47
proguardFiles getDefaultProguardFile(' proguard-android.txt' ), ' proguard-rules.pro'
48
48
}
49
49
}
50
- lintOptions { disable ' InvalidPackage' , ' HardcodedText' }
50
+ lintOptions {
51
+ disable ' InvalidPackage' , ' HardcodedText' ,
52
+ ' MissingClass' // https://github.com/grpc/grpc-java/issues/8799
53
+ }
51
54
}
52
55
53
56
dependencies {
54
- implementation ' com.android.support :appcompat-v7:26.1 .0'
55
- implementation ' com.android.support :multidex:1 .0.3 '
56
- implementation ' com.android.support:support-annotations:26.1.0 '
57
- implementation ' com.google.android.gms:play-services-base:16.1.0 '
57
+ implementation ' androidx.appcompat :appcompat:1.3 .0'
58
+ implementation ' androidx.multidex :multidex:2 .0.0 '
59
+ implementation libraries . androidx_annotation
60
+ implementation ' com.google.android.gms:play-services-base:18.0.1 '
58
61
59
62
implementation project(' :grpc-auth' ),
60
63
project(' :grpc-census' ),
Original file line number Diff line number Diff line change 9
9
android : icon =" @mipmap/ic_launcher"
10
10
android : label =" @string/app_name"
11
11
android : theme =" @style/Base.V7.Theme.AppCompat.Light"
12
- android : name =" android.support .multidex.MultiDexApplication" >
12
+ android : name =" androidx .multidex.MultiDexApplication" >
13
13
<activity
14
14
android : name =" .TesterActivity"
15
15
android : label =" @string/app_name" >
Original file line number Diff line number Diff line change 19
19
import android .content .Context ;
20
20
import android .content .Intent ;
21
21
import android .os .Bundle ;
22
- import android .support .v7 .app .AppCompatActivity ;
23
22
import android .text .TextUtils ;
24
23
import android .util .Log ;
25
24
import android .view .View ;
28
27
import android .widget .CheckBox ;
29
28
import android .widget .EditText ;
30
29
import android .widget .TextView ;
30
+ import androidx .appcompat .app .AppCompatActivity ;
31
31
import com .google .android .gms .security .ProviderInstaller ;
32
32
import io .grpc .ManagedChannel ;
33
33
import java .io .InputStream ;
Original file line number Diff line number Diff line change 16
16
17
17
package io .grpc .android .integrationtest ;
18
18
19
- import android . support .annotation .Nullable ;
19
+ import androidx .annotation .Nullable ;
20
20
import io .grpc .ChannelCredentials ;
21
21
import io .grpc .Grpc ;
22
22
import io .grpc .InsecureChannelCredentials ;
Original file line number Diff line number Diff line change @@ -21,10 +21,12 @@ echo y | ${ANDROID_HOME}/tools/bin/sdkmanager "build-tools;28.0.3"
21
21
# Proto deps
22
22
buildscripts/make_dependencies.sh
23
23
24
+ GRADLE_FLAGS=" -Pandroid.useAndroidX=true"
25
+
24
26
# Build and run interop instrumentation tests on Firebase Test Lab
25
27
cd android-interop-testing
26
- ../gradlew assembleDebug
27
- ../gradlew assembleDebugAndroidTest
28
+ ../gradlew assembleDebug $GRADLE_FLAGS
29
+ ../gradlew assembleDebugAndroidTest $GRADLE_FLAGS
28
30
gcloud firebase test android run \
29
31
--type instrumentation \
30
32
--app build/outputs/apk/debug/grpc-android-interop-testing-debug.apk \
@@ -41,7 +43,7 @@ gcloud firebase test android run \
41
43
42
44
# Build and run binderchannel instrumentation tests on Firebase Test Lab
43
45
cd ../binder
44
- ../gradlew assembleDebugAndroidTest
46
+ ../gradlew assembleDebugAndroidTest $GRADLE_FLAGS
45
47
gcloud firebase test android run \
46
48
--type instrumentation \
47
49
--app ../android-interop-testing/build/outputs/apk/debug/grpc-android-interop-testing-debug.apk \
Original file line number Diff line number Diff line change @@ -28,13 +28,16 @@ echo y | ${ANDROID_HOME}/tools/bin/sdkmanager "build-tools;28.0.3"
28
28
# Proto deps
29
29
buildscripts/make_dependencies.sh
30
30
31
+ GRADLE_FLAGS=" -Pandroid.useAndroidX=true"
32
+
31
33
./gradlew \
32
34
:grpc-android-interop-testing:build \
33
35
:grpc-android:build \
34
36
:grpc-cronet:build \
35
37
:grpc-binder:build \
36
38
assembleAndroidTest \
37
- publishToMavenLocal
39
+ publishToMavenLocal \
40
+ $GRADLE_FLAGS
38
41
39
42
if [[ ! -z $( git status --porcelain) ]]; then
40
43
git status
@@ -89,7 +92,7 @@ cd $BASE_DIR/github/grpc-java
89
92
./gradlew clean
90
93
git checkout HEAD^
91
94
./gradlew --stop # use a new daemon to build the previous commit
92
- ./gradlew publishToMavenLocal
95
+ ./gradlew publishToMavenLocal $GRADLE_FLAGS
93
96
cd examples/android/helloworld/
94
97
../../gradlew build
95
98
Original file line number Diff line number Diff line change @@ -14,25 +14,29 @@ readonly GRPC_JAVA_DIR="$(cd "$(dirname "$0")"/../.. && pwd)"
14
14
# use --include-build for its grpc-core dependency
15
15
echo y | ${ANDROID_HOME} /tools/bin/sdkmanager " build-tools;28.0.3"
16
16
LOCAL_MVN_TEMP=$( mktemp -d)
17
+ GRADLE_FLAGS=" -Pandroid.useAndroidX=true"
17
18
pushd " $GRPC_JAVA_DIR /android"
18
19
../gradlew publish \
19
20
-Dorg.gradle.parallel=false \
20
21
-PskipCodegen=true \
21
- -PrepositoryDir=" $LOCAL_MVN_TEMP "
22
+ -PrepositoryDir=" $LOCAL_MVN_TEMP " \
23
+ $GRADLE_FLAGS
22
24
popd
23
25
24
26
pushd " $GRPC_JAVA_DIR /cronet"
25
27
../gradlew publish \
26
28
-Dorg.gradle.parallel=false \
27
29
-PskipCodegen=true \
28
- -PrepositoryDir=" $LOCAL_MVN_TEMP "
30
+ -PrepositoryDir=" $LOCAL_MVN_TEMP " \
31
+ $GRADLE_FLAGS
29
32
popd
30
33
31
34
pushd " $GRPC_JAVA_DIR /binder"
32
35
../gradlew publish \
33
36
-Dorg.gradle.parallel=false \
34
37
-PskipCodegen=true \
35
- -PrepositoryDir=" $LOCAL_MVN_TEMP "
38
+ -PrepositoryDir=" $LOCAL_MVN_TEMP " \
39
+ $GRADLE_FLAGS
36
40
popd
37
41
38
42
readonly MVN_ARTIFACT_DIR=" ${MVN_ARTIFACT_DIR:- $GRPC_JAVA_DIR / mvn-artifacts} "
Original file line number Diff line number Diff line change 1
1
pluginManagement {
2
2
plugins {
3
- id " com.android.application" version " 3.5 .0"
4
- id " com.android.library" version " 3.5 .0"
3
+ id " com.android.application" version " 4.2 .0"
4
+ id " com.android.library" version " 4.2 .0"
5
5
id " com.github.johnrengelman.shadow" version " 6.1.0"
6
6
id " com.github.kt3k.coveralls" version " 2.10.2"
7
7
id " com.google.osdetector" version " 1.6.2"
You can’t perform that action at this time.
0 commit comments