Better error for writeable dex mod import failure

This commit is contained in:
Anuken 2024-10-18 19:35:14 -04:00
parent 82de8ca468
commit c7def5fa54
3 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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");

View File

@ -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