Problems with android emulator. Doesn't update changes in xml files - android

I've a little truble with android emulator, when I change (for example) string on strings.xml, I rebuild my app, but when I run the app into android emulator, App runs with my old strings and is not updated with the new data.
Anyone knows how to solve it?
Thanks in advance

you need clean build
If you only modify the xml files or other resource files, I think the eclipse will not rebuild your project.

Sounds like Eclipse isn't rebuilding the code. Check to make sure you have "Build Automatically" checked under "Project". Try cleaning your project and refreshing it. If the problem still exists... well I'm not sure.

Just uninstall the application and then reinstall it with the new changes , you have mad in the application.

Try to follow those instructions:
Disconnect the emulator.
2.save the current project
3.clean the project build directory.
4.Then try to run the emulator again.

Check your app/src/main/res directory. You can have different versions of main.xml and the emulator can use the one which you even do not change anything on it. Just keep the one in layout folder and delete others. This method has fixed my problem.

Related

Android studio strange behaviour with some files appearing different than how they are

I have a problem with Android Studio that happened all of a sudden today when I opened AS.
As you may see in the pictures, some files are strange.
In this picture you may see that some of the .java files have different icon
And totally wrong content
Same thing happens with SOME of the XML files which have different content
Also some of the PNG images are not displayed in AS.
All files are ok, if for example I open them externally (notepad...) they are ok (luckily).
Is there a way to fix it?
I've already tried to invalidate cache/restart but it didnt work.
Thanks
So, it happened once again, but I've found a quick fix.
I post it as an answer so people can easily spot it.
Quick fix:
Go to the folder "C:\Users\"your user"
Rename the folder ".AndroidStudio3.2" in ".AndroidStudio3.2backup"(name is example)
Launch Android Studio, It will not find configuration files, so it will ask you if you want to import them from the folder ".AndroidStudio3.2backup"
Click yes, few seconds and now you can delete the backup folder cause it will be created another ".AndroidStudio3.2" folder. Notice that I've renamed the original folder instead of delete it for security, and so to avoid to reconfigure Andoid Studio again, but you can choose to start a new configuration if you want.
Once launched Android Studio, click import (gradle...) and import your project.
Everything worked fine after this few seconds quick fix.
Hope it helps.
In fact this problem has been reported to the Android Studio team already.
A workaround would be to delete the caches folder of the Android Studio directory:
C:\Users\USERNAME\.AndroidStudio3.3\system\caches
This at least is the recommendation from the issue tracker and worked for me as well.
The same happened to me when I updated the libraries in gradle kotlin, etc. what I did was to download my project from my version manager and update the libraries one by one and prove the project works.

Android Studio 3.0 xml-layout file's preview not showing

When I open layout file in my new Android-Studio file and press preview tab it'll show a message Waiting for build to finish... for infinite time.
Has anyone faced the same issue or any solution?
Cleaning and rebuilding my project solved the issue.
try different theme (may be from Appcompat) and API level from top
OR
If you have made some changes in the layout just undo it.
delete .idea and .gradle folder from root of the project
close android studio , restart it
click on gradle icon from right sidebar and click sync icon to refresh project.
now rebuild the project and it should work.
After a lot searching and I tried all solution which people give here, but any of them didn't solve my problem, I guess this problem is from studio's developers, and they may fix it in next patch.
so I simply re-installed my android studio and it's solved.
Try Clean and rebuild project.and Also try Invalidate caches/Restart.And this issue is also facing because of Low Ram in laptops.
After upgrading to Android Studio version 3.1, in the Project Structure dialog the build tools version was empty. Selecting a build tools version solved the problem for me.
Hope it helps for someone facing the same issue.
See my response on similar question posted:
Android studio error java.lang.IllegalArgumentException: Resource name cannot be empty
This error can occur when you update to Android Studio 3.0. It doesn't affect your ability to build a project, but the error does not allow you to visually see your xml layout files. You will also get the error when committing files to GIT, but you can still commit and push.
What I found in one of my projects is that a file was added to the "menu" folder automatically upon Android Studio upgrade, and the file had no name. It was named simply ".xml". All you need to do is delete the file and clean your project, allowing a new build of the project. That should take care of the issue.
For me I had this problem with one file, so I simply created a new one with the same code.
Simply make a build from within AS - not the command line. I get this all the time because I'm mostly using the command line. It's been like this since early versions of AS so I recon it's not high on there list of issues.
Lately (3.2) there is a lot of new internal crashes and what not - not stable at all 🤐

Android Studio not reflecting changes to images during export of APK

I have a project i have worked on for a few weeks now. I went in to optimize some png's and was able to take a few mb's off the file size. However, when i generate the apk its the exact same file size.
I remember in eclipse i could go into the gen folder to delete those images and it would then recognize the new ones. I tried to go into the build folder in studio and do that but it still produces an apk the same file size. Is there something im missing?
I have taken one of the optimized images out of the produced apk and compared to the old and its the same size so its not picking up the new one for whatever reason.
Is there something else im supposed to do?
I know this is a very old thread but the answer to this question was never accepted.
So the problem here is in the emulator and not your computer or the software.
When you update the images the file names and paths stay the same. So it doesn't change the files on the emulator. I think it's just the way the android system works, if nothing changes then the app on the phone doesn't update.
So the solution is to simply uninstall the app from your emulator, then run the app from Android Studio.
Try rebuilding your app after refreshing the workspace, it works in eclipse but not sure about studio.
Go to Project->Clean. Uncheck "Start a build immediately". Go right click on your project and choose build. Then Run as - Android Application.
In IntellijIdea :
http://www.jetbrains.com/idea/webhelp/cleaning-system-cache.html
How to clean project cache in Intellij idea like Eclipse's clean?
For me it works to choose Build -> Rebuild Project on the main menu to do a full rebuild whenever I only change assets (i.e. when no source code has changed).
On top panel of xml designer there is Refresh Button.

AndroidManifest.xml is missing

I created one android application project in eclipse and whenever I tried to run that application its throwing an error message saying AndroidManifest.xml file is missing. what is the reason for this ?
I am using eclipse with android-sdk and ADT version is 20. in SDK manager I installed android 2.2 API level only.. Is this is the problem for that error ?
Delete bin folder in project and your library dependencies. Then re-run application.
you should clean and refresh your project once.
I was able to fix this by manually deleting the bin directory, as well as the gen directory, right clicking project and selecting Android Tools->Fix Project Properties, then using Project->Build All.
Restart your eclipse and make sure that build automatically checked. It worked for me all the time. Hope this helps some one.
I closed all projects that were unrelated with the one I was trying to run (right-click on project in Project Explorer and then selecting Close Project) and the problem magically disappeared (for no apparent reason). Then, even after I re-opened the closed projects, the problem did not come back.
I put the AndroidManifest.xml that in appcomatv7 and pasted to the project and problem solved
Click project -> Refresh (F5) -> Go to "Project" in the menu bar -> Clean. It works for me.
I was having the same problem and didn't understand why - followed all deletes of /bin, /gen, fixing AVD's, etc, still to no avail.
The /bin got me thinking though -
I had previously used this advice to exclude /bin from the resource filters (in an effort to remove results from the search)....
I removed the filter for /bin and voila.....
Interesting this only affected me when I wanted to Debug or Run within Eclipse -- I could export a working APK without any problem, but debugging failed.
Hope this helps.
I had the problem in android studio after an update , it worked by Tools ->Android ->sync with gradle file
(what worked for me)
1 - copy the file build.gradle
2 - drop the copied file in the android folder [example MyApp/android]

eclipse not updating android project

I'm having trouble making eclipse update the default icons and app name. I have changed the icons in the res/drawable-[h][m][l] folders and changed the 'app_name' in the manifest file but i still see the old icon and name when i test on my device.
I made the application with phonegap, if it matters, anyone have any ideas?
Try to clean and rebuild your project. Do that by going to Project -> Clean and then rebuild your project.
A clean and rebuild should fix this issue. If not, a fresh restart of Eclipse should do the trick.
Note that if you replaced the original files through OS's file manager instead of drag & dropping it into Eclipse, you have to select the /res directory and press F5 to tell Eclipse to refresh, otherwise it will hold onto old resource files.

Categories

Resources