Skip to content

Commit cb07f9f

Browse files
committed
Fix issue #31
1 parent 50a3bce commit cb07f9f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/src/main/java/andhook/lib/AndHook.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
11
package andhook.lib;
22

3+
import java.io.File;
34
import java.lang.reflect.Member;
45
import java.lang.reflect.Modifier;
56

67
import android.os.Build;
78
import android.util.Log;
89

910
/**
10-
* @author rrrfff
11-
* @version 3.5.1
11+
* @author Rprop
12+
* @version 3.5.2
1213
*/
1314
@SuppressWarnings({"unused", "WeakerAccess", "JniMissingFunction"})
1415
public final class AndHook {
15-
public final static String VERSION = "3.5.1";
16+
public final static String VERSION = "3.5.2";
1617
public final static String LOG_TAG = "AndHook";
1718

1819
static {
20+
// Check if there is a usable directory for temporary files
21+
final File tmpdir = new File(System.getProperty("java.io.tmpdir", "/data/local/tmp/"));
22+
if (!tmpdir.canWrite() || !tmpdir.canExecute())
23+
throw new RuntimeException("Unable to load AndHook due to missing cache directory");
24+
1925
try {
2026
System.loadLibrary("AndHook");
2127
} catch (final UnsatisfiedLinkError e) {
2228
try {
2329
// compatible with libhoudini
2430
System.loadLibrary("AndHookCompat");
2531
} catch (final UnsatisfiedLinkError ignored) {
26-
throw new RuntimeException("incompatible platform", e);
32+
throw new RuntimeException("Incompatible platform", e);
2733
}
2834
}
2935
}

0 commit comments

Comments
 (0)