7

Hello I am not sure why this is the case, but when I commit and push to GitHub no matter how many png files or pictures I add to my drawable folders, the drawables folder never changes on the repository when I access it thru my profile on GitHub.

Example picture:

enter image description here

I have done research, but didn't find much substance

Why build and libs folders in Android project can't be commited or pushed?

I was surprised that there is not a lot written on this. This can be fatal if a user commits a project ending error and needs to recover everything on Github just to find that every drawable or png file will be lost.

4

1 回答 1

21

这取决于您如何将图像添加到 Android Studio。如果您在不让 AS 知道的情况下通过文件资源管理器将图像放到它们各自的文件夹中,那么这些图像将不会被添加到 git 并且它们将在项目资源管理器中显示为红色。如果您复制图像并将它们粘贴到 AS 项目资源管理器中的相应文件夹中,则应将它们添加到 git 并显示为绿色,如下所示。

Android studio 文件颜色示例

如果您希望添加到 git 的文件尚未添加,则只需在项目资源管理器中右键单击该文件,然后选择 Git -> Add or use Ctrl+Alt+A

于 2014-09-17T21:54:41.773 回答