Issue Details (XML | Word | Printable)

Key: NBANDROID-3
Type: Bug Bug
Status: Resolved Resolved
Resolution: Duplicate
Priority: Major Major
Assignee: Martin_Adamek
Reporter: Martin_Adamek
Votes: 3
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
nbandroid

Cannot run an application on Windows

Created: 07/Jan/09 08:34 PM   Updated: 04/Jul/09 03:25 AM   Resolved: 04/Jul/09 03:25 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 0.5

Time Tracking:
Not Specified

File Attachments: 1. XML File build-impl.xsl (69 kB) 24/Jan/09 02:21 AM - jozart

Issue Links:
Duplicate
 

Tags:


 Description  « Hide

Description From radim@kenai.com 2008-11-24 07:55:22

Version: 0.1 Source: nbadroid
NB6.5, Win Vista

After various trials and errors I get my android app into state when it
compiles (by adding -pre-compile hook into build.xml) and nbadroid launches
(running some app in emulator from eclipse that probably does some
bootstraping) the emulator but then it fails with

-sign:
Current OS is Windows Vista
Executing 'C:\Users\radim\android-sdk-windows-1.0_r1\tools\apkbuilder.bat' with
arguments:
'dist/AndroidApplication1.apk'
'-z'
'dist/AndroidApplication1.apk_'
The ' characters around the executable and arguments are
not part of the command.
Failed to create 'dist/AndroidApplication1.apk' : The system cannot find the
path specified
C:\Users\radim\Documents\NetBeansProjects\AndroidApplication1\nbproject\build-impl.xml:465:
exec returned: 1
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:636)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:662)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:487)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at
org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:273)
at
org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:499)
at
org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
BUILD FAILED (total time: 15 minutes 38 seconds)

The good news is that this can be fixed by using absolute path in exec task
inside "-sign" target:

<target depends="init" name="-sign">
<exec executable="${apkbuilder}" failonerror="true">
<arg file="${dist.apk}"/>
<arg value="-z"/>
<arg file="${dist.apk}_"/>
</exec>
</target>



Martin_Adamek added a comment - 07/Jan/09 08:35 PM

Comment #1 From afrank@kenai.com 2008-11-29 05:15:47 -------

The absolute path can be generated by adding the ${basedir}:

<exec executable="${apkbuilder}" failonerror="true">
<arg value="${basedir}/${dist.apk}"/>
<arg value="-z"/>
<arg value="${basedir}/${dist.apk}_"/>
</exec>


jozart added a comment - 24/Jan/09 02:20 AM

Even better: use <arg file=.../> instead of <arg value=.../> as the reporter indicated.

<exec executable="${apkbuilder}" failonerror="true">
<arg file="${dist.apk}"/>
<arg value="-z"/>
<arg file="${dist.apk}_"/>
</exec>

The file attribute is generally preferable to the value attribute when the value is a file path.

I will attach an updated build-impl.xsl.


jozart added a comment - 24/Jan/09 02:21 AM

<exec executable="${apkbuilder}" failonerror="true">
<arg file="${dist.apk}"/>
<arg value="-z"/>
<arg file="${dist.apk}_"/>
</exec>


JD23 added a comment - 09/Jun/09 06:43 PM - edited

To summarize:

1. 'build-impl.xsl' is located within the Mercurial source tree at:

mbandroid~mercurial\projects\src\org\netbeans\modules\android\project\resources\build-impl.xsl

2. jozart's fix above works great on Vista using NetBeans 6.5.1 where 'value' is replaced with 'file':

jozart's Fix for build-impl.xsl in the source tree

<exec executable="${apkbuilder}" failonerror="true">
<arg file="${dist.apk}"/>
<arg value="-z"/>
<arg file="${dist.apk}_"/>
</exec>

??(Note: The text in red indicates the changes needed.)??

3. I just checked and this change hasn't been made yet with revision 38. This is a low hanging fruit that would make working with NetBeans 6.5.1 and the Android SDK 1.1r1 work out of the box.

Can someone commit this easy fix? Thanks!


radim added a comment - 04/Jul/09 03:25 AM

To JD23: I actually prepended ${basedir}. Maybe I'll switch to your fix that looks cleaner. Sorry that it didn't get in sooner. I prefer Linux.