a_schimpf
a_schimpf

Reputation: 765

The Android emulator is not reflecting changes I have made in .xml layout file

I have re-started Eclipse, re-run the application numerous times, and saved all of my files in my application. In my .xml, I have gotten rid of a button.

The .xml is inflated in my .java file. However, when I run my application on the Android emulator, it keeps showing the button that I deleted.

Upvotes: 0

Views: 5365

Answers (9)

Fahimeh Rahemi
Fahimeh Rahemi

Reputation: 1

I had the same problem in Android Studio. When I added an imageButton it was visible in preview tab of Android Studio, but not in the emulator. I tried almost every solution mentioned in Stack Overflow for similar situation, but I didn't succeed. One of answers said that you should create a new project and copy your files into it, but this solution had a huge cost for me and I didn't want to try it. Finally I renamed my layout file in the onCreateView method:

View view = inflater.inflate(R.layout.fragment_story_edition, container, false);

Then I created a new layout resource and left it empty and ran the project in order to get an error. After that error, I copied the content of my original layout file to my new made layout file, and the problem was solved.

Upvotes: 0

Tim
Tim

Reputation: 11

OK - I tried all this and it did not work (but I did resolve the problem...).

My project is very simple, as I am a complete newbie and had only created a mock up of the app - a simple interface and adjusted the strings XML file. None the less, I wasted a couple of hours trying to fix this damn problem. In the end, I simply generated a new project and ported all my work over. This took 10 mins and worked perfectly.

To try to learn why this happened, I repreated the steps that seemed to have caused the problem (clearing all projects, and then building them all again) - having copied all the code fromt he original project (including the manifest). I could not break it again, so am none the wiser about what caused it.

A more complicated project might be more of a challenge, but I thought I would post in any case, as I wasted a lot of time trying all these other things without sucess.

Upvotes: 1

user3458717
user3458717

Reputation: 1

The problem happened to me when I imported the project using the orginal files in Eclipse. It worked after I imported the projekt into the eclipse workspace as a copy

Upvotes: 0

kean
kean

Reputation: 31

One possibility is your emulator is not connected to the ADB (Android Debug Bridge)

To check just do:

cd C:\Program Files (x86)\Android\android-sdk\platform-tools

adb devices

You should see

List of devices attached

emulator-5554 device

If you don't see this, manually kill the adb.exe process (DON'T kill your emulator).

Then manually run adb.exe again.

When you do adb devices you should now see your emulator. If you close/kill your emulator you may have to repeat the process again.

Upvotes: 2

pqn
pqn

Reputation: 1532

To detail Rasel's answer (in addition to Project...Clean) you can also go to a shell and type adb uninstall com.example.applicationname.

Upvotes: 0

Zeeshan
Zeeshan

Reputation: 98

Clean the project and then run.

Upvotes: 1

Rasel
Rasel

Reputation: 15477

Uninstall the application from Setting->Application->Manage Application->Select Your app->Uninstall. and then run.It will work

Upvotes: 0

Trevor
Trevor

Reputation: 10993

I would have thought that restarting Eclipse would have had the same effect anyway, but for what it's worth, always try Project -> Clean in situations like this.

Upvotes: 1

gregory561
gregory561

Reputation: 15046

reinstall the application, clean the project in eclipse.

Upvotes: 2

Related Questions