Update to Android target SDK 30 (#11746)

This commit is contained in:
rubenwardy 2021-11-27 00:10:13 +00:00 committed by GitHub
parent 413be76c63
commit 51cfb57b4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 7 deletions

@ -1,12 +1,12 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
compileSdkVersion 29 compileSdkVersion 30
buildToolsVersion '30.0.3' buildToolsVersion '30.0.3'
ndkVersion "$ndk_version" ndkVersion "$ndk_version"
defaultConfig { defaultConfig {
applicationId 'net.minetest.minetest' applicationId 'net.minetest.minetest'
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 29 targetSdkVersion 30
versionName "${versionMajor}.${versionMinor}.${versionPatch}" versionName "${versionMajor}.${versionMinor}.${versionPatch}"
versionCode project.versionCode versionCode project.versionCode
} }

@ -30,7 +30,8 @@
android:configChanges="orientation|keyboardHidden|navigation|screenSize" android:configChanges="orientation|keyboardHidden|navigation|screenSize"
android:maxAspectRatio="3.0" android:maxAspectRatio="3.0"
android:screenOrientation="sensorLandscape" android:screenOrientation="sensorLandscape"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
@ -44,7 +45,8 @@
android:launchMode="singleTask" android:launchMode="singleTask"
android:maxAspectRatio="3.0" android:maxAspectRatio="3.0"
android:screenOrientation="sensorLandscape" android:screenOrientation="sensorLandscape"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme"
android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>

@ -101,7 +101,8 @@ public class MainActivity extends AppCompatActivity {
mTextView = findViewById(R.id.textView); mTextView = findViewById(R.id.textView);
sharedPreferences = getSharedPreferences(SETTINGS, Context.MODE_PRIVATE); 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(); checkPermission();
else else
checkAppVersion(); checkAppVersion();

@ -32,6 +32,7 @@ import android.os.Environment;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.StringRes; import androidx.annotation.StringRes;
import java.io.File; import java.io.File;
@ -200,6 +201,10 @@ public class UnzipService extends IntentService {
* Migrates user data from deprecated external storage to app scoped storage * Migrates user data from deprecated external storage to app scoped storage
*/ */
private void migrate(Notification.Builder notificationBuilder, File newLocation) throws IOException { 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"); File oldLocation = new File(Environment.getExternalStorageDirectory(), "Minetest");
if (!oldLocation.isDirectory()) if (!oldLocation.isDirectory())
return; return;

@ -2,12 +2,12 @@ apply plugin: 'com.android.library'
apply plugin: 'de.undercouch.download' apply plugin: 'de.undercouch.download'
android { android {
compileSdkVersion 29 compileSdkVersion 30
buildToolsVersion '30.0.3' buildToolsVersion '30.0.3'
ndkVersion "$ndk_version" ndkVersion "$ndk_version"
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 29 targetSdkVersion 30
externalNativeBuild { externalNativeBuild {
ndkBuild { ndkBuild {
arguments '-j' + Runtime.getRuntime().availableProcessors(), arguments '-j' + Runtime.getRuntime().availableProcessors(),