Saturday, May 1, 2010

Re: [android-developers] Re: Android ANT compilation

Thank you for the well thought out response, I got some good tips out of it.

1) I just can't agree with this one and apparently Sun doesn't either as
they added the preprocessor support. The thing is that for a j2se
project you could use interfaces and other run-time solutions and throw
more hardware at it. For a phone you are already hardware limited and
don't want to pay for anything at run-time that can be determined at
compile time.

2) Great. I will have to invest more time looking into this.

3) Score again. This wasn't an editing outside of Eclipse problem. The
problem is with two Eclipse projects sharing some common code. I edit it
in one project and the other one doesn't get refreshed even if it's
opened in the same workspace. So thanks for the tip as this will help.
Still I wish I could put all my code in one tree and make a BlackBerry
project and Android project that just filters parts of the code. I
looked into this was unable to grok the help/examples for this.

4) I never even considered that a project could be outside of a
workspace. Cool. I will try that. It's all the .metadata stuff that I
was at odds with. So it's per user config and nothing to do with the
project?

Being an ex Emacs user that decided to just start using what everyone
else uses, I am very open to Eclipse but it's been a hard one to swallow
:) Thanks for some good tips to make it more palatable

Leigh

On 5/1/2010 12:40 AM, Bob Kerns wrote:
> Sigh, Google Groups just silently trashed my pending reply... I'll try
> to recreate.
>
> 1) Millions of portable Java applications have been created without
> the use of preprocessors. In my experience, when preprocessors have
> seemed necessary (including in my own cases), there has always turned
> out to be a better way -- reflection, a compatibility layer, careful
> modularity, and other techniques generally end up eventually replacing
> the preprocessing, with a more maintainable result. While
> preprocessing does have a few advantages, it comes with a lot of
> negatives as well. Even code generation is generally preferable.
>
> But I'm not trying to convince you to abandon NetBeans if you feel its
> advantages for you (including familiarity and comfort) outweigh the
> lack of Android integration. (Or if you want to integrate that support
> into NetBeans; it shouldn't be all that hard).
>
> 2) I haven't used NetBeans seriously in many years, so I won't try to
> compare the ant integrations. I'll just note that it's pretty
> straightforward to integrate an ant build step into Eclipse. Of
> course, the base Eclipse build step is NOT ant-based, so you have to
> replicate that functionality in a standalone build. The 'anddroid'
> tool will set that up for you, however.
>
> Eclipse integrates pretty well with ant, from it's ant editor to
> integrating ant build steps into the build process, to invoking ant
> scripts as external tools. My gripe with it is having two different
> build mechanisms is a bad thing, but in practice, that's a manageable
> problem. (Building Eclipse applications and plugins, on the other
> hand, introduces another build process, which generates temporary ant
> scripts, which are then deleted, making everything very difficult)
>
> 3) I think you're referring to what happens by default when you edit
> source files outside Eclipse? If you insist on doing this, then you
> should insist that Eclipse refresh files automatically. If you turn
> that feature on, your F5 monkey will be out of work. (But if Eclipse
> screws up, there are times that doing Refresh is part of the recovery
> procedure). You pay a small performance cost on large projects, which
> is why it's not on by default.
>
> 4) I don't understand this one. Eclipse has .project and .classpath.
> It also has a .settings directory with various per-project settings
> (which may be defined by plugins, but that doesn't concern you). Check
> them all in. Do not check in the output directories -- 'bin' and 'gen'
> in an Android project. If you define shared launchers -- check those
> in, too -- no point in making them shared, otherwise.
>
> Perhaps you're confusing the projects with the workspace? I don't even
> recommend putting your project directories into the workspace
> directory, but putting them into a source-controlled directory, and
> importing just the ones you want from there. Then simply don't check
> in the workspace directory at all; it's purely a developer
> configuration thing.
>
> But if you set up your workspace to be the same as your revision-
> controlled directory root, just don't check in the .metadata
> directory, or the .myelin directory if you have one.
>
> If you're comfortable and productive in NetBeans, great! I think
> Eclipse left NetBeans behind a while back, and certainly it supports a
> lot more integrations. But the debugger should work fine with Android,
> once you figure out how to connect it to the device or emulator. If
> you do find yourself needing to move to Eclipse, or just to interface
> to people who are using Eclipse, I hope the above helps.
>
> On Apr 30, 2:34 pm, Leigh McRae<leigh.mc...@lonedwarfgames.com>
> wrote:
>
>> 1) NetBeans has native preprocessor support with build targets like
>> VisualC. I really think this is a must when targeting multiple devices
>> and platforms. Right now I am porting a project from BlackBerry to
>> Android and the lack of a preprocessor is really a drag. There is
>> Antenna but NetBeans understands it's own preprocessor and doesn't give
>> false feedback.
>>
>> 2) Ant is really well integrated with the IDE. I am able to make my own
>> ant tasks that do very specific releases for me. I would agree that
>> production builds are not well suited with a default Eclipse project but
>> I think NetBeans is.
>>
>> 3) NetBeans handles source files much better. It doesn't force a work
>> flow on you. I also hate how Eclipse cache files. I need a little
>> monkey just to hit F5 for me from time to time.
>>
>> 4) Eclipse doesn't have a well defined set of files that represent a
>> project IMHO. Instead it has a directory littered with god knows what
>> from each plugin. Does anyone know which file to check in? NetBeans
>> has a couple of XML files in a directory.
>>
>> Leigh
>>
>> On 4/30/2010 4:09 PM, Bob Kerns wrote:
>>
>>
>>
>>
>>> I debug with Eclipse. You should be able to use any Java debugger, but
>>> there are none that come close to Eclipse, and the SDK provides all
>>> this nice Eclipse integration you won't get anywhere else.
>>>
>>
>>> Why do you want to leave Eclipse behind? I mean, besides the inherent
>>> shortcomings of using an IDE to do production builds.
>>>
>>
>>> On Apr 30, 6:56 am, Leigh McRae<leigh.mc...@lonedwarfgames.com>
>>> wrote:
>>>
>>
>>>> What do you debug with? I would love to leave Eclipse behind.
>>>>
>>
>>>> Leigh
>>>>
>>
>>>> On 4/30/2010 3:37 AM, Bob Kerns wrote:
>>>>
>>
>>>>> I didn't even>>mention<< Eclipse. Use the android tool to set up your
>>>>> ant project -- it knows how to set up for the android Ant tasks.
>>>>>
>>
>>>>> They will, of course, need the SDK, but they will NOT need Eclipse. I
>>>>> do not build (nor do I recommend building) my product for distribution
>>>>> with Eclipse.
>>>>>
>>
>>>>> On Apr 25, 9:48 pm, veradis tech<veradism...@gmail.com> wrote:
>>>>>
>>
>>>>>> Thanks Bob Kerns.
>>>>>> My aim is to make the code available for all. I will move the source to SVN,
>>>>>> and anyone can download/update it and compile it using ANT. I don't want to
>>>>>> use eclipse for this.
>>>>>>
>>
>>>>>> Thanks
>>>>>> Veradis
>>>>>>
>>
>>>>>> On Sat, Apr 24, 2010 at 9:12 PM, Bob Kerns<r...@acm.org> wrote:
>>>>>>
>>
>>>>>>> Your build.xml doesn't look anything at all like what's generated by
>>>>>>> the 'android' tool. It looks like you've undergone a major manual
>>>>>>> effort, instead.
>>>>>>>
>>
>>>>>>> Why not just use the android tool to set up your project?
>>>>>>>
>>
>>>>>>> http://developer.android.com/intl/de/guide/developing/other-ide.html
>>>>>>>
>>
>>>>>>> You can create a blank project, and edit the build.xml and such if you
>>>>>>> want.
>>>>>>>
>>
>>>>>>> As far as I know, the android tool is the only thing that knows what
>>>>>>> the requirements are for the various android ant tasks. I suspect one
>>>>>>> requirement is that sdk.dir be set to point to the sdk.
>>>>>>>
>>
>>>>>>> On Apr 24, 12:57 am, veradis<veradism...@gmail.com> wrote:
>>>>>>>
>>
>>>>>>>> Hi,
>>>>>>>>
>>
>>>>>>>> I want to compile my Android APP using ANT in windows. I placed
>>>>>>>> build.xml in project root and included necessary jars in project lib
>>>>>>>> folder. I had made proper configurations for ant also, but its not
>>>>>>>> working. Please help me on this.
>>>>>>>>
>>
>>>>>>>> Error
>>>>>>>> ====
>>>>>>>>
>>
>>>>>>>> C:\Documents and Settings\nav\workspace\YumFlixMobile>ant
>>>>>>>> Buildfile: C:\Documents and Settings\nav\workspace\YumFlixMobile
>>>>>>>> \build.xml
>>>>>>>>
>>
>>>>>>>> clean:
>>>>>>>>
>>
>>>>>>>> resource-src:
>>>>>>>>
>>
>>>>>>>> BUILD FAILED
>>>>>>>> C:\Documents and Settings\nav\workspace\YumFlixMobile\build.xml:33:
>>>>>>>> java.lang.Nu
>>>>>>>> llPointerException
>>>>>>>> at
>>>>>>>> com.googlecode.androidant.AndroidTools.locateTool(AndroidTools.java:8
>>>>>>>> 1)
>>>>>>>> at
>>>>>>>> com.googlecode.androidant.AndroidTools.startTool(AndroidTools.java:74
>>>>>>>> )
>>>>>>>> at
>>>>>>>> com.googlecode.androidant.AndroidTools.startTool(AndroidTools.java:62
>>>>>>>> )
>>>>>>>> at
>>>>>>>> com.googlecode.androidant.WindowsAndroidTools.aapt(WindowsAndroidTool
>>>>>>>> s.java:36)
>>>>>>>> at aapt.main(aapt.java:7)
>>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>>> at
>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
>>>>>>>> java:39)
>>>>>>>> at
>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
>>>>>>>> sorImpl.java:25)
>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>> at
>>>>>>>> org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
>>>>>>>> at
>>>>>>>> org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:15
>>>>>>>> 2)
>>>>>>>> at org.apache.tools.ant.taskdefs.Java.run(Java.java:771)
>>>>>>>> at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:
>>>>>>>> 221)
>>>>>>>> at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:
>>>>>>>> 135)
>>>>>>>> at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
>>>>>>>> at
>>>>>>>> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
>>>>>>>> at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
>>>>>>>> at
>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
>>>>>>>> sorImpl.java:25)
>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>> at
>>>>>>>> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
>>>>>>>> a:106)
>>>>>>>> at org.apache.tools.ant.Task.perform(Task.java:348)
>>>>>>>> at
>>>>>>>> org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
>>>>>>>> at
>>>>>>>> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
>>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>>> at
>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
>>>>>>>> java:39)
>>>>>>>> at
>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
>>>>>>>> sorImpl.java:25)
>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>> at
>>>>>>>> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
>>>>>>>> a:106)
>>>>>>>> at org.apache.tools.ant.Task.perform(Task.java:348)
>>>>>>>> at
>>>>>>>> org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.jav
>>>>>>>> a:398)
>>>>>>>> at
>>>>>>>> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
>>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>>> at
>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
>>>>>>>> java:39)
>>>>>>>> at
>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
>>>>>>>> sorImpl.java:25)
>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>> at
>>>>>>>> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
>>>>>>>> a:106)
>>>>>>>> at org.apache.tools.ant.Task.perform(Task.java:348)
>>>>>>>> at org.apache.tools.ant.Target.execute(Target.java:390)
>>>>>>>> at org.apache.tools.ant.Target.performTasks(Target.java:411)
>>>>>>>> at
>>>>>>>> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1360)
>>>>>>>> at org.apache.tools.ant.Project.executeTarget(Project.java:
>>>>>>>> 1329)
>>>>>>>> at
>>>>>>>> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
>>>>>>>> cutor.java:41)
>>>>>>>> at org.apache.tools.ant.Project.executeTargets(Project.java:
>>>>>>>> 1212)
>>>>>>>> at org.apache.tools.ant.Main.runBuild(Main.java:801)
>>>>>>>> at org.apache.tools.ant.Main.startAnt(Main.java:218)
>>>>>>>> at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
>>>>>>>> at org.apache.tools.ant.launch.Launcher.main(Launcher.java:
>>>>>>>> 109)
>>>>>>>>
>>
>>>>>>>> Total time: 1 second
>>>>>>>>
>>
>>>>>>>> =====================================================================
>>>>>>>>
>>
>>>>>>>> build.xml
>>>>>>>> =======
>>>>>>>>
>>
>>>>>>>> <?xml version="1.0" encoding="utf-8"?>
>>>>>>>> <project name="YumFlixMobile" default="precommit"
>>>>>>>> xmlns:android="antlib:com.googlecode.androidant">
>>>>>>>>
>>
>>>>>>>> <!-- Requires ant 1.7 or better -->
>>>>>>>>
>>
>>>>>>>> <property environment="env"/>
>>>>>>>> <condition property="android-home" value="$
>>>>>>>> {env.ANDROID_HOME}">
>>>>>>>> <isset property="env.ANDROID_HOME"/>
>>>>>>>> </condition>
>>>>>>>>
>>
>>>>>>>> <property name="android-ant.jar" location="lib/android-
>>>>>>>> ant.jar"/>
>>>>>>>> <taskdef uri="antlib:com.googlecode.androidant"
>>>>>>>> resource="com/googlecode/androidant/antlib.xml"
>>>>>>>> classpath="${android-ant.jar}"/>
>>>>>>>>
>>
>>>>>>>> <!-- Dependencies -->
>>>>>>>>
>>
>>>>>>>> <fileset dir="lib" id="main.jars">
>>>>>>>> <include name="positron.jar"/>
>>>>>>>> </fileset>...
>>>>>>>>
>> read more »
>>
>

--
Leigh McRae
www.lonedwarfgames.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment