Skip to content

Commit

Permalink
fix crash by minifyEnabled release, extern sd card display
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriSizuku committed Feb 26, 2023
1 parent 0d27099 commit ffab65d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/onsyuri_android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ android {
}
buildTypes {
release {
minifyEnabled true
minifyEnabled true // this may cause jni crash
debuggable false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
Expand Down
6 changes: 3 additions & 3 deletions src/onsyuri_android/app/java/com/yuri/onscripter/SafFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ public static String uri2Path(@NonNull Uri uri){
// uri format
String scheme = uri.getScheme();
if(scheme.equals("content")) {
String path = uri.getLastPathSegment();
if(!path.contains("primary:")) path = "/" + path.replace("%3A", "/");
String path = uri.getLastPathSegment(); //already decoded
if(!path.contains("primary:")) path = "/storage/" + path.replace(":", "/");
else path = "/storage/emulated/0/" + path.replace("primary:", "");
return Uri.decode(path);
return path;
} else if (scheme.equals("file")) {
return Uri.decode(uri.getPath());
}
Expand Down
8 changes: 8 additions & 0 deletions src/onsyuri_android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
# public *;
#}

-keep class com.yuri.onscripter.ONScripter {
public *;
}

-keep class org.libsdl.app.** {
public *;
}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
Expand Down

0 comments on commit ffab65d

Please sign in to comment.