Error building Android Library project using Python in Eclipse
Question: I'm trying to build this library project <https://crosswalk-project.org>.

I wish to implement the XWalkView in my application to use WebRTC.

I followed the following steps:

  1. Downloaded the stable ARM release
  2. Extracted the core library archive (It is an Android project by default)
  3. I imported the project into Eclipse
  4. The Python script "prepare_r_java.py" is responsible for creating R.java files required for the project, without which the library won't complie.
  5. When I try to build, I get the following error in Eclipse
    
        Errors occurred during the build.
    Errors running builder 'Integrated External Tool Builder' on project'xwalk_core_library'.
    Exception occurred executing command line.
    Cannot run program "C:\Users\abc\Desktop\crosswalk-3.32.53.4-x86\xwalk_core_library\prepare_r_java.py" 
    (in directory "C:\Users\abc\Desktop\crosswalk-3.32.53.4-x86\xwalk_core_library"): CreateProcess error=193, %1 is not a valid Win32 application
    Exception occurred executing command line.
    Cannot run program "C:\Users\abc\Desktop\crosswalk-3.32.53.4-x86\xwalk_core_library\prepare_r_java.py" 
    (in directory "C:\Users\abc\Desktop\crosswalk-3.32.53.4-x86\xwalk_core_library"): CreateProcess error=193, %1 is not a valid Win32 application
    

I have Python, ANT, Java installed and the PATH variable set and working fine.

What am I missing? Is there any other method to implement WebRTC in an Android
WebView (Non-native code)?


Answer: I downloaded the ARM build just now and encountered the same error while
importing the `xwalk_core_library` into eclipse. I fixed it by executing the
`prepare_r_java.py` script externally through python and importing the
generated `R.java` file in classes where it was referenced.

Also, after looking around, I found that the issue that you've mentioned is
actually a bug. [check it here](https://crosswalk-
project.org/jira/si/jira.issueviews%3aissue-html/XWALK-1036/XWALK-1036.html).

    
    
    Turning off 'Build Automatically' in eclipse fixes it.
    

* * *

**EDIT** : The above method still threw the error while exporting the apk file
and thus failed the export process.

In order to get the whole thing to compile and work without the nag, Here's
what I did before importing the `xwalk_core_library` into eclipse.

  1. Delete `.externalToolBuilders`folder.

  2. Edit `.project` file and delete the following lines from line no.18 to 27
    
             <buildCommand>
            <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
            <triggers>auto,full,incremental,</triggers>
            <arguments>
                <dictionary>
                    <key>LaunchConfigHandle</key>
                    <value>&lt;project&gt;/.externalToolBuilders/prepare_r_java.launch</value>
                </dictionary>
            </arguments>
        </buildCommand>
    

  3. Edit `build.xml` and delete the following line from line no.27
    
           <import file="precompile.xml" />
    

  4. Delete `precompile.xml` and `prepare_r_java.py`

Now import the library into eclipse. :)

