From 51cfb57b4da8e71e39380bf5bf3e19414c779e12 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 27 Nov 2021 00:10:13 +0000 Subject: Update to Android target SDK 30 (#11746) --- android/app/build.gradle | 4 ++-- android/app/src/main/AndroidManifest.xml | 6 ++++-- android/app/src/main/java/net/minetest/minetest/MainActivity.java | 3 ++- android/app/src/main/java/net/minetest/minetest/UnzipService.java | 5 +++++ android/native/build.gradle | 4 ++-- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 234868f92..e8ba95722 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 29 + compileSdkVersion 30 buildToolsVersion '30.0.3' ndkVersion "$ndk_version" defaultConfig { applicationId 'net.minetest.minetest' minSdkVersion 16 - targetSdkVersion 29 + targetSdkVersion 30 versionName "${versionMajor}.${versionMinor}.${versionPatch}" versionCode project.versionCode } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index fa93e7069..6ea677cb9 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -30,7 +30,8 @@ android:configChanges="orientation|keyboardHidden|navigation|screenSize" android:maxAspectRatio="3.0" android:screenOrientation="sensorLandscape" - android:theme="@style/AppTheme"> + android:theme="@style/AppTheme" + android:exported="true"> @@ -44,7 +45,8 @@ android:launchMode="singleTask" android:maxAspectRatio="3.0" android:screenOrientation="sensorLandscape" - android:theme="@style/AppTheme"> + android:theme="@style/AppTheme" + android:exported="true"> diff --git a/android/app/src/main/java/net/minetest/minetest/MainActivity.java b/android/app/src/main/java/net/minetest/minetest/MainActivity.java index 56615fca7..b6567b4b7 100644 --- a/android/app/src/main/java/net/minetest/minetest/MainActivity.java +++ b/android/app/src/main/java/net/minetest/minetest/MainActivity.java @@ -101,7 +101,8 @@ public class MainActivity extends AppCompatActivity { mTextView = findViewById(R.id.textView); sharedPreferences = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && + Build.VERSION.SDK_INT < Build.VERSION_CODES.R) checkPermission(); else checkAppVersion(); diff --git a/android/app/src/main/java/net/minetest/minetest/UnzipService.java b/android/app/src/main/java/net/minetest/minetest/UnzipService.java index b513a7fe0..a61a49139 100644 --- a/android/app/src/main/java/net/minetest/minetest/UnzipService.java +++ b/android/app/src/main/java/net/minetest/minetest/UnzipService.java @@ -32,6 +32,7 @@ import android.os.Environment; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.annotation.RequiresApi; import androidx.annotation.StringRes; import java.io.File; @@ -200,6 +201,10 @@ public class UnzipService extends IntentService { * Migrates user data from deprecated external storage to app scoped storage */ private void migrate(Notification.Builder notificationBuilder, File newLocation) throws IOException { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + return; + } + File oldLocation = new File(Environment.getExternalStorageDirectory(), "Minetest"); if (!oldLocation.isDirectory()) return; diff --git a/android/native/build.gradle b/android/native/build.gradle index e37694f5b..2ddc77135 100644 --- a/android/native/build.gradle +++ b/android/native/build.gradle @@ -2,12 +2,12 @@ apply plugin: 'com.android.library' apply plugin: 'de.undercouch.download' android { - compileSdkVersion 29 + compileSdkVersion 30 buildToolsVersion '30.0.3' ndkVersion "$ndk_version" defaultConfig { minSdkVersion 16 - targetSdkVersion 29 + targetSdkVersion 30 externalNativeBuild { ndkBuild { arguments '-j' + Runtime.getRuntime().availableProcessors(), -- cgit v1.2.3