--- ./sdk/runtime/bin/directory_android.cc   2023-08-18 18:31:23.031019187 +0530
+++ ./sdk/runtime/bin/directory_android.cc   2023-08-18 18:38:05.141019034 +0530
@@ -430,7 +430,7 @@
   // TODO(4413): In the long run, when running in an application we should
   // probably use the appropriate directory from the Android API,
   // probably what File.createTempFile uses.
-  const char* kAndroidTempDir = "/data/local/tmp";
+  const char* kAndroidTempDir = "@TERMUX_PREFIX@/tmp";
   struct stat st;
   if (stat(kAndroidTempDir, &st) != 0) {
     mkdir(kAndroidTempDir, 0777);
--- ./sdk/runtime/vm/os_android.cc   2023-08-18 18:31:27.931019185 +0530
+++ ./sdk/runtime/vm/os_android.cc   2023-08-18 18:39:49.001018994 +0530
@@ -52,7 +52,7 @@
       return;
     }
     intptr_t pid = getpid();
-    char* filename = OS::SCreate(nullptr, "/tmp/perf-%" Pd ".map", pid);
+    char* filename = OS::SCreate(nullptr, "@TERMUX_PREFIX@/tmp/perf-%" Pd ".map", pid);
     out_file_ = (*file_open)(filename, true);
     free(filename);
   }
