On my previous post, I reviewed the new blackberry Netbeans Plugin. Latre I found Shai also published his post about how to use the new plugin in developing the LWUIT blackberry application.
But I found the new plugin could not debug the blackberry application.
Reason
The reason is if you want to debug your blackberry application, you have to copy all the .debug files into the blackberry simulator folder, include xxx.debug, xxx-1.debug, xxx-2.debug, ... etc. From the generated build-impl.xml script file, we know that blackberry plugin only copied the xxx.debug file and missing all other debug files.
Solution
Add the following targets in the build.xml, which will override the same target in the build-impl.xml:
1. Update target blackberry-pre-debug, it will copy all the debug files into the simulator folder.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<target name="blackberry-pre-debug" depends="blackberry-load-setings" if="blackberry.trigger"> | |
<copy todir="${platform.home}/simulator"> | |
<fileset dir="${dist.dir}" includes="${name}.*"/> | |
<fileset dir="${dist.dir}" includes="*.debug"/> | |
</copy> | |
<condition property="jpda.port" value="${JDWPPort}" else="8000"> | |
<isset property="JDWPPort"/> | |
</condition> | |
</target> |
2. Update target clean-blackberry, it will delete all the files of the application in the simulator folder.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<target name="clean-blackberry" if="blackberry.trigger"> | |
<delete file="${dist.dir}/${name}.cod" failonerror="false"/> | |
<delete file="${dist.dir}/${name}.cso" failonerror="false"/> | |
<delete file="${dist.dir}/${name}*.debug" failonerror="false"/> | |
<delete failonerror="false"> | |
<fileset dir="${platform.home}/simulator"> | |
<include name="**/${name}*.*"/> | |
</fileset> | |
</delete> | |
</target> |
3. If you want to build BlackBerry CLDC application, you need to add the target create-cod:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<target name="create-cod" if="blackberry.trigger"> | |
<exec dir="${dist.dir}" executable="java" failonerror="true"> | |
<arg value="-cp"/> | |
<arg value="${platform.home}/bin/rapc.jar"/> | |
<arg value="net.rim.tools.compiler.Compiler"/> | |
<arg value="import=${platform.bootclasspath}"/> | |
<arg value="codename=${name}"/> | |
<arg value="-cldc"/> | |
<arg value="jad=${basedir}/${dist.dir}/${dist.jad}"/> | |
<arg value="${basedir}/${dist.dir}/${dist.jar}"/> | |
</exec> | |
<property file="${dist.dir}/${dist.jad}"/> | |
<echo file="${basedir}/${dist.dir}/${name}.alx"> | |
<loader version="1.0"> | |
<application id="${name}"> | |
<name> | |
${MIDlet-Name} | |
</name> | |
<description> | |
${MIDlet-Description} | |
</description> | |
<version> | |
${MIDlet-Version} | |
</version> | |
<vendor> | |
${MIDlet-Vendor} | |
</vendor> | |
<copyright> | |
${MIDlet-Copyright} | |
</copyright> | |
<fileset Java="1.0"> | |
<directory/> | |
<files>${name}.cod</files> | |
</fileset> | |
</application> | |
</loader> | |
</echo> | |
</target> |
The only difference with build MIDlet application is in <arg value="-cldc"/>, by default, the Blackberry plugin already choose MIDlet by using <arg value="-midlet"/>.
Thanks a lot for enjoying this beauty blog with me. I am enjoy it very much! Looking forward to another great blog. Good luck to the author! all the best!
ReplyDeleteCustomized Blackberry Apps Development
Thanks, perfect!
ReplyDeleteWhat a resource you are.
ReplyDeleteThanks for sharing, I will bookmark and be back again
ReplyDeleteBlackberry Development
I read some of your post and I learned a lot of knowledge from it. Thanks for posting such interesting blog.
DeleteThanks for sharing this information.
ReplyDeleteThis is a good post. I'm definitely going to look into it.Really very useful tips are provided here.thank you so much.Keep up the good works.
ReplyDeleteI would like to thank you for the efforts you have made in sharing this. I am hoping the same best work from you in the future.
ReplyDeleteWebsite Development