From c2c92502388d8ac34c0f64c124cad68d6b142796 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Sun, 4 Mar 2018 18:27:34 +0300 Subject: [PATCH] Fix crash on android 4.1 --- android/AndroidManifest.xml | 3 ++- android/README | 4 ++-- android/src/org/libsdl/app/SDLActivity.java | 3 +-- android/src/org/libsdl/app/SDLControllerManager.java | 3 +-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index e4b81a3..c1be474 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -29,7 +29,8 @@ android:icon="@drawable/ic_launcher" android:allowBackup="true" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" - android:hardwareAccelerated="true" > + android:hardwareAccelerated="true" + android:debuggable="true" > = 19.1.0; -* Android SDK platforms >= android-19; +* Android SDK platforms >= android-16; * Android NDK >= r16b; * Open JDK >= 8; * FPC >= 3.0.4; @@ -79,4 +79,4 @@ jarsigner -sigalg SHA1withRSA -digestalg SHA1 \ bin/d2df.unsigned.apk androiddebugkey ``` -Where ${ANDROID_JAR} is path to android.jar file. Typically placed in ~/Android/android-sdk/platforms/android-19/android.jar. +Where ${ANDROID_JAR} is path to android.jar file. Typically placed in ~/Android/android-sdk/platforms/android-16/android.jar. diff --git a/android/src/org/libsdl/app/SDLActivity.java b/android/src/org/libsdl/app/SDLActivity.java index 9119473..57f931e 100644 --- a/android/src/org/libsdl/app/SDLActivity.java +++ b/android/src/org/libsdl/app/SDLActivity.java @@ -4,7 +4,6 @@ import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.lang.reflect.Method; -import java.util.Objects; import android.app.*; import android.content.*; @@ -542,7 +541,7 @@ public class SDLActivity extends Activity { { int orientation = -1; - if (!Objects.equals(hint, "")) { + if (hint != null && !hint.equals("")) { if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) { orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; } else if (hint.contains("LandscapeRight")) { diff --git a/android/src/org/libsdl/app/SDLControllerManager.java b/android/src/org/libsdl/app/SDLControllerManager.java index 3629442..1f21eab 100644 --- a/android/src/org/libsdl/app/SDLControllerManager.java +++ b/android/src/org/libsdl/app/SDLControllerManager.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; -import java.util.Objects; import android.content.Context; import android.os.*; @@ -266,7 +265,7 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler_API12 { public String getJoystickDescriptor(InputDevice joystickDevice) { String desc = joystickDevice.getDescriptor(); - if (desc != null && !Objects.equals(desc, "")) { + if (desc != null && !desc.equals("")) { return desc; } -- 2.29.2