My drawables in android studio are turning red and are not displaying. Does anyone know what could be causing this?
It appears you have Version Control Integration enabled, and those files simply aren't added. If you open the Version Control panel, you should see "Unversioned Files". Expand that, and you can right-click and select "Add" to add them to your version control system.
Alternatively, do it on the command line, i.e. if you're using git:
git add <path-to-file>
Related
I have been using Android Studio, that worked like a charm. Then I reinstalled my computer and switched to IntelliJ, but I kept the SDK on SD card so I don't have to re/downloading it.
It works, I can build an app, but layout editor is not working. I cant select rendering target.
Here is what I see.
When I open the dropdown menu to select rendering target it says just: <null>.
Any ideas?
First download proper SDKs in the SDK manager, and then you need to select the device on which you want to preview. To do so, click on the icon of the two little phones left of the AppTheme above the editor.
You need to have properly configured the IntelliJ project with the Android SDK.
Check your Project Settings at Ctrl+Shift+Alt+S.
Also check your Gradle settings to see if your SDK version has been defined there.
Unregistered VCS root detected
The directory /Users/*****/AndroidStudioProjects/Signin/google-services is under Git, but is not registered in the Settings.
Add root Configure Ignore
How to resolve this?
Please help.
Press "add root" when the warning message appears.
This will make idea register the "unregistered vcs root", and you can use the git features of IDEA/Android studio. Nothing bad will happen if you do not press "add root", but I suspect you will get the same warning on each startup of android studio/IDEA.
You are able to ignore that warning if you are not interested in using Android Studio's git integration. Or, you can enable git integration under the VCS | Enable Version Control Integration menu.
VCS stands for "Version Control System", aka "undo on steroids". No programmer should be without it.
IDEA (which Android Studio is based on) sees some signs in your project directory that your project source is set up to use a Version Control System.
In this case, the VCS in use is git. The sign is the presence of a projectdir/.git subdirectory.
That indicates that you either created this project directory by "cloning" this project from a git repo:
$ git clone https://github.com/projectname/reponame.git
Or that you created your own git repo in the project directory, by cd'ing to the projectdir and running the command:
/path/to/projectdir $ git init-db
By clicking "add root" you tell IDEA to add this git repo to IDEA's internal settings for the project, so you can use the IDEA features that support using git. I recommend using it, it won't interfere with your ability to use git from the command line, but some of the IDEA git features are handy.
If you don't know/use git, I highly, highly recommend that you learn it. It will make your life a lot easier, in the long run. As I said, it's like "undo" on steroids.
If you already know how to use git, here are a few of IDEA's git features.
The niftiest feature is that you can select a few lines of code, right-click and select Git/Show History for Selection.
The most useful feature (to me) is Alt-9 aka View/Tool Windows/Version Control.
This brings up the version control window, a pane across the bottom of the
IDEA gui.
By default the Version Control Window just shows "Default" (in bold)
and "Unversioned Files".
Expand "Default" to see the files that changed.
Expand "Unversioned Files" to see any files that need to be added to git.
The color indicates the status, all configurable of course, the default config is that blue indicates changed, green indicates added, etc.
Right-click/Show Diff on a changed file and it gives you a nice visual
diff, sort of reminiscent of Meld's UI, which is one of my favorite,
because it uses these sort of cartoon "word ballon" indicators for
each difference, to illustrate where the difference would be in the
other version.
Also, the side of the visual diff that shows the current file appears
to be a fully functional (or mostly functional) IDEA editing window,
making it easy to fix any gratuitous differences.
Some useful related links:
https://www.jetbrains.com/help/idea/2016.1/file-status-highlights.html?origin=old_help
Also, at the same site see:
Howto/General Guidelines/Version Control with Intellij IDEA/VCS-Specific Procedures/Using Git Integration/Checking Git Project Status
Reference/Version Control Reference/File Status Highlights
I'd include links directly to these but apparently stackoverflow doesn't trust me yet.
You can disable Android Studio git integration and get rid of the annoying warning. Here's how with Android Studio 2.1.1 for the Mac OS X:
Menu -> "Android Studio/Preferences...".
In Preferences window: Click on to open "Plugins"
In the Plugins frame: uncheck "Git
Integration".
Disabling "Git Integration" also disables GitHub, Google Cloud Testing, Google Cloud Tools Core, Google Cloud Tools For Android Studio plugins. (good riddance). By default, Android Studio enables all plugins at install time even though most devs will use only 10% of them.
FIRST STEP: Click in configure link.
SECOND STEP: then select the correct and add
If you see this message whenever you open Android Studio and create a new project, It's because your projects home directory is set as a VCS root. Maybe It was a mistake, set by you unintentionally. That was my case.
To solve it.
Just delete .git directory from projects home directory.
Delete: ../AndroidStudioProjects/.git
Unregistered Vcs root detected
The directory C:\Users\Andrew is under Git, but is not registered in the Settings.
Configure Ignore VCS root errors
Why is this showing ?
This occurs because Android Studio has detected that you have git projects imported but they have not been "registered" to track their status in Android Studio. Your project will not be negatively affected if you choose not to configure this, IntelliJ only prompts you because it has some integrated version control features that will not be able to function.
So if you want to take advantage of ItelliJ's built in version control options or just get rid of an annoying warning, its an easy fix.
Just register all of the projects you want to have the version control IDE integrations for in the Preferences > Version Control section. You should see this screen:
The UI is a little confusing, but all you need to do is select one of the directories under the Unregistered roots: section and then click the + button in the lower left corner of the window. If you have added all the directories you should see the Unregistered roots: disappear and you should no longer receive this warning.
You can select each directory and use the + and - buttons to determine which projects should use VCS in Android Studio
In the error message you have the options "Configure" or "Ignore". Click "Configure".
Settings window will open. Click the "Add root" option. In my case I only had one path on the list to choose from. I selected that path. Please see the image I have included below.
Click Apply, then click OK.
Look for "Version control" in preferences and set up what VCS should be used:
You have to set this up in order to access function like revert, commit etc from the IDE.
See also, the documentation on Version Control
For me, just VCS -> Enable Version Control integration did the trick. Having used IntelliJ in the past (Which is much similar to AndroidStudio, the latter is modeled after the former I believe), I've noticed the version control has to be enabled for each project when it's created/imported.
Steps are given below to sort out this issue:
Click on Configure option
Select Directories under Unregistered roots
Hit + button at the right side of pane.
And you are good to go.
I set up my Github with android studio, everything worked fine, the problem now is though, that I can't seem to turn off, or get out of version control to use the IDE normally again.
This means that errors aren't shown, and it is really hard to debug because of this.
So how do I turn off version control (VCS) in Android Studio?
To disable VCS in Android Studio on a Mac do the following:
Android Studio > Preferences...
In the Preferences window, select Version Control and under Directory choose VCS dropdown to be <none>
Don't forget to click "Apply" in the general Preferences buttons at the bottom.
For 2022...
It would seem that Android Studio nowadays does not automatically start with version control turned on for a new project.
The default seems to be "off" at the beginning of a new project.
(It does conveniently make a ".gitignore" file for you but it does not default to trying to use version control.)
However, if later you do manually yourself start using git in the folder in question, Studio does turn on vcs inside Studio, i.e. exactly as seen in the image above. In that case you'll have turn it off inside Studio, exactly as shown above.
In Android Studio 1.2.x
FILE -> SETTINGS -> VERSION CONTROL
Here the root is shown, Press (-) button to delete.
The other answers weren't working for me, so I am adding my solution.
This message was driving me crazy:
I had trouble with the other suggestions, as my settings was not allowing me to save changes for version control none.
So I went into Version Control / Ignored Files and removed all ignored files for that project.
Then when I clicked back on Version Control
I found this in this answer here.
VCS is a project specific setting which you can modify by going to File -> Settings then checking under the Version Control heading.
Alternatively, you could disable a specific VCS plugin under the Plugins heading.
Note: I have not used GitHub as VCS, but you should still be getting error display (syntax checking) in the IDE. VCS usage should not disable that, since that would make the use of an IDE completely pointless.
You can delete vcs.xml file and it will remove the VCS connected with your app. 'vcs.xml' file can be found in this location "YourProject\ .idea\vcs.xml"
Project > .idea > vcs.xml
change vcs value to 'none'
Note : only current enabled project.
I have an android project in Eclipse I started developing in android version 2.2.? (i think). I want to update the project to run on my 2.3.3 device. Is there a way to upgrade the project or do I need to create a new one?
So based on your question... I just want to say that an Android 2.2 application will run on your 2.3.3 device without changes. (i.e., applications are forward compatible)
If you still want to change your platform version, read on.
Right click your project in the Project Explorer pane and select "Properties." The window that comes up will look like the following and you can select a different platform target.
If your project then reports some property related errors in the Problems pane, you can fix those by right-clicking your project again and selecting the Android Tools --> Fix Project Properties menu item:
There's a uses-sdk element in your AndroidManifest.xml file, the minSdkVersion attribute should always be set to something, especially if you're going to put your application in the Android Market. The corresponding API levels for Android are well documented.
I did this myself recently in the Eclipse IDE.
If you right click the project and view properties. There is a tag where you can select the target framework (2.2.?, 2.3.3, etc.) Unselect 2.2 and select 2.3.3.
At this point, if you were to save and reopen the project, it would tell you that some properties are messed up. If you right click the project again, and one of the last few menu buttons will have text along the lines of "Fix Project Properties". Click that option and afterwards everything should work correctly.
I can't add comments yet (apparently), but wanted to add to the above answer.
Yes, as noted above, you can edit project properties to bind to a new target android framework version. Under Properties, the heading on the left you want to pick is "Android". And you don't "unselect and select", you simply check the target framework you want (you can only have one active, they are really radio buttons, not checkboxes!).