Skip to content

Commit 0432c70

Browse files
authored
Upgrade Android Gradle plugin to 8.2.2 (#564)
Upgrade compileSdk version to 34 Update build and dependencies to be compatible with Java 17
1 parent 5691b06 commit 0432c70

File tree

22 files changed

+83
-79
lines changed

22 files changed

+83
-79
lines changed

.travis.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ language: android
55
env:
66
global:
77
- JAVA_TOOL_OPTIONS=-Dhttps.protocols=TLSv1.2
8-
- BUILD_API=31
9-
- BUILD_TOOLS=31.0.0
8+
- BUILD_API=34
9+
- BUILD_TOOLS=34.0.0
1010
- ABI=x86
1111
- EMU_API=22
1212
- EMU_FLAVOR=default
@@ -24,11 +24,6 @@ android:
2424
components:
2525
- tools
2626

27-
# Uncomment and remove lines in before_install when issue with JDK is resolved
28-
# Check thread here: https://travis-ci.community/t/installing-oraclejdk-11-failed/13050/10
29-
# jdk:
30-
# - oraclejdk11
31-
3227
licenses:
3328
- 'android-sdk-preview-license-.+'
3429
- 'android-sdk-license-.+'
@@ -37,8 +32,8 @@ licenses:
3732
before_install:
3833
- curl -s "https://get.sdkman.io" | bash
3934
- source "$HOME/.sdkman/bin/sdkman-init.sh"
40-
- sdk install java 11.0.12-open
41-
- sdk use java 11.0.12-open
35+
- sdk install java 17.0.2-open
36+
- sdk use java 17.0.2-open
4237
# Install cmdline-tools (older tools doesn't support Java 11)
4338
- wget -q "https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip" -O android-commandline-tools-linux.zip
4439
- mkdir -p ${ANDROID_HOME}/cmdline-tools

AndroidSDKCore/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ apply from: "../common-methods.gradle"
99

1010
android {
1111
namespace 'com.leanplum.core'
12-
compileSdkVersion COMPILE_SDK_VERSION
12+
compileSdk COMPILE_SDK_VERSION
1313
useLibrary 'org.apache.http.legacy'
1414

1515
defaultConfig {
@@ -36,6 +36,9 @@ android {
3636
sourceCompatibility JAVA_VERSION
3737
targetCompatibility JAVA_VERSION
3838
}
39+
kotlinOptions {
40+
jvmTarget = JAVA_VERSION
41+
}
3942
}
4043

4144
dependencies {

AndroidSDKCore/src/main/java/com/leanplum/internal/LeanplumEventDataManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
package com.leanplum.internal;
2323

24+
import android.annotation.SuppressLint;
2425
import android.content.ContentValues;
2526
import android.content.Context;
2627
import android.database.Cursor;
@@ -118,6 +119,7 @@ List<Map<String, Object>> getEvents(int count) {
118119
null, KEY_ROWID + " ASC", "" + count);
119120
hasDatabaseError = false;
120121
while (cursor.moveToNext()) {
122+
@SuppressLint("Range")
121123
Map<String, Object> requestArgs = JsonConverter.mapFromJson(new JSONObject(
122124
cursor.getString(cursor.getColumnIndex(COLUMN_DATA))));
123125
events.add(requestArgs);

AndroidSDKFcm/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ dependencies {
3535
api project(':AndroidSDKPush')
3636

3737
// Provided dependencies are optional dependencies and will not show up in pom file.
38-
compileOnly('com.google.firebase:firebase-messaging:[20.3.0,)') {
39-
exclude module: 'support-v4'
40-
}
41-
38+
compileOnly('com.google.firebase:firebase-messaging:23.0.8')
4239
implementation "com.clevertap.android:clevertap-android-sdk:${CT_SDK_VERSION}"
4340
}
4441

AndroidSDKLocation/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dependencies {
3434
api project(':AndroidSDKCore')
3535

3636
// Provided dependencies are optional dependencies and will not show up in pom file.
37-
compileOnly('com.google.android.gms:play-services-location:[10.0.0,)') {
37+
compileOnly('com.google.android.gms:play-services-location:[16.0.0,)') {
3838
exclude module: 'support-v4'
3939
}
4040
}

AndroidSDKPush/src/main/java/com/leanplum/LeanplumNotificationHelper.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,13 @@
3636
import android.os.Build;
3737
import android.os.Build.VERSION_CODES;
3838
import android.os.Bundle;
39+
import android.text.TextUtils;
40+
3941
import androidx.annotation.Nullable;
4042
import androidx.annotation.RequiresApi;
4143
import androidx.core.app.NotificationCompat;
42-
import android.text.TextUtils;
43-
import android.util.TypedValue;
44-
import android.widget.RemoteViews;
45-
4644
import androidx.core.app.NotificationManagerCompat;
47-
import com.leanplum.internal.Constants;
45+
4846
import com.leanplum.internal.Constants.Keys;
4947
import com.leanplum.internal.JsonConverter;
5048
import com.leanplum.internal.Log;

AndroidSDKTests/build.gradle

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,19 @@ dependencies {
7373

7474
// Dependencies used for unit tests.
7575
testImplementation 'junit:junit:4.13'
76-
testImplementation('org.robolectric:robolectric:4.3.1') {
76+
testImplementation('org.robolectric:robolectric:4.7.3') {
7777
exclude group: 'commons-logging', module: 'commons-logging'
7878
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
7979
}
80+
testImplementation 'commons-io:commons-io:2.16.1'
8081
testImplementation 'org.robolectric:shadows-play-services:3.3.2'
8182
testImplementation 'org.mockito:mockito-core:1.10.19'
8283
testImplementation 'org.powermock:powermock-module-junit4:1.6.5'
8384
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.5'
8485
testImplementation 'org.powermock:powermock-api-mockito:1.6.5'
8586
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.5'
86-
testImplementation 'org.bouncycastle:bcmail-jdk15on:1.65'
87+
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.5'
88+
testImplementation 'org.bouncycastle:bcmail-jdk18on:1.71.1'
8789

8890
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
8991
androidTestImplementation 'androidx.test:runner:1.2.0'
@@ -106,3 +108,24 @@ configurations {
106108
artifacts {
107109
unitTestArtifact jarTests
108110
}
111+
112+
tasks.withType(Test) {
113+
jvmArgs '--add-opens=java.base/java.lang.reflect=ALL-UNNAMED',
114+
'--add-opens=java.base/java.lang=ALL-UNNAMED',
115+
'--add-opens=java.base/java.net=ALL-UNNAMED',
116+
'--add-opens=java.base/java.util=ALL-UNNAMED',
117+
'--add-opens=java.base/java.text=ALL-UNNAMED',
118+
'--add-opens=java.desktop/java.awt.font=ALL-UNNAMED',
119+
'--add-opens=java.base/java.security=ALL-UNNAMED',
120+
'--add-opens=java.base/java.io=ALL-UNNAMED',
121+
'--add-opens=java.base/sun.security.jca=ALL-UNNAMED',
122+
'--add-opens=java.base/sun.security.util=ALL-UNNAMED',
123+
'--add-opens=java.base/jdk.internal.util=ALL-UNNAMED',
124+
'--add-opens=java.base/javax.net.ssl=ALL-UNNAMED',
125+
'--add-opens=java.base/java.util.regex=ALL-UNNAMED',
126+
'--add-opens=java.base/java.util.concurrent=ALL-UNNAMED',
127+
'--add-opens=java.base/sun.util.calendar=ALL-UNNAMED',
128+
'--add-opens=java.base/java.util.zip=ALL-UNNAMED',
129+
'--add-opens=java.base/java.nio.charset=ALL-UNNAMED'
130+
131+
}

AndroidSDKTests/src/main/res/values/colors.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

AndroidSDKTests/src/main/res/values/styles.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
<!-- Base application theme. -->
44
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
5-
<!-- Customize your theme here. -->
6-
<item name="colorPrimary">@color/colorPrimary</item>
7-
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
8-
<item name="colorAccent">@color/colorAccent</item>
95
</style>
106

117
</resources>

AndroidSDKTests/src/test/java/com/leanplum/LeanplumActionContextTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import com.leanplum.internal.Log;
3333
import com.leanplum.internal.VarCache;
3434

35-
import org.apache.maven.artifact.ant.shaded.IOUtil;
3635
import org.junit.Assert;
3736
import org.junit.Test;
3837
import org.robolectric.RuntimeEnvironment;

0 commit comments

Comments
 (0)