问题
I am currently developing an Android app and i am using Netbeans 6.9.1 and nbandroid 1.0 beta. I have installed Android SDK and configured everything but when i create a simple project and try to build it gives an error
Creating output directories if needed...
Created dir: C:\Documents and Settings\KeSoLK\My Documents\NetBeansProjects\AndroidApplication2\bin
Created dir: C:\Documents and Settings\KeSoLK\My Documents\NetBeansProjects\AndroidApplication2\gen
Created dir: C:\Documents and Settings\KeSoLK\My Documents\NetBeansProjects\AndroidApplication2\bin\classes
Compiling aidl files into Java classes...
Compiling RenderScript files into Java classes and RenderScript bytecode...
Generating R.java / Manifest.java from the resources...
compile:
C:\Documents and Settings\KeSoLK\My Documents\Android\android-sdk-windows\tools\ant\main_rules.xml:384: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
Compiling 2 source files to C:\Documents and Settings\KeSoLK\My Documents\NetBeansProjects\AndroidApplication2\bin\classes
Converting compiled files and external libraries into C:\Documents and Settings\KeSoLK\My Documents\NetBeansProjects\AndroidApplication2\bin\classes.dex...
=C:\Documents was unexpected at this time.
C:\Documents and Settings\KeSoLK\My Documents\Android\android-sdk-windows\tools\ant\main_rules.xml:472: The following error occurred while executing this line:
C:\Documents and Settings\KeSoLK\My Documents\Android\android-sdk-windows\tools\ant\main_rules.xml:203: apply returned: 255
BUILD FAILED (total time: 1 second)
what can be the problem? and how to solve it.
Thanks !!
回答1:
Just encountered the same issue. It seems to be related to spaces in path at the time ant tries to start dex.bat with parameters:
<exec executable="${dx}" failonerror="true">
<arg value="--dex"/>
<arg value="--output=${basedir}/${intermediate.dex}"/>
<arg value="--positions=lines"/>
<arg path="${build.classes.dir}"/>
</exec>
The project won't run if ${basedir}
, ${intermediate.dex}
or ${build.classes.dir}
contain spaces.
Parameters for batch files have to be encapsulated with "...". But how to do this when ant starts the batch file?
My quick workaround was to move the folder of my netbeans android project (not all projects) to a path that doesn't contain spaces.
回答2:
Indeed it is a 'space in path' problem of Android SDK.
Other than that I'd strongly recommend you to update to newer version of both NetBeans and NBAndroid plugin.
来源:https://stackoverflow.com/questions/5152904/error-with-netbeans-android-plugin