Specific Android Studio project won't open - android

I'm able to open all my AndroidStudio projects but one. The window don't even show up and the preview form Windows is just a blank page.
I already try to clean cache, delete gradle files - from the project and the one located on the user directory - .
preview with a working project on the side

I was resolving this issue for weeks and this is what finaly helped:
open "File/Open Recent/Manage Projects..."
find the faulty project and remove it from recent projects
open "File/Open..." and open the project again manually
when the dialog appeared, I pressed "this window" and it finally opened.

There may be some corrupted project configuration file.
Try to create a new project, check that everything works, and then copy the app/src folder from the old one to the new one (only the src folder).
You didn't mention it but I hope you have already tried restarting your pc, otherwise try.

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 is confusing my projects with one another

I'm running Android Studio 3.1.1 on OSx and I have three projects that all use the same local library projects / modules.
My problem is that Android Studio often opens the wrong project when I open one of those 3 projects. Let's say I open Project 2 or Project 3, then I might find that Project 1 is the project that is actually opened, even though it displays the correct path for all three in the "Welcome to Android Studio" dialog.
The solution I've been resorting to until now is to
Remove all three projects from the "Welcome to Android Studio" dialog project list
Go into all three project folders, removing the .iml file
Importing the projects back into Android Studio using the "Import project" function
I'm getting really tired of this, and it's really confusing to think that you have opened one project but another one opens instead.
What could be causing this very strange behaviour?
Sometime android_studio is catching the old cache, to solve this go file , hit invalidate cache and restart. And the second solution is, you have to Refactor the package name, every project should have the unique package name in this situation. i hope this will help...
https://developers.google.com/android/guides/google-services-plugin
go to this official link. It solved me this problem. In my case, ] deleted saved file in this path "app/build/generated/res/google-services/{build_type}/values/values.xml" which contains my previous app's information. After that, when I run my current app, it created that file again, but with my current app's info.

How to refresh A Project in Eclipse

I have been studying Android on Eclipse Mars for some time and i have been facing a constant problem everyday-the changes made in a folder/file are not recognized by some other folder/file. For example, if i create a new layout in the layout folder and then use it in the setContentView, it shows me an error ("layout-name cannot be resolved or is not a field). It works if i save the project,close it, and open it again, but this takes up a lot of time if i have more than one error, so the question-is there a way to save and refresh the project (without having to close it) so that the newly made files and folders are recognized by the java files?
Thank you.
You can refresh your project in Eclipse by right clicking on the project root folder in your Project Explorer and selecting "Refresh".
You may also want to consider checking if you have "auto build project" turned on. In your top toolbar go to Project -> Build Automatically.
If build automatically is turned off you will have to manually build your project, by Right Clicking on the project in your Project Explorer and selecting "Build Project".
However, I do agree with Pankaj Nimgade that Android Studio is likely a better entry point IDE for Android development.
Real advice: Switch to Android Studio as soon as you can. There you would sometimes have another problem called "sync" though. But it's a much better IDE and you are at least in line with Google.
on Eclipse, F5 should do the trick. Or right click your project and Refresh. Or Clean all projects. If you are still stuck, simply close Eclipse and run it again.

Not able to create new Project with ADT version 21 (creates empty project)

I've just download the Android Developer Tools v21.1.0-569685 for Mac. I'm unable to create an android application project and get an empty project whenever I follow the steps below.
I've opened Eclipse.
And used the menu File -> New -> Android Application Project.
I enter TestApp as the name.
Then click next through all pages leaving the default options.
When I get to the last page (Next is Disabled and Finish becomes enabled) I click Finish. There's a bit of activity when this happens and I can see a project added to the Package Explorer in the background, but the window with the Finish button stays there. If I cancel out of the android application wizard the project it created is still present by it's empty (see screenshot).
Note: I've attempted the solutions at Not able to create new Project with ADT version 20 with no joy.
The problem was another Java application had installed different versions of some .jar files into /Library/Java/Extensions. .jar files on that path are automatically loaded. Removing the .jar files from that path resolved the problem.
In my case the problem was specifically the Australian Governments AUSKey software that installs .jars into the Extensions directory.
The solution was reported here https://code.google.com/p/android/issues/detail?id=54452.

Messed up in Eclipse after viewing a sample project

I imported a sample 4.0.3 project and after deleting it from the Project Explorer list every thing is lost, now there are none of the projects that I was working before in Package Explorer??
Moreover now on importing these old project For Example name "On" are coming with the name "OnActivity" but still not able to run.
Else in workspace every file is ok, I tried to CLEAN but still no effect.
I'm new to devlopment kindly guide me.
Recover the source code from your workspace in the Windows file browser. If all attempts to recover fail, you can just create the projects from existing (recovered) code.
And what project are you trying to run? If APIDemo or QAActivity, the log shows you why you can't run them.
And instead of using the Play button (start) to launch, use the dropdown triangle and select the project to run, else the XML will be run (obviously that won't work).
Furthermore, make sure Eclipse knows it's a Android Project you're trying to run.

Categories

Resources