Muzammil Hussnain
Muzammil Hussnain

Reputation: 103

ERROR: input directory 'Files' does not exist

need to build the R.java file from resource using the command line. I do this using the following Java program. I get the

ERROR: input directory 'Files' does not exist

here is my code can anyone help which file directory is missing. or why this error is popped up.

public static String ProjectPath = "C:\\Users\\Muzammil-Husnain\\testing\\Soothing-snow-fall";
public static String ANDROID_HOME = "C:\\\"Program Files (x86)\"\\Android\\android-sdk";

public static void generateRfile() {
    try {
        File projectDirectoryFile = new File(ProjectPath);
        String command = "aapt package -v -f -m "+
        " -S \""+projectDirectoryFile.getCanonicalPath()+"\\res\"" +
        " -J \""+projectDirectoryFile.getCanonicalPath()+"\\gen\"" +
        " -M \""+projectDirectoryFile.getCanonicalPath()+"\\AndroidManifest.xml\"" +
        " -I C:\\\"Program Files (x86)\"\\Android\\android-sdk\\platforms\\android-21\\android.jar\"";
        System.out.println("Directory Path : "+projectDirectoryFile.getCanonicalPath());
        System.out.println(command);
        ProcessBuilder processBuilder = new ProcessBuilder("cmd.exe", "/c", command);
        processBuilder.redirectErrorStream(true);
        Process process = processBuilder.start();
        BufferedReader r = new BufferedReader(new InputStreamReader(process.getInputStream()));
        String line;
        while (true) {
            line = r.readLine();
            if (line == null) {
                break;
            }
            System.out.println(line);
        }

    } catch (IOException ex) {
        Logger.getLogger(RunApplicationOnPrject.class.getName()).log(Level.SEVERE, null, ex);
    }
}

Here is The Directory

Upvotes: 2

Views: 3299

Answers (4)

yuliskov
yuliskov

Reputation: 1508

I've had same error but with apktool. Message states, that "ERROR: input directory 'ini' does not exist". Nothing helps, but suddenly I've found next lines in apk_dir/apktool.yml file:

doNotCompress:
- js
- ''
- ini
- dat
- cfg
- xml

After removing those lines error gone.

UPD: removing only line with quotes - '' solves problem

Upvotes: 1

Muzammil Hussnain
Muzammil Hussnain

Reputation: 103

I found Error

" -I C:\\\"Program Files (x86)\"\\Android\\android-sdk\\platforms\\android-21\\android.jar\"";

This Line was missing starting quote of the URL, while it contains ending quoteI fixed error by including quote like this:

" -I \"C:\\\"Program Files (x86)\"\\Android\\android-sdk\\platforms\\android-21\\android.jar\""

Thanks to @Prashant and @Laszlo Lugosi for your attention.

Upvotes: 5

Prashant
Prashant

Reputation: 2614

your error is because of

public static String ANDROID_HOME = "C:/Program Files (x86)/Android/android-sdk";

here space is present in Program Files (x86).

You can check accessing file having space in path

Upvotes: 3

Laszlo Lugosi
Laszlo Lugosi

Reputation: 3829

I think you need to use quote "" when there is SPACE in a directory name. Batch file assume Files as next parameter in Program Files.

Upvotes: 3

Related Questions