Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions test-app/app/src/main/java/com/tns/RuntimeHelper.java
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
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