run button opens a new AVM - android

I have troubles compiling my code with eclipse. Each time I click the run button it opens a new AVM.
I am starting to get lost in here any hint or solution please?

The run button in eclipse is designed to launch your code, which has to be done either in the AVM or on hardware connected to your computer. If you are wanting to build the binary without executing you go to the project menu and select Build All. However, it is probably set by default to build automatically, which is also under the project menu. Effectively this means the code you are writing is being built "on the fly" and errors will appear dynamically as you write your code. Is this what you were asking?

Related

Unable to set breakpoints in Android Studio

I am working on Ubuntu 14.04, AndroidStudio is 1.2.1.1. I am able to build the app, click on the "Debug" icon and launch the app. I can see logcat output and I can pause the app from the debugger. The one thing I cannot do is set a break point. I tried clearing the cache, restarting AS, right clicking in the file where I want to set the break point. None of these produce the desired effect. This is a well-hidden feature.
I also had this same issue in Android Studio, where I couldn't set breakpoints. This is what I was doing wrong: I was clicking on a line that didn't have any code in it, or a line that contained a comment. As soon as I clicked on a line in method/class, it allowed me to set the breakpoint.
There shouldn't be any problems setting break points if you follow the process outlined here
If you are running into some issues, here are a few steps to get you started:
- Use a Log.d() in your app and see if it outputs to the logs. If it doesn't then you know you are not in debug mode.
- Are you debugging on the device or the emulator? If the device, you need to enable development. I would suggest to select "wait for debugger" to make sure it's attached before you run the code.
This should be pretty straightforward. Let me know what you find out.
To add a line breakpoint, proceed as follows:
Locate the line of code where you want to pause execution, then either click the left gutter along that line of code or place the caret on the line and press Control+F8 (on Mac, Command+F8).
If your app is already running, you don't need to update it to add the breakpoint—just click Attach debugger to Android proccess . Otherwise, start debugging by clicking Debug .

How do I see gradle tasks run by Android Studio?

I'm following the course "Developing Android Apps" on udacity.
I have a problem on Lesson4A with the test suite (TestUtilities) complaining "Task 'cleanTest' not found in root project 'Sunshine'.
And then it points me to run with --stacktrace option.
But I don't know how I can run the command on the terminal in the first place.
How can I see what gradle-tasks that android studio is running?
Thanks :)
At the bottom right corner of Android Studio you have different views:
Gradle console
Event Log
Additionally, if your Gradle is running, will appear a 3rd one where you can see a progress bar with some information about the process. But if you want a full details use the 2 first views.
I believe you have not do the configuration at first, as the default configuration is not appropriate for this project.
Select Edit Configurations next to Run button on toolbar
Make a testing configuration, by click the + button and select Android Test.
Make sure you choose "Show Chooser dialog" in target device section if you are using Virtual devise like Genymotion
Hit OK and press the run button.
PS. Make sure your have this configuration under Android Test, and nothing under JUnit dropdown.
I was confused at first, but not anymore after I tried above steps from Udacity notes.

run not responding for android in eclipse

I am updating an Android project, and for some reason the run button in eclipse does nothing. I can get the app to run if I go Run>>Run Configurations... and then start it from that, but if I just click the play button or if I use the hotkey for run (CTRL + F11 ) then nothing happens. It seems to make no difference if an emulator is already going or not.
Anyone have suggestions? I like to code by making small changes and then running the app to see what happened and its very frustrating to have to go through 3 clicks just to get it to run every time.
Thanks
Using default settings in Eclipse, the Run button and hotkey CTRL + F11 will not work when the xml editor is in focus. It should work if you are working with the Java editor. To use the button or hotkey while editing xml, first click on the project in the package explorer.
You can adjust this by going in to Eclipse Preferences and choosing Run/Debug and make it launch your last used Run Configuration. Then only for the first time you launch you will be required to right click your project and choose Run As -> Android Application. After doing this pressing Ctrl+F11 or the Run icon will always start that Run Configuration.

Android application problems in Eclipse

I'm a .NET developer but I like JAVA so in my free time I play around with that. I don't normally use Eclipse but I installed the ADT eclipse plugin and Andriod SDK and I started learning and I made a new project with a TableLayout and it kinda looks good, and it runs ok on the emulator.
However... there a few things that drive me absolutely catatonic and perhaps I am doing something wrong so please help me out.
Firstly, if I change the main.xml file in whatever way, even by adding what is supposedly a correct parameter, it will start freaking out and will generate an error that just says "error" without specifying what that is, it will then generate a main.out.xml and then report an error that the main.out.xml is empty. It later won't let me delete that and will start generating a main.out.out.xml and so forth, even after I correct that original xml that caused the error.
The only way to get things going is to delete the bin folder, restart Eclipse, delete all the out xml files and then sometimes it will run the application or some other times it will start generating those 'out' files again and the loop goes on.
That way it takes hours to run a simple app even one without errors that used to run before.
Surely that was NOT how they intended it to work, is it??
Also.. there is no "Rebuild" button that will flush all files out automatically, or is it hidden somewhere? I am tired of manually deleting those automatically generated files and the build folder and all those out.xml files.
Also, while I'm at it, I also want to point out that the designer view sometimes disappears and there is nothing on earth that will bring it back, the only way is to create a new project and copy the main.xml to it and then it shows up again. Another bug?
I have the latest eclipse version:
Version: Indigo Service Release 2
Build id: 20120216-1857
If you have any clues how to get this to work, I will appreciate it!
Many thanks in advance
When you click the Run button with an XML file selected, Eclipse is running an XSL Transformation on that XML and producing the .out.xml file as the result. This is a feature of the Eclipse Web Tools feature, which you'll have if you installed the Eclipse for Java EE Developers package (it may be included in other packages, too).
As others have said above in the comments, to run your Android app, select the Project, right-click, and choose Run As > Android App. Once you've done that once, it will create a Launch Configuration that you can launch from the Run or Debug toolbar buttons (pressing the small down-arrow on the Run or Debug buttons brings up a list of Launch Configurations that you can select from, as well as an option to manage them).
There is a Preference that will make Eclipse always launch the last thing you ran or debugged, instead of trying to be smart about what is currently selected. Open the Preferences and navigate to Run/Debug > Launching; there you'll find the option under Launch Operation at the bottom of the window.

Eclipse + Android + Cocos2d-x: Why does the emulation only work once?

I am just starting to learn cocos2d-x for Android, and understand how to create a new project (using create-android-project.sh), compiling the native code (using build_native.sh), then importing it into Eclipse as a new Android project (New > Android Project > From source...).
The first time I run the project it works great, but if I run it a second time, nothing shows up on screen and I get a force close after 30 seconds or so. Is the Eclipse import screwing something up? What could I be doing wrong? Do I need to build/clean/etc in a certain order?
I have noticed that on 2.2 if you use the back button, rather than the home button or the 'power' button it will break your emulator. On 2.3.3 and up, it won't even let you use the back button.
If you delete the emulator and remake it, the problem seems to be solved (kinda).
Still trying to figure out how to get around this one for the app I am making, as it needs to support 2.2.

Categories

Resources