Android Emulator Debugging, Code will not Update - android

I'm having a troubling problem testing some code for and Android app. My app has two parts, and activity where the user changes some settings, and a broadcast receiver that responds to SMS messages, both in the same package.
Here's the problem, I first implemented some simple code to test out the broadcast receiver and the activity, and both worked fine. But then as I tried to refine the code, I noticed the emulator wasn't picking up any of my changes. Event went so far as to uninstall the app from the emulator and try again, no luck. Then I added some extra Toast popups to my receiver, nothing, still running the old code. I know its running the old code because its sending out an SMS using a string constant that is no longer in the current code, so it should be impossible that it respond with that value.
Here's the kicker that has me confused. For fun I made a change to my activity. Ran the project from Eclipse and that change showed up! Tried to test the receiver code again, runs the old code that doesn't even exist anymore!!
How in the world can half the package update, and the other half not?
Can anyone help me out 'cause I'm about ready to lose my mind.

I had a similar problem. Changes made to classes imported from another project didn't get picked up by eclipse, but those made to classes in the current android project were.
Making a change to the current android project (inserting a blank line and deleting it) seemed to make eclipse pick up all the changes made and upload the app to the emulator.

I had this problem too, Now I found a working solution. Just follow these steps:
Run your project normally.
When emulator started, run your project again (DO NOT close the first emulator)
Then the updated application will be uploaded into emulator

I can't really be sure what happened but creating an new emulator image appeared to solve the issue.

I don't know why it happens but it's a problem I have all the time.
What I typically do is
Close the emulator
Close Eclipse
Reopen Eclipse
Clean the projects (in Eclipse, select Project -> Clean... -> Clean all projects)
Rerun the emulator
Annoying as hell but seems to work for me.

I'm having this problem too. It mostly happens when errors are entered into the code. The strange thing is if I go back to the original code, Eclipse doesn't revert to the original code. One thing that seems to help is to temporary delete the contents of a file, save, and rebuild, and then enter the contents back into the file, save, and rebuild.
How is one supposed to debug in such an environment?

Related

Android Studio shuts down forcefully

I am having a good problem with Android Studio. Initially I was using eclipse to develop android App, but eclipse display funny stuffs like deleting all my codes and most times crashes so I decided to try Android Studio.
Now am using android studio, but whenever I open an activity to start typing code, the IDE forcefully shuts down. Initially i tougth this happens when there is an error in your code, because I had an instance where the IDE shut down, was fixed by correcting the errors. But now the codes are all correct and when I install on emulator it installs properly.
But whenever I open an Activity and start to type Android Studio shuts down. I have tried to check for similar question, but could not find anything suitable. Please I need your help because I have a lot of project with deadlines and this AS behaviour is making me run nuts.. Thanks
There might be memory issue with Android Studio. I recommend you to shutdown all the heavy-weight memory consuming application like Chrome etc. to be shutdown.
I hope it will help.
Thanks all I finally got the solution to the shutdown. I had to create all the Activity used from AS and copy the codes into each file created. Initially i copied all the Activities, resources and Manifest I created in eclipse and paste them into AS. I guess AS doesn't perform auto update and this cause it not have have reference of the pasted files in memory making it to crash.
Sometimes some plugins keep running if studio crashes and they consume so much memory that studio is not able to launch again.
Or see if other applications are running and consuming much memory.
Or you can restart the system.

MyEclipse: Changing Android codes takes no effect

I know this is a rare question. Even if there are people using MyEclipse for Android development is doubted :(
The annoying thing is that after I modified my Android project (like an Activity class of a xml file), the project remained the same as it was when I imported it.
I thought there is an important feature that demonstrates this error: When I run my Android project and the console reported that "Activity not started, its current task has been brought to the front". This line occurs because the project didnt changed while as a matter of fact I did change the project and saved it.
Is there anyone has the same problem like me?
-------------add in Oct. 28-------------------
This was what I did: first, I modified one of my activities by commenting out the Toast functions; and then, I ran it however the Toast line still showed on my Genymotion emulator

Android device monitor crashing -- possibly due to Eclipse

Here's an odd issue I can't seem to find any information on.
I'm working on an Android app with a friend who uses Eclipse -- I use Ant and the Android command-line tools. Sometimes when I checkout code that was written by him and the project.properties file gets pulled into my local workspace, I'll have to change the path to the libraries back to where they're at on my machine, as it gets automatically set for him via Eclipse. This may be of use to know in light of what just started happening when I try to launch 'monitor' as I've always done; I get this error dialog box that pops up and says: An error has occurred, please see the logfile: /home/user/.android/monitor-workspace/.metadata/.log
So I did. It was, after I'd tried to launch monitor several times to no avail, a really long logcat-like file of Java traces. I cleared them out, thinking that perhaps it had run over its own max size for internal monitor data, but that didn't stop it crashing. A new set of errors just gets appended.
This is the first time this has ever happened, and unlike essentially every other Android problem I've had, I can't seem to find any existing information on it. The device monitor now seems to want to be integrated into Eclipse. I don't use Eclipse so I'm not sure how the monitor runs within it, or whether I'm correct in assuming that some configuration file somewhere needs to have a line changed (or whatever).
Here's the content of the logfile:
http://pastebin.com/JitCWrGg
Could anyone lend a word of advice?
Many thanks!

Eclipse not exporting full .apk

So I updated my Android Application lately and exported it to a .apk so I could send it to some other android phones. The exportation finished without errors, and everything was fine. But when I installed the app using the .apk, it seemed like I got an older- or half version of the app. Some functions don't work at all, and the app takes about 50% less space on the other phones. On my own phone, the app works perfectly and takes all the space it's supposed to. The weird thing is that I'm using the same .apk to install the app on both my own phone and the other phones.
Is there a possible error or solution for this? I really need the new functions, or the app won't work well! I also searched for a solution for hours, so don't blame me if there's already a same question out there.
Try Clean
Select your project in Package Explorer
Go to Project in menu and select clean.
Press F5
If this does not works
Try restarting eclipse else restart your PC
Sometimes Eclipse will not be able to access your files if they are not referenced correctly.
If this does not works try putting your code here that is not working.
Thanks.

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.

Categories

Resources