开发者

Old copy of application appears on Android Emulator (using Eclipse IDE)

I'm using Eclipse and the Android plug-in for my Android phone development. I just worked through my first application from the "Busy Coder's" book and I'm having a persistent problem. Every time I run the example Java application, using a properly configured Android Run configuration that references the example project, the emulator starts (if not already started) and the application is seemingly deployed to the emulator. However, what shows on the emulator is not a reflection of the application's current state. Specifically, the example application I typed up should display the current time and then every time you click on the main app view area it should update the current time (via a Button object instance created in the constructor that has an onClick() handler). Instead, I see "Hello World" and clicking on the main view area does nothing.

It's as if some old copy of the test application is being pulled up. I even hunted down the strings XML file for the project and I did find a string declaration that was defined to "Hello World". I then changed that string to something else开发者_开发百科, rebuilt the project, and re-launched the application. But I still got the same "Hello World" display and still do not get any response when clicking on the main view area. I even tried shutting down Eclipse and the emulator and nothing changed, and also cleaning the project before a test run.

So, what are the usual mistakes a newbie makes that could cause this situation?

-- roschler


This happens to me occasionally but it is usually fixed by deleting the application from within the emulator UI.

After deleting the application from the emulator and reinstalling it I can launch the application using "Run". After this the application is updated every time the "Run" button is used.

Check the console to see if the activity is actually being installed and launched rather than being brought to the front when you "Run" the app.


If you launch in debug mode, the new build will always be installed in the emulator/device.

However, if you launch in run mode, you need to increase the version number in AndroidManifest.xml, or the new version won't always get installed.

Please see Android: Eclipse doesn't pushed new version of app to emulator from earlier today.

Hope this helps,

Phil Lello


By far the most common reason this happens to me is that I failed to notice that there was an error compiling the application so it didn't push the new version. Especially when my package explorer is obscured so I don't notice the red X. Edit: one other reason it often happens to me is I have more than one emulator running or my phone or tablet plugged, and I accidently install the latest version to the wrong device without paying attention.


I open the manifest file in Eclipse, "touch" it by deleting and undeleting something, save it. This seems to refresh the APK for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜