When I run inspect on my code it shows a warning like this:
Property "isLoading" is never used
Even though I am using that property. There are no problems with code, everything works fine, but this issue annoys me, what should I do?
You can see both warning and usage of that property in the photo below:
If the answer above doesn't work,
Go to your local drive -- Users -- Android Studio -- System
and delete the caches folder, then open android studio.
Go to file -> Invalidate Cache/Restart
Click on Invalidate Cache/Restart, a menu pops up
On the menu, click on Invalidate Cache and Restart
// Wait for android studio to restart.
I made an enormous mistake. I assumed Android Studio knew what it was doing when it said it found unused resources and I let it remove them all. It removed much needed XML id tags, it removed drawables, launcher icons.... what a mess. Has no one in Android studio land addressed this egregious set of errors? I spent a far too much time undoing all the things "Inspect code" said was wrong and I let fix only to find the app fails.
Lesson learned - never assume Android Studio knows what it is doing when it comes to inspections. Always check each before taking their often erroneous suggestion
Related
I was editing 2 apps at the same time. One is a new idea, where I am doing some tests and the other one that is a stable app, that eventually needs small edits.
I do not how it happened but Android Studio mixed then. In fact, AS is saying that for some activities of the second, the code is the same as the first. On the example below, even the second being java coded, it shows it as xml.
If I look at the same file outside AS, using Wordpad, for example, the code is correct, i.e. it is the original like I did (see the picture).
I tried many things like cleaning cache, closing and opening AS, so many times, so many ways, etc. but nothing works. For days I am stuck on this issue. I tried even the function ´Compare with´ but it shows the (wrong) xml code.
Was not only this Activity that appears ´corrupted´ but others of the stable one.
Any idea?
On Left is the beginning of the real code; on Right how AS shows it
Try deleting the caches folder in .AndrroidStudio and restart Android studio.
Path :
C:\Users\username\.AndroidStudio3.6\system\caches
Sometimes it does so. I met the same issue and fix it by:
On your android studio top bar, go: File -> Invalidate Caches/Restart -> Invalidate and Restart.
I'm using android studio mac.
1. The Problem
Usually, either flutter clean or deleting /build folder works for me. But, recently, some errors have been cached for a long time and I just can't seem to be able to delete them. The cleaning process is also supposedly taking way longer than expected (+3s in my reasonably good computer).
The reason why I say it is caching error logs is that essentially all of it refers to silly typo mistakes I have fixed long ago or other types of easy-to-fix mistakes. For example, 2 days ago (my computer rebooted 2 times since then), I've used an .email getter on an object that doesn't have it and the log is still there; or the fact that it is saying that I've used an invalid object on oneline, but now there is bascially nothing in that file anymore.
The app also builds and runs perfectly after these long error messages, and, if I hot reload or hot restart it, no errors reappear.
I would like to share my complete error log here, but a good part of it has a lot of personal data. It is also not very relevant I think, because it mostly refers to silly mistakes and typos.
2. What I've tried so far
Here is what I've tried so far:
flutter clean
Manually delete the /build folder
Restart my IDE
These error messages appear both on VS Code (my current IDE) and Android Studio.
Use Ctrl + Shift + P + Clear Editor History to reset VS Code.
Is there some hidden folder within a Flutter project that could be caching these data?
Apparently, there is some linkage between the Flutter project and the emulator itself, because wiping out the emulator's data seems to have solved the problem.
Was that supposed to happen? I think this should be treated as a Flutter issue — more specifically: flutter/flutter #45478 Github Issue.
Every time I open an activity layout in order to view its design, I can't see anything, and there's a "Loading configuration" message. How to solve it?
Looks like this is related to the following issue: https://code.google.com/p/android/issues/detail?id=56691&q=%22Loading%20Configuration%22&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
I had the same issue and it got solved by using the menu item: File->Invalidate Caches/Restart
Try to delete the build folder.
Here are the details:
Yesterday(2015/6/10) I faced to the same problem, and I solved it by using beyond compare:
This problem occured after a forced upgrade.
I have 2 projects, one worked(newly created) and one doesn't.
So I used beyond compare to compare the 2 projects' folders.
Luckily I found build folder of the not-worked never changed even though I clear cache, restart and rebuild it several times.
build folder deleted and everything worked fine now.
I've had this issue before, and it was usually not long after an error had come up.
Check the Event Log for errors. Usually a restart of the IDE fixed it for me though I appreciate that's not ideal. The errors weren't anything specific I think just teething issues with Android Studio - tis just preview software after all.
since I updated my Android SDK today I get some strange Lint errors in my project. The activity contains amongst others a textview. Everything works fine, but if I want to change the text size of the view within the code with .setTextSize(float size), I get in other lines (and also other independent methods) errors that a call requires a certain API level. But that are calls like string.isEmpty(), which is available since API level 1.
What am I missing? And I know, I can set the text size also in the xml-file, but I want to change it during runtime.
Any ideas?
Thanks!
Best regards
Tobi
I think I got into something similar some time ago (nonsense Lint errors)...
Are you working with Eclipse?
If so, you can try the following:
Restart Eclipse
Clean your project (Project->clean...)
Click the button "Runs Android Lint..." (it's in the toolbar, between the "Virtual device manager" and the "new project wizard")
I don't remember exactly what did I do to solve the problem, I hope it works though
Good luck!
With the latest release, I've had a few times where the lint errors were just incorrect. (missing semicolon on a line with a semicolon, etc).
In such cases, you can right-click on lint error warning, or on the numberings on the left side, and select "Clear All Lint Markers".
This will allow you to compile the file once, and if that works, Lint seems to start acting normally again.
I've recently starting developing with the android sdk. Currently, I am trying to add code to use a menu, however, when I try to add a menu.xml under res/menu, Eclipse hangs and freezes every time. When I reopen the Eclipse, menu.xml is there, but every time I try to open it, Eclipse hangs and freezes again.
I am running on OS X Snow Leopard, Eclipse 3.6.2 and the latest android sdk and adt plugin.
Any help, insight, thoughts?? I am thoroughly stuck.
Thanks.
Dustin
Thanks for the input guys. What ended up working for me was instead of trying to manually create a new menu.xml file, I find the add android .xml wizard and using it instead allowed me to add whatever I needed with out any hang ups.
Same problem happens for me even under the latest version of Eclipse (Helios). If I wait long enough, Eclipse reports a stack overflow exception and then this shows up in the Output window:
W/ResourceType( 5124): Bad XML block: header size 0 or total size 9949440 is larger than data size 0
menu.xml:1: error: Error parsing XML: no element found
This indicates that the XML parser isn't handling empty documents and the Android menu editor is barfing on the newly created file while trying to open it. I'm sure there is some "standard" way of creating a new menu that doesn't break the IDE but I have no idea what that method is. I'm too used to editing my files by hand but this crash/hang bug is a serious nuisance.
Dustin,
I think what has happened is, your settings have become corrupt. I highly recommend resetting all your settings. Keep in mind, you will have to re-import all your projects so this can be quite a pain, but I really think this will fix your problem.
To start, find your workspace folder and rename it to something like "workspace-bad"
Then, create an empty workspace folder to replace the one you just renamed.
Lastly, open eclipse and it will act just like a brand-new installation.
You will need to re-import your projects, which can be done by going to eclipse, hitting File>Import...
Then select under General
"Existing Projects into Workspace"
then hit "Next" and then hit "Browse" to find the root directory
also make sure "Copy project into workspace" is checked
I also recommend doing your "problem project" first, that way you don't waste your time doing the rest and then find out you have to re-create it.
I'm hoping that fixes it for you, good luck! :-)
-Jared
I ran into the same issue with the same setup. Right clicking menu.xml, selecting 'Open With', and selecting Xml Editor seemed to be a viable workaround for me.