why does Android Studio not recognize functions? - android

I did not change anything in my code, nor in the grade file, but I clicked on the update gradle notification android studio gets from time to time. I am not sure what the problem is but suddenly the IDE does not recognize some functions anymore, like String methods
also this icon changed:
My old project runs, but when I create a new project it won't work it says:
Error running 'app': Default Activity not found.
Help would be much appreciated.

I had the same issue I tried closing android down and restarted it up again and it started working, couldn't tell you why it happened though.

Try cleaning your project and rebuilding it from the Build Option. I have experienced this a lot of time as well. This works for me. As to why it works, I am not sure it. Hopefully someone would soon pitch in.

Go to C:\Users\{user}\.AndroidStudio4.0\system
and delete the caches folder.
Tried a lot of things I found online, but only this worked.

Related

Do not build Android project automatically on opening

I have been using Android studio for a long time, yet never understood what are the processes that Android studio runs at when we load a new project via File>New or File>Open. We just load the project and have to wait for so many minutes before the android studio completes those processes (I know that we can still click on file names and editor would open them, but i have observed the android studio will still lag until all those processes are completed)
However I don't know how, recently My Android studio started behaving differently. I don't know what i did, But every time i created a new project, or loaded a previous one, it would show a message like this:
This was very good for me, because even when i don't click the try again
button, I am still able to access all files and without any lag, thereby removing a need for external file editor. I feel this was some bug in gradle or cache handling that got fixed when i uninstalled AS and updated to AS 3.5 .
So is there a way to manually run all those build and indexing processes, instead of Android Studio just running them automatically?
UPDATE:
I think i was not clear before. I want that error to occur . Meaning I want to have a control over when the building process starts. Also, I am NOT having any error as of now, all my projects are working fine.
Look for highlighted warnings in you Gradle file, you may need to update some things and then sync again.
You could also try to clean and rebuild your project.
You can also File->Invalidate Caches / Restart if none of the above work.
If none of the above work, please provide more details on what warnings/errors you get.
When version conflict in gradle file, it cant be able to build and sync the project.There may be show "Unsupported Modules Detected: Compilation is not supported for following modules”. Fix them too

Location Aware Exception After upgrading to Android Studio 3.1 - Build Failed

I am facing an issue of build getting failed. I recently upgraded my android studio. And the look and feel has good changes in the IDE. But there is something I am stuck at. After making a few changes in the existing code I am trying to run the project and the build always fails with an error (Look at the image)
I tried to look for a lot of possible solutions and didn't find anything correct.
Help me out someone :p
Here you go with a simple and funny solution:
just follow the image.
Have fun. Happy Coding
Check for local.properties is there any key missing or some property is missing at the time of update it might got reset

Android Studio gradle build stuck at app:processDebugResources

I'm on Windows. I created a new project on Android Studio for Marshmallow at least.
The only thing I've done so far is generating the main activity which is a tabbed activity with view pager. Also, you should know that this project is a private git repo that I cloned.
I'm working on this project with another developer and the project is perfectly working on his side.
The problem is:
When I try to launch the app (wether it is a virtual device or my real phone), the gradle build gets stuck at the app:processDebugResources step. I waited more than an hour and nothing happened. Moreover, when I want to cancel the gradle build, it doesn't respond and I have to kill Android Studio process. Then I restart Android Studio and I have to kill a gradle process that prevents the initial gradle build (at Android Studio startup) from working.
The crazy thing is that I was able to launch the app before. I even installed it on my phone!
What I've tried so far:
Do what stackoverflow was giving as solutions like tick the offline mode in the settings
Create a new project --> It doesn't change anything
Reinstall Android Studio --> It doesn't change anything
Deactivating Avast antivirus
Invalidate cache/restart + Clean + rebuild (the rebuild gets stuck like when I try to launch the app)
And maybe other solutions that I forgot...
It's getting very annoying as it's making me lose days of development.
If you have any more solutions, or if you think I should try again some of the previous solutions, help would be greatly appreciated !
I know this is an old post, but I faced the same problem during the last few days and since i got crazy I hope I can help someone else out there.
After many hours of troubleshooting I found that the Java Platform SE binary executable goes in "suspended mode" in Windows 10, preventing Android Studio from compiling (it hangs at app:processDebugResources).
Example Screenshot
Killing the suspended process and recompiling the project works just fine... until Java gets suspended again.
Maybe your gradle version is not compatible with it. Try again with latest version of gradle in your project.
I did several things:
Install NDK
Change JDK from embedded one to Jdk 8
Redownload SDK i was using (6,7,8)
And now the problem is solved ! I have no idea which of these things made the tricks but I'm happy ! It may be useful to someone else one day.

Unable to run android eclipse project due to unfigured errors

These are the errors that i am getting when i attempt to run my project. It was working perfectly fine till yesterday. I have no idea what is causing the error. I cleaned the project and reran a number of times. I even restarted my laptop, but in vain. Please help me restore this, its a very huge project.
My friends copied the project on his laptop and was able to run it successfully. Which concludes that there has been a problem with my eclipse.
There are too many errors to sort out. I would very much recommend the easy way out which is to uninstall Eclipse (in case it really is the source of the problem) re-install it and start up a new project, then slowly add in the project files one by one. At least this way if the error comes back you know which file it is (if any). Best of luck.
Try to update eclipse if there is any update to apply.

Eclipse error mark doesn't disappear after fix

I'm developing an Android application on Eclipse Juno, and using a MAC OS Lion.
When I fix some error in a xml file the error mark doesn't disappear, and it doesn't let me compile the code even if I fix it. I tried deleting it through Window-> Show View -> Problems , but when i compile the code, the error came back. The only way i figured out to solve it is to crop all the content in the file, save the xml without errors and then paste the same code inside the xml file again, the error just go away as if there wasn't anything there.
Does anyone now why it happens?
Grahaminn is correct in that seeing the code would be helpful in case there is something that you are missing. However, since you say that it goes away once you cut, save, and paste, I believe you did take care of the error. While I've never found an answer to the same question other than the eclipse compiler obviously has bugs, I have had the same thing happen and have had to resolve the issue in the same way. The compiler, for whatever reason, still sees the error instead of the fix. It is very frustrating but we are stuck doing what you have done until the compiler is fixed.
Update your Android development tools. That bug (Android Lint issues remain even after correcting them) was fixed in ADT 20.0.2.
If you can't or don't want to upgrade, you have the options of
cleaning the project
manually running Android Lint again.
But similar errors will occur again from time to time then.
Thanks for all the answers. My Eclipse is working properly at least until now, the only thing with still giving me headaches is the R.java file which keep disappearing sometimes , but thats due to problems with ADT i guess. I uninstalled the ADT plugin and installed it again.

Categories

Resources