enter image description here
I'm new to android studio. Every time I share a new project on github, some of the necessary files and folders (settings.gradle, gradle/wrapper and .idea folder, gradlew, gradlew.properties,gradlew.bat) needed for someone to clone my project are not showing up on github, making it impossible for me to be graded remotely as a student.
The only files showing up are the app folder, the .gitignore, build.gradle, and gradle.properties files only.
Please help!
You can find out why certain files like the gradle wrapper are ignored by using git check-ignore --verbose gradle/wrapper/gradle-wrapper.jar.
Afterwards, you just need to adjust the relevant config file and remove the arbitrary lines. In your case (as I can see from your last comment on the original question), the .gitignore file in your user directory is the problem.
Related
I have some problem in visual studio code :
Visual studio code for java not create folder bin, file .classpath, .project and .settings automatically.
Sreenshoot :
In explorer VSC
File app.java and app.class in the same folder (src), when I look tutorials in youtube, file .class should be in bin folder.
In settings.json there is file.exclude, when I change .classpath to the false or delete it. It always reset to the true again. But if I run my code. it works.
Screenshoot : settings.json file (user)
Can someone help? I've search in any forum but never found solution and make sure path in my environment is correct!
Windows 10, VSC 1.53.0, jdk 15 (latest)
Edited
I ask this question when I'm very new with Java, now I understand, some file like .classpath, .project and etc will show when I use build tools like gradle or maven. Maybe because tutorial on youtube use old vscode version and not explain more about this file, actually this is like dumb question. But maybe this can help someone that new in Java too
If your project is newly created in VS Code through the command Java: Create Java Project.... This command will create a new project without build tools. (No Maven and Gradle). In that case, the files such as .classpath, .project, etc... will be hidden in the workspace storage path, which is by design, since we want the user just focus on the code itself.
If you want to see the bin folder, there is a setting called java.project.outputPath, you can set a relative path to that setting, then the output folder will be explicitly show in your project. For example: "java.project.outputPath": "bin"
Note, the setting java.project.outputPath only takes effect in the workspace scope.
I'm not interested at the youtube tutorials, but the folder structure in vscode-java is indeed like what you see.
In integrated Terminal, there'll a series of execution scripts shown before the real output. The one ends of folder bin is also the current project's classpath. The .class files which is generated by being compiled are stored there.
Setting.json is stored under the folder .vscode. This is your workspace setting, which is generated by pressing Ctrl+, and choosing workspace.
I have a project in Android Studio, and whatever changes I make in the application in Android Studios usually shows up in GitHub Desktop to push. Below is a screenshot of a history of revisions I've made:
However, at a certain point, I've made java classes in the application that are not being accounted for in GitHub Desktop. The classes that I am unable to push to my repository are highlighted in yellow:
Is there any solution to this?
Follow the commands:
Go to root directory of project and run git status to list uncommitted files.
Run git add . to add all the files to track.
Run git commit -m "your message" to commit files in current track.
Run git pull origin branch_name to get updated data from that branch. (branch_name is your current branch name.)
Run git push origin branch_name to push all committed files.
Now you check status by git status Hope all files will be uploaded.
Have you run git add on the new files? You can't push new files if you don't add them first.
If you are still looking for the answer.
I had the same issue while using Android Studio. In my case .gitignore file at the repo's main directory had a line that pointed to /app folder of my project. I just removed it and problem solved.
In general, you can have multiple .gitignore files so follow the below steps to fix this type of issue:
Go to your root directory of the git repo.
Search for all .gitignore files (In my case I found 3 files. )
See which of the files is causing the issue by simply commenting all the lines of a file.
Once you have the identified the file, now search for the line that is pointing to the files that you are interested and remove it.
I'm working on a group project for my software engineering course, and my professor has indicated that I set up the directory structure incorrectly on Github. I'd like to correct the issue now to avoid a grade penalty, but I'm very new to using Git. Basically we have a structure that is as follows on Github.
src
--main
----java
------Source Files
--test
-----java
------Test Files
Various Ivy/Ant build files
.classpath
.gitignore
.git
.project
README.md
I need to create a new directory called CodeComp that will contain the directory structure above except for the README.md, which should be on the same level as the CodeComp directory.
Since our grade is dependent on the commit history, this would need to be preserved. Is there an easy way to do this or are we better off just taking the small deduction on the final project grade?
UPDATE:
In case anyone else has to do this in the future:
Go to the folder holding the project and create the new directory.
Move all files needed into the new directory except .* files. Refresh Eclipse.
Commit and Push the directory changes to the repo regardless of Eclipse errors.
Manually delete the .classpath, .gitignore, and .project files from the repository.
Back-up your .classpath and .gitignore files. Delete your local copy of the repo and re-clone it.
Import the Git project and choose to put the project files in your newly created directory.
Copy the .classpath and .gitignore you backed up into the new project directory. Push the changes.
In theory you should be able to use a standard file browser to move everything but your .git and Readme file into your new sub-folder and then commit that.
The git history will still there but it may see it as two separate files, one that has been deleted and one that is just created. In my experience Git doesn't really like moving files.
In any case, you commit history will still be in the repository, it will just be 2 separate sections from when you moved the files.
But, hey... It may pay to show that move anyway. I know for sure that I was moving files all around when I first learnt about version control. It's all learning.
EDIT: You can test this by committing the change locally and checking the history before you push it upstream to Github.
I'm collaborating on an android app development using GitHub and I'm using eclipse adt bundle for the development. The problem is, git does not detect any new files which I add to the repo in the res or drawable folder although it is detecting any changes I make to the existing Java or xml code. It detects any new Java files I create but it does not detect any new xml file or any new png files which I put in the layout or drawable folder.
I've shown my gitignore file to my project manager and other colleagues and they said it has no error, the problem is local.
Use
git check-ignore -n -v <file>
To see if the file has been explicitly configured to be ignored by Git.
If that prints out something .gitignore:XX, then you know the line number of the Rule in the .gitignore file that is causing the problem.
Typically, .gitignore is used to exclude build output like *.o, but it may also be excluding binary objects, or anything else.
How to 'fix' the problem depends on your particular situation. You can have a .gitignore file in each directory of your project. In some cases you might want to remove a rule from the root .gitignore file, but in others you might want to create a lower level .gitignore and undo an earlier rule for just one particular directory.
The Git Docs have a pretty good description of it along with examples
There's another option beside gitignore to check files which is at .git/info/exclude .Check it please.
I think Eclipse is trying to make me miserable. A couple of hours ago, my project was working and compiling well. Suddenly that all changed. Eclipse somehow wipes out all changes I have made to my files(activity, manifest etc.) I make sure to save often but when I go to run the project, I get the error that I have a build error. I checked and there was none, so I go to close Eclipse, so I can reopen and see if the errors will go away. Instead what happens is Eclipse wipes clean all my files and I end up with a project on disk with lots of blank code files. I try to run anyway, and I get the error message below.
Failed to read the project description file (.project) for 'com.example.android.nfc.simulator.FakeTagsActivity.FakeTagsActivity'. The file has been changed on disk, and it now contains invalid information. The project will not function properly until the description file is restored to a valid state.
Anyone have an idea what in the world this is about and how I can rectify this?
I would recommend to wipe out all the eclipse related configuration files(make sure you take the backup if you have manually made some changes in those) and import the project again, by following
File -> Import... -> Existing Project into Workspace
Make sure you take the backup of whole project before doing this.
When Eclipse gets stuck in some obscure status, I usually find useful to recreate the .metadata folder in workspace directory. It is a drastic solution, but it usually works for me. After that you can reimport all your projects.
This happened to me because I had a conflict in my .project file. I opened it up in a text editor and fixed the conflict (in my case, removed from ====... to >>>branch..., as well as <<<HEAD) and then I was able to open the project in eclipse.
I was just encountering this same issue (using Zend Studio 12, which is built on Eclipse). My problem was that I was creating a project from a Remote Server, and I was just downloading everything, which also included the .project file from the old project. It wasn't showing this error until I'd closed the program and tried to open it again (which usually wasn't until the next day).
I seem to have resolved it by making sure not to download the .project when initializing the project.
If the .project file is a text file, so if you have it in version control you might want to copy it over from there.
Before you trying the following make a backup of your current project state.
Assuming you don't have an old copy, you can open it in a text editor and try to see if there is something obvious wrong.
If this fails, copy the source files of your project to a fresh location (without the eclipse configuration files) and import it as a new project into eclipse.
if you still have all of your other source (.java files, AndroidManifest.xml, resources), you might be able to get your project back by simply going to the folder containing the project, removing the .project file that you say is now empty, and then using the new project wizard to recreate the project (and .project file) for you from your existing tree of source.
from the menus, select File -> New... -> Project , and then, in the first dialog, choose Android Project from Existing Code .
if you had done anything special to the .project (reliance on specific .jar files or changes to classpath), you may have to re-do these steps after you re-create your project; but at least it should pick up the code you already have.
If all the files are empty, and you have no working Backup, I can't help. I would recommend to use proper version control in the future.
Use git or mercurial, they have nice UI integrations (see tortoisegit/tortoisehg).
To decouple the build process and library management from eclipse, take a look at maven or gradle, this might help you in future projects.
If you use git, complete the merge e.g. del the head in your androidmanifest.
I also got the Same Issue in Eclipse but the real problem is i removed the actual Source project folder from source location (from which eclipse is trying to take the project) to some other place hence my eclipse is unable to get web.xml file since it is not available. Now i changed my source project folder location to the path where eclipse is trying to search for. Issue Resolved for me.
Just delete the 'servers' folder in your workspace and try again.