Android studio does not create files - android

I added a new fragment to my project in Android studio like the way I did it a couple of times before, but now it says that this file das not exist (and is read only). I cannot edit a thing in it but also do not know how to correctly close it, so I can't use the name, which I really want...
I cannot find the file anywhere within my project and it is also not listed in the project+path (Name/App/src/main/...) but in the entire windows location (E:/...).
And how can I create a permanent file, or better, why does it not work any more?

This must be a fault on your side. Are you sure you are in the right folder? This is the only explanation I could think of. So you creat the files but outside of your project's folder, so you cannnot edit them or anything else, but read them...
Bene

Make sure that you have no LINT ERRORS.
For checking it:
Go to the bottom right side of Android Studio. Tap on "Gradle Console" tab.
If you have some errors(red text) - remove them and try again.

Related

Android Studio detects no changes with copied files so can't PUSH to Git

A very common thing that I tend to do is when I need to update a graphic or something in the drawable-nodpi folder, or any other folder for that matter, Android Studio doesn't detect the change so of course when I try to "PUSH" to GitHub it doesn't actually push and just tosses me the "No Changes Detected" message.
Is there a way to push anyways? Just to force a commit on specific files that I want to push because I know for a FACT there was a change and I need it submitted?
Lately I been having to delete it first from within Android Studio, then save the file, then add it to GIT then try a commit, but even this works only 70% of the time and is very annoying.
Perfect Example.... I have a splashimage.png in the drawable folder, I am in Photoshop and I change something then do an override to the splashimage.png with my change, but of course Android Studio doesn't see this as a change so I can't Commit this file to Git or anything.
Are you using external editors like photoshop when editing files? If so, press refresh in Android Studio to make it detect changes in file system. Then it says something has changed and suggest you to commit. Of course you can use command line to add changes anyway and commit without even using Android Studio.
Apparently the item I was looking for was the Synchronize. I just go to the file and Right Click > Synchronize and it then does a check against the last one manually and see's if it was different. Kind of a Refresh like Kuitsi had stated, but its called Synchronize. Also some reason I can't get it to work by just clicking Synchronize next to the SAVE icon at the top under File menu. Not sure why.
Whats your git status after you copy the file? Do you commit the changes, before pushing?
Have the same problem. Resolved.
The multi-root project used to work just fine for years, detecting changes in sub gits, properly pushing/pulling per sub, but not anymore. After some playing with a broken merge, it has stopped working. And that's not a local git repo issue. Cloned it from scratch - same issue. Changes (doesn't matter internal or external) are not detected by the Studio VCS facility, though git from console shows changes, View/Recent Changes shows them, Local Changes tab doesn't show any (single Default changelist).
It looks like something has happened with the VCS roots detection or related settings. Fixed with Preferences/version Control adding missing roots manually. I wish there is an option to rescan a folder or to delete some settings file and have the studio detecting these roots again.

How do I move files in Android IDE

I'm using Android IDE to develop, and I need to move source files from one folder to another, but I can't seem to find a way to actually MOVE a file (even copy and delete in two steps would work).
Am I blind? This seems like a required feature of any IDE, and given how good Android IDE is, I find it shocking if this feature was overlooked.
NOTE: This question is NOT about Android Studio!
You are right. The (essential) feature to move files around is missing from Android IDE.
Workaround:
You can manipulate the files in any explorer. Your project files are placed in /sdcard/AppProjects/YourProject.
You can count on the fact that such a feature will not be missing for long.
I would download a file manager (I like root browser) and switch between the two apps as a temporary work around. That app is updated fairly often so I would also just shoot the developers a feature request. I am sure they would consider it essential as you do.
PREFACE: Use a file manager; this hack renames Java classes.
Rename, with the relative path as the new name.
Let's say I wanted to move file from /sdcard/A to /sdcard/B. I'd long-press on file, chose rename, and type the new destination as ../B/file.
This doesn't seem like deliberate feature, rather a side effect of blindly passing path strings to the underlying framework. Can't say I don't like it, although, I'd recommend using a proper file explorer app.
Right-mouse click on any element (folder, Class, or XML file) the click = 'cut'.
Right-mouse click on the folder where you would like the files to be moved to, and then select 'paste'.
This works the same as moving files in the file-system.
For the most part (depending on where you are moving to and from) you can just drag-and-drop your files to move them as well.
I often achieve this goal by simply drag and drop. And the IDE also takes care of all the refactoring stuff.

android - Same project cannot run well

I'm developing a simple application which uses Google maps API V2, it all works fine without problems where the map displayed yesterday. Today I uses the exactly the same project, the map cannot be displayed, only the plus and minus symbol.Other parts are all fine.
Besides, it's now getting some error on xml files when i try to change any code on it, such as "Incorrect line ending: found carriage return (\r) without corresponding newline (\n)" . It's totally work fine before this.
I'm still a beginner for all these.Maybe anything wrong with my Eclipse?
It does sound like more of an eclipse/line encoding problem then an android problem.
Try opening the file's properties and then under "Resources".
You should see on the right hand side a "Text file encoding" section.
Check that these settings make sense for your platform and project.
More generally speaking, you might also wish to check your eclipse preferences.
Goto: General -> Workspace
There should be a "Text file encoding" and "New Text file line delimiter" sections.
You will want to make sure these are appropriate so this problem doesn't come back
EDIT: After changing these settings you will want to rebuild the problem (aka. Project -> Clean) to make sure it all applied

Attempting Android Notepad Tutorial - Exercise 1 - More problems

This maybe a continuation from 2 of my previous question, or maybe it's a completely unconnected problem.
Previous questions were
Questions on Notepad Tutorial:
Can't read ... AndroidManifest.xml - while attempting Android Notepad Tutorial - Exercise 1
The tutorial asked you to select "Create project from existing source". My 1st original question was where to copy the template (original source) to and from the answers I received, It looks like I should copy the directory-structure/source under the C:/Development/Eclipse/ directory, so it would look like this
_ C:/Development/Eclipse/Notepadv1/... _
I did that, and then tried to continue the tutorial, but when I got to the part that says to select "Create project from existing source", I received a pair of errors
C:\Andriod\Andriod-SDK-Windows\AndroidManifest.xml: java.io.FileNotFoundException: C:\Andriod\Andriod-SDK-
(Same error prints twice in the Console & WorkSpaceLog
So I posted a second question about the FileNotFoundException:, and received an answer saying to ignore the message, happens all the time... so I deiced to plow forward again. Now I have 2 problem. One of the problems may well be of my own doing, trying to run threw this tutorial dozens of times, and attempting to back out my changes over and over again.
Problem # 1:
I once again start to create the Notepadv1 project using "Create Project from Existing Source" (The cant-read-androidmanifest-xml error still appears), but as suggested I just ignore it. I next select "Android 1.5/Platform 1.5 as the Build Target, BUT the field where you enter the Min SDK Version is grayed out, and you can't enter the number 3 there.. The tutorial says to put the number there, but it seems to become grayed out at the same time I select "Create Project from Existing Source" and get the "cant-read-androidmanifest-xml" error.
Problem # 2:
If I click on [Next] twice, or [Finish] once, I get a pop up box with the message "Invalid project description" - - "Reason: Invalid project description"
[Details>>] "Invalid project description.
C:\Development\Eclipse\Notepadv1 overlaps the location of another project: 'Notepadv1'
".
This did not originally happen. There is no mention of the "Notepadv1" in the Package Explorer or Navigator windows, so I can't find any way to remove it, and I have run Clean Projects, exited eclipse and rebooted the machine a few time... in a few different ways.
Any suggestions? Joe
P.S. I have not yet accept any of the answers to my last question, because the juries still out. I'm not yet sure they were correct. I'll will make sure I go back and accept an answers, once I figure out what the correct answer is - Joe
I had the same issue, and just got it working!
I have no idea how to fix, I'm still getting the error, but It's not hindering me from continuing, so I'm not worried about it.
Is very simple, you shouldn't have copied the Notepadv1 directory into your C:/Development/Eclipse directory, because, when you "Create project from existing source" it copies it there for you. So, the one it's trying to copy from is getting in the way of where it's trying to copy to.
Hopefully that makes sense, and helps.
Problem 1 is because the androidmanifest.xml is missing.
Problem 2 Notepadv1 already exists in your workspace.
If I were you I would change your workspace to your Documents/My Documents or equivilant folder depending on your OS. You can do that under File->Switch Workspace->Other. Then delete what you have under the Eclipse directory. It could get messy if you update Eclipse or have multiple versions of Eclipse.
Where is this Notepad project? Is is part of the SDK? If it is I would use File->Import to copy over to your workspace rather than mess with the SDK copy. That is probably why the manifest is missing.
If you would like more help let me know.
PS. You will probably want to reinstall the SDK if the Notepad manifest is missing.
EDIT:
#Joe. I couldn't say why other tutorials worked and others didn't for definite but using the SDK as a workspace is definitely going to end up being programmatic when you are learning. My SDK is separate from my workspace. So, in a brief summary, I would keep the SDK, the Eclipse source and your project workspace in entirely different locations. And we can start from there if you want more help.
Very Simple, you need to clear the workspace... to do this adopt following 2 steps
Right click on your project and select Android Tools and now select Fix project properties
Select Project from menu and now click on clean.
This will work for sure
Re: problem #2...
My apologies if it's inappropriate to cross-post an answer in multiple threads, but it was asked in a couple of places so in the interest of helping novices with the Android environment (of which I'm one) I'm posting it here as well.
I'm using Vista, Eclipse 3.7.0
I don't know what "File | New | Project | Android Project | Create project from existing source" is supposed to do but I couldn't get it to work for a set of unzipped files of a project tutorial I got from elsewhere. I kept getting that error.
I found what did work is:
1) Copy the unzipped file tree for the project to wherever you want it to eventually reside.
2) File | Import | General | Existing Projects into Workspace | Select root directory:
and point it to wherever you put the zipped files, check-box on for the Project that is the one you want, then Finish
Step 2 seems to not actually move the files anywhere (even though the term 'import' implied that to me), but it seems to just make Eclipse aware of where the project is located and it uses the project from that directory.
That seems to work at least for me.

Cannot find the culprit file in my android project even after expanding the main folder

The side bar in eclipse shows a red cross on the title of my project folder but there are no such signs in the directories below it in hierarchy. In which particular file does error exist? How can I know that?
Error log shows: Current file is not a match for the given config.
Sorry I just came across this now, but I've had the same error too, so I'm sure others have. There was a quite a bit easier solution than what you had to do, at least in my case. I had the exact same problem, where my main project said there was an error, so I couldn't debug or run, but there was no apparent error, other than the red X on my main folder.
In order to solve this, I simply closed the project by right-clicking on the main folder, and selected "Close Project". Then, I right-clicked on the closed project, and selected "Delete". Don't worry, this will not delete any files, it will only remove it from the workspace, and will make sure you really want to do that by asking you to confirm. Now, just click on File->Import and select "Existing Projects into Workspace". Choose your parent folder for your app that was erroring, and import it. The few times I've had the phantom error on my main app, this has fixed it each time.
Whether there is an underlying cause and this process simply refreshes something in the workspace, I'm not sure, but at this point this fix is fast enough for me to use it.
Hope this helps next time!
Project -> Clean
Closing project and opening it again fixed it for me.
formed a new workspace and formed a new project. Added each file individually. Now it shows no error.. but still can't figure out what was wrong with thr previous code..? :=(
I faced the same issue..
there was a problem in manifest xml..
the path was not set properly. there may be space in the path..
I just copied the activity tag from other project and pasted in my project and just edited the path in android:name. it worked fine..

Categories

Resources