diff --git a/android/build.gradle b/android/build.gradle index 2d13518..a0283d4 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -120,6 +120,7 @@ android { // call regular ndk-build(.cmd) script from app directory task jniBuild(type: Exec) { + // In case ndk-gdb works one day, add: 'NDK_DEBUG=1', commandLine getNdkBuildCmd(), 'V=1', 'GPGBUILD='+externalInstallDir.absolutePath } jniBuild.dependsOn genSources diff --git a/android/src/org/pEp/jniadapter/AndroidHelper.java b/android/src/org/pEp/jniadapter/AndroidHelper.java index dd6474c..59b2a22 100644 --- a/android/src/org/pEp/jniadapter/AndroidHelper.java +++ b/android/src/org/pEp/jniadapter/AndroidHelper.java @@ -34,6 +34,7 @@ public class AndroidHelper { private static File optDir; private static File versionFile; public static File binDir; + private static File tmpDir; // TODO : Increment when needed. public static int VERSION_CODE = 0; @@ -61,6 +62,9 @@ public class AndroidHelper { setenv("PATH", System.getenv("PATH") + ":" + binDir.getAbsolutePath(), true); + tmpDir = new File(c.getCacheDir(), "tmp"); + setenv("TEMP", tmpDir.getAbsolutePath(), true); + // Tell dynamic loader where to find libs String appLibDir = ""; try { @@ -126,9 +130,17 @@ public class AndroidHelper { // Fill version file setInstalledVersion(c); + // Clean and creat tempdir + if (tmpDir.exists()){ + try { + FileUtils.deleteDirectory(tmpDir); + } catch (IOException e) { + Log.e(TAG, "Couldn't delete temp dir"); + } + } + optDir.mkdirs(); } - public static void nativeSetup(Context c) { // pre-load libs for pepengine, as // android cannot solve lib dependencies on its own