I code something in android studio and it works.
I closed the program and when i open it again the project is filled with errors and its files (the ones mentioned in the headline) have changed completely which it can not run the code itself. Sometimes i even get things that are not even ASCII characters.
In the code itself(Java) i can no longer create TextInputEditText.
Well for the gradles i have created a new project and copied the gradles from those and put them there.
For the drawables i had to re-upload them, re-convert them to PNG (although they already were) and i had to re-write xmls.
I just need to know what's causing such malfunction.
AFAIK, whenever you open a code in Android Studio, maybe you are clicking on upgrading Gradle version, and it changes some gradle files.
And you need to add your drawables manually to the GIT and make sure those are uploaded, to the repo, make sure your .gitignore does not include PNG.
What I would say, is open virtual box, install a fresh Ubuntu system and Android stack with Android Studio. Now git clone your repo, and upgrade your gradle and all the build.gradle dependencies. Now remove all those ASCII characters. Also make sure, your keyboard language is US English and generally the OS is also in English.
Related
So I found another question like mine but the answers didn't solve my problem. Yesterday I updated to 3.5.0 Android studio and the xml tag auto completion is not working anymore. Example: I type Textview -and it adds automatically the basic attributes, like width and height, but the closing tag is missing. And it really slows me down.
Your cache has been corrupted. To resolve issue try following:
Close Android studio completely.
Take backup of following folders & then delete it (I.e. move to any other safe place. find it in your system, most probably in C: drive if using Windows)
<user>\.gradle\caches
<user>\.AndroidStudio{your_version}\system\caches
Now start Android Studio again. It should take time to re-build cache but now it would be working fine.
Try deleting .idea folder and all .iml files from the project, restarting Android Studio and rebuilding gradle did the trick. Autocomplete in XML support library is working again.
Checking out files from Version Control or copying all the source files in a new project would do the trick as well.
I am using Android Studio 2.0 Beta 6 on Ubuntu GNOME. I am facing a strange problem. I am using git version control in my Android project. After building the project, when I click on commit changes through Android Studio GUI. The commit changes dialog box shows every file as changed. When I click on any file, it says contents are identical. I am attaching the screenshot below, clicking on any files says contents are identical.
So my question is, Why Android Studio shows files with identical changes in commit changes dialog and how can I solve it? I tried google but didn't found any related question.
It must be because of automatic file encoding changes by the IDE (In case you imported the project from somewhere else). Sometimes IDEs apply them automatically. Just revert the changes and do a clean and build. If the changes appear again, you will need to do a commit once and after that you'll be allright.
To verify you can just go to a normally behaving file. Open it in notepad and just save as from notepad with another encoding. It should show as modified thereafter in the version control window.
For me it was AS pointing to old git version. Please check the Settings\Version Control\Git
I ran into this issue as well. None of the typical culprits seemed to be at fault. As far as git (from the command line) was concerned, the files were unmodified, yet Android Studio still showed them as modified.
It turns out Android Studio and my command line terminal (cygwin) were using two completely different Git binaries. Android Studio was pointing to a Git installation I had made at some point in the past, while cygwin was pointing to /usr/bin/git, which had come from Cygwin's Git package.
I edited Android Studio's version control settings (as shown in Anton's screenshot) to point to the git.exe within my Cygwin distribution, then did a "refresh file status" from the VCS menu, and all the files went back to showing as unmodified.
I'm trying to clone my remote repository for the first time.
I usually work on a desktop, but need to work on a laptop for the time being.
I know that I must have not included the proper gradle files in my pushes. I'm just trying to figure out exactly what I did wrong and find a way to fix it.
I won't be able to get back to my normal workstation until the weekend.
A link to my project on github here
After AS asks me to import project from VCS, it asks to create project from existing files or an external model. I've tried both, but I think the existing files option is what I'm supposed to do. After choosing that, I get the "Migrate Project to Gradle? This project does not use the gradle build....".
I've found quite a few posts about this topic, but none of them seem to be exactly what I'm going through.
It looks like a bunch of files are missing in the root of the project. Normally there is a master build.gradle at the same level as app that directs the build. This project doesn't have one.
What I would do is create a new project from scratch in a different space and copy its build.gradle, gradlew, gradle.bat, settings.gradle, and .gradle directory into a clean clone of your project and try again, choosing the root of your project as the import location.
I don't 100% guarantee this will work as there may have been modifications made to any of those file that may have been lost, but this should bootstrap your project again.
Also make sure a .gitignore isn't somehow ignoring these files so you can commit them back to your project. They really do need to live in source control.
I'm using Eclipse (4.2.1 Juno) on Windows 7 for my Android 2.2 project. I have several PNG resources in my drawable folders, and I'm finding that if I edit my PNG files (Paint/Photoshop etc) Eclipse doesn't recognise the file has changed and the ADT graphical layout designer still displays the old version of the image. I've tried refreshing the project folders list, tried doing a Project->Clean but neither has any affect. The only way I've found of getting Eclipse to recognise the new image version is to exit completely and restart which is a pain.
Is there some setting I can use to tell Eclipse not to 'cache' the images and always read the latest version off disk?
Try in Eclipse Project -> Clean then select your project. This will delete your R.java file and will generate new one.
That is a common problem of Eclipse that it doesn't recognize external changes for files in the workspace. The only thing I have found out to remedy this problem a little (apart from refreshing like crazy), are the refresh settings in external tools configurations. That is, if you run for example an Ant build, you can tell eclipse to refresh the workspace or specific resources afterwards. I don't know of any automatic way to do this though.
you should try saving all the unsaved resources and files after adding images ,than try out again.try cleaning both options with cleaning your single working project and with cleaning all projects.
I don't know of an automatic setting, but I have found a relatively simple manual action that seems effective. I was having the same trouble as you; now the following procedure seems to work consistently for me, with Eclipse Juno 4.2.1.
Click on the "res" folder to select it, then press F5 to refresh. Also make sure your PNG file timestamps have been touched.
Resources cached in bin\res folder.
Create script which delete folder bin\res with all content.
Add this script as external tool in builder list.
Set position in builder list - after CDT builder. Second position in list. If no CDT builder - set it first.
Enjoy.
I get a null pointer exception opening about half of the android XML files in my layout directory. There seems to be no pattern to why some files open and some files don't.
I upgraded eclipse to Juno. Re-installed all the plugins (ADT), re-installed the android SDK. I brought in my old workspace and adjusted my projects to point at the new android SDK.
Stack
java.lang.NullPointerException
at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.setLocaleCombo(ConfigurationComposite.java:1566)
at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.syncRenderState(ConfigurationComposite.java:3049)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:1158)
at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegatePageChange(LayoutEditorDelegate.java:679)
at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.pageChange(CommonXmlEditor.java:359)
at org.eclipse.ui.part.MultiPageEditorPart.setActivePage(MultiPageEditorPart.java:1081)
at org.eclipse.ui.forms.editor.FormEditor.setActivePage(FormEditor.java:607)
I found one way to resolve this. My eclipse recently crashed (and wouldn't start again) for an unrelated reason. To get it to start again I deleted most of the files in ${workspace}/.metadata/.plugins. These files regenerate (but will wipe some of your saved plugins and settings). Resolved my startup problem and my xml editor problem.
Just close all the xml files and restart your Eclipse SDK
An additional solution that worked for me and might work for others:
Create a new workspace and import your existing projects into it. I felt a little better about trying this than I did blowing away or moving my .plugins directory in the existing workspace. After I created the new workspace and imported the project that was giving me the cryptic "Failed to create parts controls" message, it worked fine. I'm pretty sure it's something bad in the .plugins or elsewhere in the old workspace, but I'll just keep using this new one until it starts to crap out on me.
Note that this can also happen if the containing folder contains too high a resolution
Example:
layout-sw500dp (this folder works okay)
layout-sw1000dp (this folder causes "Failed to create the part's controls" error)
I finally found out...
I had the problem even after deleting and setting a new copy of eclipse. The problem was because of the wrong Java version. You should find the right Java version for your eclipse.
In my case I have a project which uses Java 8 and for that I use eclipse Luna. But my other project which I develop it vie eclipse kepler uses java 6 (The project with the problem!).
Since Kepler and Java 8 are not compatible, I got this weird behavior from kepler. As soon as I ran Kepler via Java 6, everything was back to normal.
If you wanna know how to sets different Environment Variables and sets your Windows Path without setting up the Environment variable everytime for each project, let me know, I would be happy to share how to write a batch file to do that...