Android project broken after Blue Screen on Windows 10 - android

I re-opened my Android Project after blue screen on my machine running Windows 10, all classes and components are unfound. Anybody any idea? I tried re-build and re-start my machines n times.

In addition to CmosBattery's comment:
File -> Invalidate Caches / Restart ... -> Invalidate and Restart.
This lets Android Studio basically forget everything it knows about your project and forces it to reinitalize everything.
I suspect, that the bluescreen prevented Android Studio from writing a file and so the project state got corrupt.
If this still fails, I recommend to check out a fresh copy and if you do not use source control yet (do it now :)) backup your files, create a new project and copy them back into the newly created project.

Check that your module(-s) uses valid Android SDK: press Ctrl+Shift+Alt+S and check modules one by one. May be the same validation should be done in build.gradle script

Just check your project at its path in Windows File Explorer. If the project exists -with all its files (java, layouts, manifests, gradles and other project files)- just go to Android Studio--> File --> Open --> Your project root directory.
It will rebuild the project as new
Hope it helps

Related

Android 3.4+ file encoding error causing projects to fail in loading and file to become unreadable

Ever since i upgraded to android studio 3.4 and going forth to 3.5.3 and i been experiencing projects that i used to work on earlier in the day suddenly fail to load and modules can't be read and opening any files .xml , .gradle all i see is the something like below:
I tried :
resetting the encoding to UTF8 from android studio settings > editor
invalidating the cache and restart
delete the .idea folder and reloading project
Nothing works, unless i have a copy of the same project or have it on Github and clone it again and re open it.
Note:
while the files look like the image you see in android studio, opening any of them in an editor like VScode shows the correct contents of the file
Anyone have a clue, because this is really frustrating
TL;DR
disable Dart and flutter plugins in File > settings > plugins menu,
reopen your project like you usually do.
Extra steps that could help:
clear cache
delete the .idea folder
delete all .iml files from you project as suggested by #Max Shwed
How i got there:
The issue mentioned above kept happening in a number of android projects old and new.
before uninstalling AS an reinstall i thought i give it one last try, i cleared the cache, delted all the the .iml files manually along with the .idea folder.
After that i imported the project and let AS regenerate the deleted files, one weird thing happened is that my build.gralde file was looking totally different there was Dart code inside it and package import from dart, while the file was completely unaltered when opened in any text editor (thankfully AS didn't re-write the file) it was simply built differently in AS view.
Suspecting Dart plugin to be the problem since i have some demo Flutter apps i been working on , i disabled the Dart plugin and just re-opened my project and Voila everything looks fine and project built successfully and run.
i think it's flutter framework issue
but i have a solution that i tried and fixed this
just make right click in your distributed file -> local history -> show history -> and revert one step
it will get your original code without any formatting
and wait for the next flutter plugins to update

Android Studio freezes on indexing

my project was working well but suddenly when I ran it on my phone, Android Studio freezes and I should stop it from task manager.
before this happens I installed "Geny motion" & "Virtual Box", but when the error occurred I uninstalled them. but the problem insisted.
Solutions I've tried
I uninstalled it and installed it again
I unplugged and plugged in my device
I disabled android indexing from setting
None of the above solutions worked.
I had today this exact problem. None of the above helped me until I found simple solution here
Just run File -> Invalidate Cache and Restart
That simple and it works!!!
Delete all Android Studio data - .gradle .android .androidstudio folders from your home folder. And all project build folders gradle and iml files.
This worked for me.
1.Close the project
2.Remove the project
3.Close Android Studio
4.Open it again
5.Open the project
Enjoy Coding!
I checked my java file and I saw somehow all the code in one of my java files was replaced with "NULL NULL NULL NULL....."
I deleted the file and the application runs without a problem.
Android Studio (3.1.3) froze on me while editing a source file. I waited and finally killed the process in Task Manager (Windows). Twice I tried to start up again and both times it got stuck with the "indexing..." message in the lower right. Both times I ended the process in Task Manager.
I looked in the source folder of the project I was working on. The source file I had been editing when it froze was "Receipt.java". There was another file in the src folder "Receipt.java__jb_tmp__". I deleted that file and Android Studio started up fine. It looks like I lost some edits, though.
When I did start up, it detected there had been some error and offered to submit a report.
If the project is large & has a lot of modules, you might need to increase the Allocated Heap Size for Android Studio.
Go to Edit Custom VM Options from Help menu and increase the value for -Xms and -Xmx
This is what I'm using
-Xms2048m
-Xmx8192m
-XX:MaxPermSize=2048m
-XX:ReservedCodeCacheSize=1024m
-XX:+UseCompressedOops
In my case color was declared as invalid, Android Studio ignored that and during building it froze. I had to remove the file, let it index, paste it back and fix the color string (it gave me error when I entered the pasted file)
just rename project folder then open IDE, it will show
now rename back to origin folder name, click open project
it work on my case
I have older project with sdk version 22, when I open it in android studio 3.1.2 on macOS. It keep indexing forever, everything was installed and configured properly but indexing loop never stopped.
Following worked for me
File > Invalidate caches/restart… > Invalidate caches/restart
Go to the File menu and click the option Invalidate Caches / Restart This will solve the problem ! Enjoy ;)

Android Studio Project Files are Missing

I was working on app and it was opened in Android Studio. It was all perfect but when after some browsing i clicked on android studio window. it says there are no files opened.
and when I checked in file explorer, all of my project files are removed except .idea folder.I did spend a lot of days on it. I cannot let this happen to me. what possible solutions of this problem?
I tried windows folder recovery, no benefit.
File > Invalidate Caches & Restart seems to be the solution for most oddities.
Before trying any thing. Back-up the project you have.
You can look through local history in Android Studio. In Android Studio -> VCS(Menu) -> Local History -> show History
Select an early restore point that includes your sources-> right mouse -> Revet
strongly I'd recommend you to use git to avoid such as situation. The code is Our Precious👽 Don't lose it.🙂
Just make a copy of the project and save it to another location and open it from the new location. Build it again and it will work.

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