diff --git a/build.gradle b/build.gradle index d5e86476..c56d9b70 100644 --- a/build.gradle +++ b/build.gradle @@ -77,6 +77,12 @@ allprojects { } } +java { + toolchain { + languageVersion = JavaLanguageVersion.of(17) + } +} + configurations.all { resolutionStrategy { force "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.22" diff --git a/mixpaneldemo/build.gradle.kts b/mixpaneldemo/build.gradle.kts index 105baee2..fd17ed78 100644 --- a/mixpaneldemo/build.gradle.kts +++ b/mixpaneldemo/build.gradle.kts @@ -49,6 +49,12 @@ android { } } +java { + toolchain { + languageVersion = JavaLanguageVersion.of(8) + } +} + dependencies { implementation("androidx.core:core-ktx:1.13.1") implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.4") diff --git a/settings.gradle b/settings.gradle index cbd65f8c..a9b41750 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,7 @@ +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0' +} + include ":" rootProject.name = "mixpanel-android" include ':mixpanel-android' diff --git a/src/main/java/com/mixpanel/android/mpmetrics/SystemInformation.java b/src/main/java/com/mixpanel/android/mpmetrics/SystemInformation.java index d645389f..2f8f8d45 100644 --- a/src/main/java/com/mixpanel/android/mpmetrics/SystemInformation.java +++ b/src/main/java/com/mixpanel/android/mpmetrics/SystemInformation.java @@ -11,13 +11,13 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; +import android.hardware.display.DisplayManager; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Build; import android.telephony.TelephonyManager; import android.util.DisplayMetrics; import android.view.Display; -import android.view.WindowManager; import com.mixpanel.android.util.MPLog; @@ -88,7 +88,7 @@ private SystemInformation(Context context) { mHasTelephony = foundTelephony; mDisplayMetrics = new DisplayMetrics(); - Display display = ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); + Display display = ((DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE)).getDisplay(Display.DEFAULT_DISPLAY); display.getMetrics(mDisplayMetrics); }