Error with NetBeans Android plugin

2019-07-06 08:41发布

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 !!

2条回答
啃猪蹄的小仙女
2楼-- · 2019-07-06 09:28

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.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-07-06 09:30

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.

查看更多
登录 后发表回答