aspose file tools*
The moose likes Android and the fly likes Debugging Android project using ant debug Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Debugging Android project using ant debug" Watch "Debugging Android project using ant debug" New topic
Author

Debugging Android project using ant debug

Astha Sharma
Ranch Hand

Joined: Oct 15, 2011
Posts: 249

I want to debug my Android project using ant debug. I am wondering where I can trace the build failure errors, where does it get displaced if there is any exception if I build project using ant debug? What is the way to trace build failure errors using this way?


Astha - OCPJP 6 (90%)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42292
    
  64
I'm not sure what you mean by "trace build failure errors", but if you run ant from the command line then that's where you will see all the messages, and all the errors. And if you run it in verbose mode, you'll get even more information.


Ping & DNS - my free Android networking tools app
Astha Sharma
Ranch Hand

Joined: Oct 15, 2011
Posts: 249

Hello Ulf Dittmer

Yes I'm running application using command line, but nothing is getting displayed there, no error or no other message. I want to trace the error when build gets failed during run time.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42292
    
  64
I'm confused. First you said something about "ant debug" - which is used to build the app. Now you mention running the app, and finally build ... during run time. Are you talking about build time or run time?

That ant would not print anything during an Android build is highly unusual. You're entering "ant debug", it builds the app fine, but nothing at all is displayed?
Astha Sharma
Ranch Hand

Joined: Oct 15, 2011
Posts: 249

Thanks for giving you time Dittmer. I'm trying it for the first time using command line, so have no idea about how errors get displayed in command line. You may get better idea of what I'm asking seeing this link.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42292
    
  64
That page is about the ADT Eclipse plugin. Where is the connection to using the Ant build from the command line?

(My name is Ulf, by the way. If you want to address me by my last name, then that's fine, but the polite way to do so is by prefixing it by "Mr.". But first name is cool :-) )
Astha Sharma
Ranch Hand

Joined: Oct 15, 2011
Posts: 249

Thanks ULF
My actual problem is that I'm getting java.lang.NoClassDefFoundError: R$layout after installing ADT and SDK updates. In the link I provided, it's written that running a manual ant build resulted in a very helpful build failure error. I am just wondering does 'running a manual ant build' means running project from command line? If it is so, where can I see 'build failure error' while doing so?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42292
    
  64
I am just wondering does 'running a manual ant build' means running project from command line?

Yes, by running "ant debug".

If it is so, where can I see 'build failure error' while doing so?

On the command line.
Astha Sharma
Ranch Hand

Joined: Oct 15, 2011
Posts: 249

On the command line.

But it is not getting displayed on command line. I'm working on mac. Is there any other way to display it on mac terminal?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42292
    
  64
The Mac Terminal *is* the command line. So that brings us back to my earlier question:
That ant would not print anything during an Android build is highly unusual. You're entering "ant debug", it builds the app fine, but nothing at all is displayed?

Astha Sharma
Ranch Hand

Joined: Oct 15, 2011
Posts: 249

When I enter "ant debug", it builds the app fine and displays whole build process with BUILD SUCCESSFUL message. It doesn't display any error. But when I run my application, it gets failed with NoClassDefFoundError error displaying in eclipse logs, showing that it's not getting the layout class in R.java. It displays-

java.lang.NoClassDefFoundError: R$layout

But doesn't display any message about this error in terminal. Neither at the time of build, nor at the time when I run the application.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42292
    
  64
If you build it on the command line, then you shouldn't try to run it in Eclipse - those are two entirely separate environments. Install the APK file that the Ant build creates in the emulator or in an actual device and run it there.
 
jQuery in Action, 2nd edition
 
subject: Debugging Android project using ant debug