I'm using Android Studio version 1.5.1 and we have a problem when cloning and working with Github.
In my gitignore file I got a text saying *.iml, as I understand this means that all my iml files are ignored by git and not uploaded. When my project collaborators are cloning my project, they get a error message telling them that there is 2 missing iml files. They are asked to either keep or remove them. It doesn't matter which they do beacuse it still gives the same problem. They cannot code or build anything.
As I understand the iml files should not be uploaded to github but instead Android Studio should automaticly generate them when it is building or importing a project.
What have we done wrong?
After cloning the repo, you should re-open the project with
File -> Open
and select your project you've just clone and android studio will re-build, re-index and re-create the .iml file :)
Related
I'm building a library for Android in Android Studio. In order to test and debug this library, I created a project with two modules: a library module (my code) and an app module (for testing)
Creating these was pretty easy. I just clicked File > New... > Project and followed the prompts. Afterwards I was able to write code, hit build, and observe the results in the app that was generated.
After a couple of months, everything was ready to deploy. I've been regularly committing my code and pushing it to a central repository, so another developer at my company cloned the repository and tried to open it in Android Studio. He was met with an entirely different view.
This is what I see:
This is what is seen if you clone the repo and open it:
When looking at the second view there's no way to build the project, there are no build configurations, no variants, and none of the gradle scripts seem to run.
If instead of cloning I just cp -r my entire project directory and open that in Android Studio, it opens perfectly. So the issue seems to lie with something in my .gitignore hiding an important configuration file necessary to build the project.
The .gitignore was generated for my automatically by Android Studio. It looks like this:
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
Everything there should be files generated by the build tools or local workspace configuration files, not project-level files necessary to compile. But I'm not very familiar with Android, its build steps, or the 800,000 things Android Studio is implicitly and secretly doing behind my back. Just opening the project in Android Studio causes 12 or so files to get modified on disk, so I know that it's doing a lot of things behind my back.
I can share any details about my configuration or project setup as necessary. I've spent a few hours on this already and can't figure out for the life of me how to get this project to build.
While it's probably not the proper solution (after all, Android Studio created the .gitignore for me), I found that removing /.idea/modules.xml from the .gitignore and checking in this file fixed all of my issues. Suddenly when I launched Android Studio it detected everything, some Gradle scripts ran, and I was able to build my project.
I also try to Invalidate Cache, Clean project, Rebuild Project, Sync with file-system but every project have same problem so please solve my issue or help.
Hear is my Android studio IDE
I faced the same issue few days back because my pc shut down while i was working. The problem is with your Android Studio not the code. If you check the same file in the project directory then you will find the file perfectly fine with your java code.
I tried all the possible solution which i found on the internet. Few of the solutions are which didn't work for me are -
Deleting the workspace.xml file
Deleting the .idea folder
Deleting gradle folder
This is the solutions i found online but didn't work for me.
What actually worked for me is my code was on github so i pushed the latest code on the github and then deleted the current working project directory i.e your project folder in your storage and again cloned a new project in another location.
Here the problem was with that particular project in your Android Studio. So after taking the backup of that project and deleting it and again creating the new project with the same code worked for me.
When I am cloning a android project repo from bitbucket everything happens successfully and all files get cloned in my local repo and when I try to open the project by android studio 2.3.3 as the project uploaded was created using android studio 2.3.3 I see everything is okay but when I view any of the java files I see every single thing has an error even all of the import files have error .
I tried cleaning the whole project and rebuilding it which resulted in showing error in every java file now the project will not even build.
what to do now? Please help!
I'd like to know what is that trash that was pushed by Android Studio to bitbucket. Those files and directories don't even exist in a project directory. What are they and how can I get rid of them. BitBucketScreenshot
.gitignore? If so, why again project directory doesn't contain any of these?
Greetings.
Problem is solved. By accident I have setup IDE settings remote repo the same as project one.
I tried to clone a private repo from GitHub to Android Studio using "Check out Project from Version Control" The cloning works. However, after cloning, the Android directory is empty. I couldn't find any Java files in the Project directory either:
This is a known problem with the IDE.
How to fix it?
Close the project.
Delete the .idea folder
Open the studio again
Create new project from existing source - your project path
And thats it :-)