From c7def5fa5454f3c2e6d570906a0a37a174c8bb3f Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 18 Oct 2024 19:35:14 -0400 Subject: [PATCH] Better error for writeable dex mod import failure --- core/assets/bundles/bundle.properties | 1 + core/src/mindustry/ui/dialogs/ModsDialog.java | 4 +++- gradle.properties | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index ccbcf0a603..c345e2a1ce 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -749,6 +749,7 @@ error.mapnotfound = Map file not found! error.io = Network I/O error. error.any = Unknown network error. error.bloom = Failed to initialize bloom.\nYour device may not support it. +error.moddex = Mindustry is unable to load this mod.\nYour device is blocking import of Java mods due to recent changes in Android.\nThere is no known workaround to this issue. weather.rain.name = Rain weather.snowing.name = Snow diff --git a/core/src/mindustry/ui/dialogs/ModsDialog.java b/core/src/mindustry/ui/dialogs/ModsDialog.java index f32ef1e9d5..92d912419e 100644 --- a/core/src/mindustry/ui/dialogs/ModsDialog.java +++ b/core/src/mindustry/ui/dialogs/ModsDialog.java @@ -107,6 +107,8 @@ public class ModsDialog extends BaseDialog{ ui.showErrorMessage("@feature.unsupported"); }else if(error instanceof HttpStatusException st){ ui.showErrorMessage(Core.bundle.format("connectfail", Strings.capitalize(st.status.toString().toLowerCase()))); + }else if(error.getMessage() != null && error.getMessage().toLowerCase(Locale.ROOT).contains("writable dex")){ + ui.showException("@error.moddex", error); }else{ ui.showException(error); } @@ -189,7 +191,7 @@ public class ModsDialog extends BaseDialog{ mods.importMod(file); setup(); }catch(Exception e){ - ui.showException(e); + ui.showException(e.getMessage() != null && e.getMessage().toLowerCase(Locale.ROOT).contains("writable dex") ? "@error.moddex" : "", e); Log.err(e); } }, "zip", "jar"); diff --git a/gradle.properties b/gradle.properties index e0f0692c65..d148b10c17 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,4 +26,4 @@ org.gradle.caching=true org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 android.enableR8.fullMode=false -archash=c1e3b23ddd +archash=079015dec0