FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: ensure dex cache directory exists before proxy generation by NathanWalker · Pull Request #1938 · NativeScript/android · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
12 changes: 12 additions & 0 deletions test-app/app/src/main/java/com/tns/RuntimeHelper.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ public static Runtime initRuntime(Context context) {

ClassLoader classLoader = context.getClassLoader();
File dexDir = new File(rootDir, "code_cache/secondary-dexes");
if (!dexDir.exists()) {
dexDir.mkdirs();
}
if (!dexDir.exists() || !dexDir.canWrite()) {
if (logger.isEnabled()) {
logger.write("Unable to use dex dir: " + dexDir.getAbsolutePath() + ", falling back to files/secondary-dexes");
}
dexDir = new File(appDir, "secondary-dexes");
if (!dexDir.exists()) {
dexDir.mkdirs();
}
}
String dexThumb = null;
try {
dexThumb = Util.getDexThumb(context);
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public String generateProxy(String proxyName, ClassDescriptor classToProxy, Hash

private String saveProxy(String proxyName, byte[] proxyBytes) throws IOException {
File file = new File(path + File.separator + proxyName + ".dex");
File parentDir = file.getParentFile();
if (parentDir != null && !parentDir.exists()) {
parentDir.mkdirs();
}
file.createNewFile();
FileOutputStream stream = new FileOutputStream(file);
stream.write(proxyBytes);
Expand Down
Loading

Back | FazBrowse Home | New Git URL