my android studio gone crazy like this please help??
file was loaded in the wrong encoding: 'UTF-8' in android studio
An encoding issue can be solved by deleting all files contained in the Android Studio "caches" folder, which can be found in "C:\Users<username>.AndroidStudioX.Y\system\caches".
Make sure that to close Android Studio before deleting.
For people in future:
I had the same problem.
I was able to solve it simply by making a copy of the project and opened the copied project.
Copied project worked perfectly fine.
Note: I got this problem because of improper shutdown of my PC.
In my case it happend after Windows died with the blue screen, here's how I fixed it:
Close Android Studio
Find a directory named .AndroidStudioX.X in C:Users/YourUsername and rename it to old.AndroidStudioX.X
Restart Android Studio and choose the renamed old.AndroidStudioX.X to import settings from.
My answer is taken from here https://stackoverflow.com/a/53476487/4277741
On Windows close Android Studio and delete its cache directory:
c:\Users\[user name]\AppData\Local\Google\AndroidStudio[XXXX.X]\caches
you have to just delete the catches folder in C:/users/"your PC name"/AndroidStudio(version code).
Sometimes it gets disturbed because of some reasons like you have shut down the PC in improper way so it won't get enough time to shutDown all stuff So all that errors occurs.
I think it would definitely work for you.
Have a nice day!!!!
:)
All you need is to remove the Android Studio settings directory, which can be found:
on Windows
C:/Users/yourusername/.AndroidStudioX.Y
on Linux:
/home/yourusername/.AndroidStudioX.Y
Close Android Studio, delete the directory, then reopen Android-Studio and open your project.
Also if it happens on a different IDE, it is the same approach.
If the issue persists, try to copy the content of your project directory into a new directory, then open the project from the new directory.
This is an old one but I just click Invalidate Cache / Restart on file option in IDE and after restart, it works.
Version Android Studio v4.1
I had to replace unknown characters(which I had in a comment) into known ones. The issue happened after resolving merge conflicts.
This is an old issue, but if anyone comes across this, what isn't mentioned above, but happening for me is that the original file on disk is intact java code. Android Studio is reading it like this for some reason.
I had the same problem and how I fixed it is that I just went to the directory where the java files for my project are located, which in my case is users/user name/AndroidStudioProjects/Project name/app/src/main/java/com/example/android/project name, and here you will find all java codes you wrote for your project just open the one making the problem with notepad and you will find your code here in the right format and perfect just copy all of it and get back to Android Studio window and delete the wrong formatted code and paste this one and wait for it to sync and that's it. If you face the same issue with XML codes just do the same thing find the directory where XML files are located.
This worked for me, I clicked on utf-8 and code is displayed in proper format.
Just rename the project folder and reopen it in Android Studio, worked like a charm!
Invalidate Cache & Restart / Clean & Rebuild doesn't work for me. The project cache corrupted after improper s/m shutdown. Just change the project dir path renaming the project, it'll work.
That's not an encoding issue. That's compiled bytecode, the content of a .class file. You cannot simply rename it into .java and expect it to work.
Related
I've been reversing an app, but came across a problem. The AndroidManifest.xml file is not writable.
I made sure that the file is not 'read-only' in file explorer, but it still doesn't work. And I can't find 'merged text tab(?)' sort of thing which is supposed to solve this.
Hey there can be multiple ways you can try to solve this issue:
The simplest one is to Clean and Rebuild the project.
You can go to your File -> Invalidate Caches and Restart.
Try running Android Studio in Administrator mode.
You can try this : https://stackoverflow.com/a/34705198/9062752
Let me know if any of these fixed your error.
Also note : Not sure about this library but I read a comment which says ".jar files cannot be edited", so yeah if you are trying to edit a .jar file it is not possible (I am not sure of the reason though)
dear please check your menifest file that you can show build version name and build version code in application class please remove it and check any error in your menifest file and than you can run or rebuild your project .
Everything was fine. I just built it yesterday. Today, while I opened this most of my JAVA classes code, turned into xml. I don't know what kind of strange reason it is.
I tried 2 options below but nothing worked :
File > Sync project with Gradle files. Result: didn't solved my problem.
File > Invalidated cache/restart. Result: didn't solved my problem.
I attached a screenshot.
I found a solution that worked for me. Keep Android Studio open and go into the file system. Open every java source file and all xml files into some editor(Notepad++) and change something then save the file back to origin.
Now Android Studio detect all files as normal
Android studio: Click on malfunction file then Right-click -> Open in -> Explorer.
Choose your file where was the problem and open them with Notepad.
And change something, like adding the space and save it.
And Sometimes Android studio turns files into UTF8-BOM. It needs to change to UTF-8. You may do with NotePad++ -> Encoding.
I've been getting this error message when I want to create a new project in NetBeans. There are two old answers for this question, Project Folder already exists and is not empty- Error in netbeans and Netbeans error: Project Folder already exists and is not empty. Not only they are addressed for NetBeans 7, but also they didn't work.
I tried:
deleting project directory,
deleting userdir under C:\Users..\AppData\Roaming\NetBeans,
deleting cache under C:\Users..\AppData\Local\NetBeans,
uninstalling and installing 8.0.2
updating JDK to 8.40
but none of them worked!
I really appreciate if you'd suggest a solution. Thanks already!
SOLVED: I uninstalled NetBeans from C directory and installed it to the D directory. Then while creating a new project I choose a directory under D. It works fine now!
There is a 99% chance that this is caused by your antivirus application.
You can check on allow file modification for NetBeans in your antivirus application.
I have Bit-defender total security 2018, so if you have it follow me:
Open Bit-defender
On protection tab click on (View features >)
Either you disable (Safe Files) or allow access for NetBeans.
By the way I think Bit-defender is blocking applications to access files on the C drive if I'm not mistaken, so that's probably why it worked for you when you put it on the D drive...
Go to Program Files, delete the NetBeans folder and reinstall it.
Go to C:\Program Files (x86) and delete NetBeans Folder And try to install it again
This might be because of your antivirus. I got the same problem sometime back.
I then switched off the DataLocker option in my antivirus app, after this the problem didn't recur.
I had the same problem when i was messing around with some templates, after undoing the edits and saving the error message stopped occurring.
When netbeans says project folder already exists, it isn't a total error. It still creates the project, it just ran into an error while re-creating one of the template files. If you have the original tab still open, all you have to do is undo to the point before you ruined some template.
Uninstalling and re-installing will fix the problem but i hope this knowledge helps.
I am using Android SDK Tools 23.0.2 with Android API 20 (L preview).
I have been having this error for some time:
parseSdkContent failed
.androidjava.lang.ExceptionInInitializerError
and I have looked at many other similar questions and tried their solutions to no avail.
They recommended deleting the /.android file in the user directory where my workspace is saved and restarting Eclipse. However this did not work for me.
parseSdkContent failed Could not initialize class android.graphics.Typeface
Android SDK Content Loader failing with NullPointerException
This error seems to be affecting my java code's ability to recognize the XML files it references. When I reference variables to components in the XML file, it does not recognize its existence, even though everything seems to be set up correctly.
Please let me know if any more information is needed.
I'd add a comment, but my rep isn't high enough...
Anyway, deleting .android folder worked for me. Your wording suggests you deleted then restarted Eclipse. Try:
Stop/Exit out of Eclipse
Delete .android
Restart Eclipse
I was using the 64 bit version of Eclipse ADT from this link https://dl.google.com/android/adt/adt-bundle-windows-x86_64-20140702.zip
and it was giving me issues on Windows 7 64 bit
I have now downloaded 32 bit version of Eclipse ADT from this link https://dl.google.com/android/adt/adt-bundle-windows-x86-20140702.zip
and now its working perfectly.
It might help others too.
I used the "switch workspace" option and created a completely new workspace. This new workspace gives me no problems.
I'd add a comment, but my rep isn't high enough... (just copied and paste here)
I was in the same problem and using Eclipse Luna + ADT Plugin, what I did was:
Exit Eclipse.
Delete .android folder from my home directory.
Delete .metadata folder from my workspace directory.
Also in my workspace deleted a folder called .remote (I don't remember exactly what was it's name, just deleted it).
Open eclipse, complete the ADT dialog, setup the Android SDK path, and check for eclipse updates.
If updates were done better you restart Eclipse before continuing.
Import my existing projects, (or create a new one).
Open a layout file (xml) to see if the error is gone.
Good luck!
I'm on Eclipse for hours now and I didn't found a solution yet for my problem even after many searches on internet: I have no more R.java file on my projects.
On just created or on my old projects, i don't have R file anymore and I tried so many solutions (uninstall, re-install Eclipse, clean my project, check all my XMLs, fix problem with android tool and so on ...)
Please someone can tell me what to do in this case?
Hey If you just updated to ADT Rev 22 :
I had the problem too. There is a new component in the Tools folder called "Android SDK Build-tools" that needs to be installed.
Step 1
Open the Android SDK Manager
Step 2
Select the newly added Build Tools and install. (If problem stays then go to Project Properties => Java Build Path => Order and Export and check Android Private Libraries, then clean and build project.
It may be necessary to repeat the process, restart the SDK Manager after the update and make sure it looks like this (all tools installed):
More info:https://groups.google.com/forum/?fromgroups=#!topic/android-developers/rCaeT3qckoE%5B1-25-false%5D
Perhaps in Project Properties -> Java Build Path -> Libraries you don't have:
Android 4.2.2 (or other version)
Android Dependencies ?
If so, then right click project - > Android tools -> fix android properties
and see if this library showed up.
Thank you all for saving me! I've spent the whole afternoon on search this error.
Finally, my project works.
By the way, I also encountered one problem which i wanna share with you:
After upgrading, even if my project has not errors anymore. During runtime, it seems it couldn't find the classes from the jars placed in \libs.
Go into Project=>properties => Java build path= > Order and Export.
Please make sure all your jars are checked.
If this problem occurs suddenly in a well working project,
the first step is to find whether the problem occurs only in the current project or in all other projects.
if all other projects in the current workspace are working then 90% problem is with XML / mainfestfile/resourse file that you edited recently.
This error is not shown as red mark we have to find out what we have done recently in these files.
try this
sudo apt-get install lib32stdc++6 lib32z1 lib32z1-dev
it solved my problem
Close your eclipse and after refreshing system, try to open Eclipse again. I think you are using Emulator along with the eclipse. It may be because of the low Memory problem (RAM) of your system. I used to face the same problem when I use Emulator
whenever there is any mistakes in any of the xmls the R goes missing when a build or clean happens so check for any xml errors in your project unless you fix it you cant get back your R on clean or build. fix the xml files and perform a clean you will have the R generated. Also check in File->properties->Builders and see if everything is checked
I was using Eclipse Indigo and nothing I tried worked. I ended up downloading Juno SR2, reinstalling the ADT, and now everything works again.
Reinstall everything and it'll work.. i.e. go back to Google SDK or w.e. you're using and download it.
Update it to latest in SDK Manager.
Go into Eclipse-Project-Prefs-Java build path-order/export TICK EVERYTHING.
problem: No R file get generated.
guess: Try cleaning project if it is old one. Else create new project with no R get generated and with no compile errors but this: no project.apk
In this case you have to check your SDK for the built-tools. May not be installed after updating SDK.
Thus download them if not download here, then put them under directory: SDK/built-tools folder. Lastly, and most important, is to Run the SDK As Administrator. This guarantees refreshing SDK with all packages appearing in it.
Install the SDK-Built-Tools or any missing packages according to the above link and you're done.
hope this helps.
Try one thing, create a new Android Project and transfer all those files which are in the previous project. That worked for me.
In my case there is error due to "&" inside strings.xml file(but error not shown) for declaring string for a array type. Now the problem has been solved as I changed "&" to "and".
So, please make sure that you do not have such silly use of symbols, and clean the project.
I have had the same kind of problem, however Rechecking all XML files in the Resources folder was helpful in my case. I found syntax error in my XML files. Cleaning and building the project again can be helpful sometimes too.
I had the dreaded not more R.java.
Some of the things I've used in the past:
Clean / rebuild (the first thing we all try)
Restart eclipse (optionally reboot pc/mac)
Update both SDK/ADT eclipse plugin to latest version
Create new eclipse workspace and import project
Enable Verbose AAPT build output Eclipse menu>Preferences>Android>Build
Port project to Android Studio / Gradle (this helped my actually see the AAPT error i was getting Error Code:138)
Delete recent XML changes - Ultimately I found deleting recent menu.xml files I'd added and commenting out where they were referenced fixed the issue and I finally got R.java.
I got the error recently and had found no fault in any layout or value file. After a lot of tries I add another Activity and the R.java was build and the error disappeared. I don't know why this occur, but it takes me hours.