Error when an executable file is trying to output a file into internal storage in Android
<p>I'm trying to compile Arduino's .ino files in Android. So I am making use of avr-gcc, avr-g++, avr-objcopy executable(binary) files. These files produces certain files as output in a given location. I have used /data/local/tmp (/data/user/0/com.dtlabz.dreamkit/files/local/tmp/) directory in internal storage. But these executable files are not able to output the files. </p>

<p>Here is my code to execute the executable files:</p>

<pre><code>private void execCommand(List&lt;String&gt; comm) throws Exception {

    StringBuilder sb = new StringBuilder();
    for(String c : comm) {
        sb.append(c);
        sb.append(" ");
    }
    exec(sb.toString());
    try {

        Log.d(LOG,"Comm: "+comm);

        Process process = Runtime.getRuntime().exec(comm.toArray(new String[0]));

        MessageSiphon in = new MessageSiphon(process.getInputStream(), new MessageConsumer() {
            public void message(String s) {
                stdout(s);
            }
        });
        MessageSiphon err = new MessageSiphon(process.getErrorStream(), new MessageConsumer() {
            public void message(String s) {
                stderr(s);
                if(s.contains("error:")) {
                    Util.p("it's an error");
                    errorHappened = true;
                    errorString = s;
                }
            }
        });
        try {
            in.join();
            err.join();
            int result = process.waitFor();
            Log.d(LOG,"Result is: "+ result);
        } catch (Exception ex) {
            Log.e(LOG,"ExecCommand MsgSiphon Join Error: "+ex);
        }
        if(errorHappened) {
            throw new CompileException("compiler error",errorString);
        }


    } catch (IOException e) {
        Log.e(LOG,"Exec error: "+ e.getMessage());
    }
}
</code></pre>

<p>Here is the command. Like for example I'm giving the following command as comm:</p>

<blockquote>
  <p>/data/user/0/com.dtlabz.dreamkit/files/local/tmp/arduino_compiler_files/tools/avr/bin/avr-g++
  -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DARDUINO=101 -DUSB_VID= -DUSB_PID= -I/data/user/0/com.dtlabz.dreamkit/files/local/tmp/arduino_compiler_files/hardware/arduino/cores/arduino
  -I/data/user/0/com.dtlabz.dreamkit/files/local/tmp/arduino_compiler_files/hardware/arduino/variants/standard
  /data/user/0/com.dtlabz.dreamkit/files/local/tmp/arduino_compiler_files/hardware/arduino/cores/arduino/CDC.cpp
  -o /data/user/0/com.dtlabz.dreamkit/files/local/tmp/CDC.cpp.o</p>
</blockquote>

<p>This command should produce CDC.cpp.o file. But I'm getting the following error through process.GetErrorStream() in my above given code.</p>

<pre><code>Cannot create temporary file in ./: Read-only file system
</code></pre>

<p>Please Help.</p>