[android-developers] Re: ant and eclipse builds don't play nice
The recommended way to do this in Eclipse is to have a separate project which contains all your test code. If you add the main project to the test project's class path, you can still access all of the main project's classes from your test classes. Plus, if you run your tests using the Eclipse Android JUnit configurations, Eclipse will recognize that the main and test projects are linked, and compile and install both projects on the target device. Regards, Brett. On Sat, Jul 18, 2009 at 8:12 PM, MrSqueezlesmrsqueez...@gmail.com wrote: I know I'm resurrecting an old thread, but I'm having the same problem. I don't know anyone that uses the same type of build for development, testing and release. I usually develop in Eclipse and have Ant targets that build a project for release without test cases, resources and libraries. If I don't build from Ant, how can I be sure that my release APK doesn't include my test instrumentation and extra garbage? Thank you, Connor On May 26, 11:36 pm, Raphael r...@android.com wrote: On Tue, May 26, 2009 at 6:26 PM, Craig supkic...@gmail.com wrote: On May 26, 9:49 pm, Zero zeroo...@googlemail.com wrote: from my experience, eclipse never used the build.xml for it's internal builds - how did you do that ? The eclipse build doesn't use build.xml at all, but due to the fact that build.xml is in the eclipse project (because it is in the same directory as AndroidManifest.xml) eclipse tries to build it or at least parse it and check for errors. build.xml can't be parsed by eclipse (even though it is a valid file according to ant) and thus the android builder refuses to launch the project at all. This seems wrong to me. No it doesn't do that. Would you have the Ant view open by any chance? Don't build from the ant view if you build using Eclipse. R/ --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ant and eclipse builds don't play nice
I know I'm resurrecting an old thread, but I'm having the same problem. I don't know anyone that uses the same type of build for development, testing and release. I usually develop in Eclipse and have Ant targets that build a project for release without test cases, resources and libraries. If I don't build from Ant, how can I be sure that my release APK doesn't include my test instrumentation and extra garbage? Thank you, Connor On May 26, 11:36 pm, Raphael r...@android.com wrote: On Tue, May 26, 2009 at 6:26 PM, Craig supkic...@gmail.com wrote: On May 26, 9:49 pm, Zero zeroo...@googlemail.com wrote: from my experience, eclipse never used the build.xml for it's internal builds - how did you do that ? The eclipse build doesn't use build.xml at all, but due to the fact that build.xml is in the eclipse project (because it is in the same directory as AndroidManifest.xml) eclipse tries to build it or at least parse it and check for errors. build.xml can't be parsed by eclipse (even though it is a valid file according to ant) and thus the android builder refuses to launch the project at all. This seems wrong to me. No it doesn't do that. Would you have the Ant view open by any chance? Don't build from the ant view if you build using Eclipse. R/ --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ant and eclipse builds don't play nice
On Wed, May 27, 2009 at 2:36 PM, Raphael r...@android.com wrote: On Tue, May 26, 2009 at 6:26 PM, Craig supkic...@gmail.com wrote: On May 26, 9:49 pm, Zero zeroo...@googlemail.com wrote: from my experience, eclipse never used the build.xml for it's internal builds - how did you do that ? The eclipse build doesn't use build.xml at all, but due to the fact that build.xml is in the eclipse project (because it is in the same directory as AndroidManifest.xml) eclipse tries to build it or at least parse it and check for errors. build.xml can't be parsed by eclipse (even though it is a valid file according to ant) and thus the android builder refuses to launch the project at all. This seems wrong to me. No it doesn't do that. Would you have the Ant view open by any chance? Don't build from the ant view if you build using Eclipse. Hey Raph, To be clear, I'm not trying to build using ant from within eclipse. I use ant to do customised builds from the command line. All every-day builds are done from eclipse using F11-Debug As-Android Application. I simply want the two different build methods to ignore each other. I have a clean install of ganymede EE 3.4.2, the latest DDMS, no ant views open, and a cleaned android project. If I rename build.xml to build.txt and refresh the project, the error goes away, and I can launch and debug the project. If I rename it back to build.xml and refresh the project, the errors aren't detected, and I can launch and debug If I open build.xml with the ant editor (because I want to edit it :), the error is detected, and I can no longer launch and debug, even if I close everything and refresh. If I open build.xml with the xml editor, the error is not detected...so I guess I just found my own work-around. Never open the ant editor. Still seems like a bug to me. cheers, Craig --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ant and eclipse builds don't play nice
That's kind of an unexpected workflow. The idea is that either you go the full way in Eclipse or you use Ant/DDMS. Trying to combine both is a recipe for confusion :-) What you can try: - use Ant to compile - use the ant install or reinstall target to push the apk - launch app manually - you can still debug by manually selecting the app in Eclipse DDMS perspective and applying the debug icon on it. - make sure you have automatic build disabled in Eclipse If you don't want to launch the app manually you can make an ant target by using the adb shell am start launch command. It goes something like this (from memory): $ adb shell am start -D com.blah.myapp/com.blah.myapp.MyMainActivity (run am without args to see the help) HTH R/ On Tue, May 26, 2009 at 11:02 PM, Craig supkic...@gmail.com wrote: On Wed, May 27, 2009 at 2:36 PM, Raphael r...@android.com wrote: On Tue, May 26, 2009 at 6:26 PM, Craig supkic...@gmail.com wrote: On May 26, 9:49 pm, Zero zeroo...@googlemail.com wrote: from my experience, eclipse never used the build.xml for it's internal builds - how did you do that ? The eclipse build doesn't use build.xml at all, but due to the fact that build.xml is in the eclipse project (because it is in the same directory as AndroidManifest.xml) eclipse tries to build it or at least parse it and check for errors. build.xml can't be parsed by eclipse (even though it is a valid file according to ant) and thus the android builder refuses to launch the project at all. This seems wrong to me. No it doesn't do that. Would you have the Ant view open by any chance? Don't build from the ant view if you build using Eclipse. Hey Raph, To be clear, I'm not trying to build using ant from within eclipse. I use ant to do customised builds from the command line. All every-day builds are done from eclipse using F11-Debug As-Android Application. I simply want the two different build methods to ignore each other. I have a clean install of ganymede EE 3.4.2, the latest DDMS, no ant views open, and a cleaned android project. If I rename build.xml to build.txt and refresh the project, the error goes away, and I can launch and debug the project. If I rename it back to build.xml and refresh the project, the errors aren't detected, and I can launch and debug If I open build.xml with the ant editor (because I want to edit it :), the error is detected, and I can no longer launch and debug, even if I close everything and refresh. If I open build.xml with the xml editor, the error is not detected...so I guess I just found my own work-around. Never open the ant editor. Still seems like a bug to me. cheers, Craig --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ant and eclipse builds don't play nice
from my experience, eclipse never used the build.xml for it's internal builds - how did you do that ? you can omit the android_rules file if you paste the needed targets into your build file (or if you had them working in an older version) then afaik just a few additions are needed (see below) quoted from our developer list !-- 1.5 Changes START -- !-- Custom Android task to deal with the project target, and import the proper rules. This requires ant 1.6.0 or above. -- path id=android.antlibs pathelement path=${sdk-location}/tools/lib/anttasks.jar / pathelement path=${sdk-location}/tools/lib/sdklib.jar / pathelement path=${sdk-location}/tools/lib/ androidprefs.jar / pathelement path=${sdk-location}/tools/lib/apkbuilder.jar / pathelement path=${sdk-location}/tools/lib/jarutils.jar / /path !-- 1.5 Changes END -- !-- 1.5 Changes START -- taskdef name=setup classname=com.android.ant.SetupTask classpathref=android.antlibs/ setup import=false / taskdef name=aaptexec classname=com.android.ant.AaptExecLoopTask classpathref=android.antlibs/ taskdef name=apkbuilder classname=com.android.ant.ApkBuilderTask classpathref=android.antlibs/ !-- 1.5 Changes END -- add one line to build.properties #new prop needed for 1.5 sdk-location=\\your\\android-sdk--1.5_r1\\path hope this helps cheers, zero openintents.org On May 26, 3:06 am, Craig supkic...@gmail.com wrote: Hi, I use ant to do release builds, and eclipse to do all my debug builds. With the new 1.5 sdk, my build.xml overides the resource-src target in order to perform some additional tasks, and it then depends on android_rules.resource-src to get the proper toolchain behaviour: e.g. ... setup / target name=resource-src depends=my-own-target, android_rules.resource-src / ... This works well for ant, but eclipse doesn't seem to know where android_rules comes from (not surprising since it is dynamically imported via code), and thus says there is an error in the file. This in turn stops the entire android project from building. So I need to either somehow get eclipse to parse the build.xml properly, or better still, get eclipse to ignore the build.xml altogether since build.xml takes no part in the eclipse build. Any ideas? thanks, Craig --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ant and eclipse builds don't play nice
On May 26, 9:49 pm, Zero zeroo...@googlemail.com wrote: from my experience, eclipse never used the build.xml for it's internal builds - how did you do that ? The eclipse build doesn't use build.xml at all, but due to the fact that build.xml is in the eclipse project (because it is in the same directory as AndroidManifest.xml) eclipse tries to build it or at least parse it and check for errors. build.xml can't be parsed by eclipse (even though it is a valid file according to ant) and thus the android builder refuses to launch the project at all. This seems wrong to me. you can omit the android_rules file if you paste the needed targets into your build file (or if you had them working in an older version) then afaik just a few additions are needed (see below) Yes, thankyou, this is a possible work-around. But I thought I would Do the Right Thing and not duplicate code. According to the ant manual, any imported targets (which is what the android_rules targets are after calling the setup / task) may be overridden. This works perfectly for my ant builds. So the question remains; how do I get the eclipse android plugin to ignore my build.xml file? --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: ant and eclipse builds don't play nice
On Tue, May 26, 2009 at 6:26 PM, Craig supkic...@gmail.com wrote: On May 26, 9:49 pm, Zero zeroo...@googlemail.com wrote: from my experience, eclipse never used the build.xml for it's internal builds - how did you do that ? The eclipse build doesn't use build.xml at all, but due to the fact that build.xml is in the eclipse project (because it is in the same directory as AndroidManifest.xml) eclipse tries to build it or at least parse it and check for errors. build.xml can't be parsed by eclipse (even though it is a valid file according to ant) and thus the android builder refuses to launch the project at all. This seems wrong to me. No it doesn't do that. Would you have the Ant view open by any chance? Don't build from the ant view if you build using Eclipse. R/ --~--~-~--~~~---~--~~ 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-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---