Skip to content

Updated to Gradle 8 and AGP 8 #2209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions Examples/OneSignalDemo/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
}

android {
namespace 'com.onesignal.sdktest'
compileSdkVersion 34
defaultConfig {
minSdkVersion 21
Expand Down Expand Up @@ -52,21 +53,28 @@ android {

// Forced downgrade to Java 1.8 for compiling the application due to Android N error when building
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

packagingOptions {
exclude 'androidsupportmultidexversion.txt'
}

task flavorSelection() {
if (getGradle().getStartParameter().getTaskRequests().toString().contains("Gms")) {
apply plugin: 'com.google.gms.google-services'
googleServices { disableVersionCheck = true }
} else {
apply plugin: 'com.huawei.agconnect'
}
androidComponents {
onVariants(selector().all(), { variant ->
println("HERE onVariants")
println(variant.name)
switch (variant.name) {
case "gms":
apply plugin: 'com.google.gms.google-services'
googleServices { disableVersionCheck = true }
break
case "huawei":
apply plugin: 'com.huawei.agconnect'
break
}
})
}
}

Expand Down
3 changes: 1 addition & 2 deletions Examples/OneSignalDemo/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:amazon="http://schemas.amazon.com/apk/res/android"
package="com.onesignal.sdktest">
xmlns:amazon="http://schemas.amazon.com/apk/res/android">

<uses-permission android:name="com.android.vending.BILLING" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.onesignal.notifications.IDisplayableNotification;
import com.onesignal.notifications.INotificationLifecycleListener;
import com.onesignal.notifications.INotificationWillDisplayEvent;
import com.onesignal.sdktest.BuildConfig;
import com.onesignal.sdktest.R;
import com.onesignal.sdktest.constant.Tag;
import com.onesignal.sdktest.constant.Text;
Expand All @@ -38,9 +37,8 @@ public class MainApplication extends MultiDexApplication {
private static final int SLEEP_TIME_TO_MIMIC_ASYNC_OPERATION = 2000;

public MainApplication() {
// run strict mode default in debug mode to surface any potential issues easier
if(BuildConfig.DEBUG)
StrictMode.enableDefaults();
// run strict mode to surface any potential issues easier
StrictMode.enableDefaults();
}

@SuppressLint("NewApi")
Expand Down
2 changes: 1 addition & 1 deletion Examples/OneSignalDemo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath 'com.android.tools.build:gradle:8.7.0'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.huawei.agconnect:agcp:1.6.2.300'

Expand Down
2 changes: 1 addition & 1 deletion OneSignalSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
targetSdkVersion: 34,
minSdkVersion: 21
]
androidGradlePluginVersion = '7.2.0'
androidGradlePluginVersion = '8.7.1'
googleServicesGradlePluginVersion = '4.3.10'
huaweiAgconnectVersion = '1.6.2.300'
huaweiHMSPushVersion = '6.3.0.304'
Expand Down
4 changes: 1 addition & 3 deletions OneSignalSDK/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
# Remove when creating an .aar build.
#android.enableAapt2=false

android.databinding.incremental = false
kapt.incremental.apt = false
android.testConfig.useRelativePath = false
org.gradle.jvmargs=-Xmx1536m

# Enables D8 for all modules.
android.enableD8 = true
Expand Down
2 changes: 1 addition & 1 deletion OneSignalSDK/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 4 additions & 2 deletions OneSignalSDK/onesignal/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
}

android {
Expand All @@ -21,10 +22,11 @@ android {
}
// Forced downgrade to Java 8 so SDK is backwards compatible in consuming projects
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
namespace 'com.onesignal'
kotlinOptions.freeCompilerArgs += ['-module-name', namespace]
}

ext {
Expand Down
5 changes: 3 additions & 2 deletions OneSignalSDK/onesignal/maven-push.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ afterEvaluate {

publications {
release(MavenPublication) {
from components.release

pom {
name = projectName
description = projectDescription
Expand Down Expand Up @@ -95,6 +93,9 @@ afterEvaluate {
}
}
}
afterEvaluate {
from components.findByName('release')
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ internal class NotificationDisplayBuilder(
if (bitmap == null) return null
try {
val systemLargeIconHeight =
contextResources!!.getDimension(R.dimen.notification_large_icon_height).toInt()
contextResources!!.getDimension(android.R.dimen.notification_large_icon_height).toInt()
val systemLargeIconWidth =
contextResources!!.getDimension(R.dimen.notification_large_icon_width).toInt()
contextResources!!.getDimension(android.R.dimen.notification_large_icon_width).toInt()
val bitmapHeight = bitmap.height
val bitmapWidth = bitmap.width
if (bitmapWidth > systemLargeIconWidth || bitmapHeight > systemLargeIconHeight) {
Expand Down
Loading