git android studio project,將Android Studio項目從git導入Android Studio(Gradle)

阅读: 评论:0

git android studio project,將Android Studio項目從git導入Android Studio(Gradle)

git android studio project,將Android Studio項目從git導入Android Studio(Gradle)

I've been reading this for hours now and everyone seems to have a different approach or that the tutorials are out of date.

我現在已經閱讀了好幾個小時,每個人似乎都有不同的方法,或者教程已經過時了。

Android Studio .gitignore only includes the app directory, this is on purpose. For what reason I do not know. When trying to clone the git repo Android Studio does not know how to handle it. A very annoying flaw in Android Studio.

Android Studio .gitignore只包含app目錄,這是故意的。出於什么原因我不知道。當試圖克隆git repo時,Android Studio不知道如何處理它。 Android Studio中一個非常惱人的缺陷。

對於Android Studio項目,我的.gitignore應該是什么?

I have a remote git repo containing the project in the form:

我有一個遠程git倉庫包含以下形式的項目:

as you can see the git repo contains the /app directory.

正如您所看到的,git repo包含/ app目錄。

I then try to import it via Check out project from Version Control and select git:

然后我嘗試通過從Version Control中檢出項目導入它並選擇git:

Everything works, the Test is successful and then I click on Clone:

一切正常,測試成功,然后我點擊克隆:

The next part I press Yes as git did not clone the entire project but just the essential source files:

下一部分我按是,因為git沒有克隆整個項目,只是基本的源文件:

This is the part where I am lost, I am guessing I am to create the project via Gradle, so I select Gradle and press Next:

這是我迷失的部分,我猜我是通過Gradle創建項目的,所以我選擇Gradle並按Next:

What am I supposed to do here, there are apparently gradle files on the net but which one am I supposed to use:

我應該在這里做什么,網上有明顯的gradle文件,但我應該使用哪一個:

Create project from existing sources

If I choose Create project from existing sources I get the following problem:

如果我選擇從現有源創建項目,我會遇到以下問題:

Results in this, I was expecting app directory:

結果在這,我期待的app目錄:

File structure (as you can see fela is missing a lot of files, this is when I chose create project from existing sources, MyApplication is an example of an app which was created in Android Studio):

文件結構(正如你所看到的,fela缺少很多文件,這是當我選擇從現有源創建項目時,MyApplication是在Android Studio中創建的應用程序的示例):

3 个解决方案

#1

The answer is obvious when looking at the .gitignore file of a newly created project. adle file is and should be included in the push to the remote repo.

查看新創建的項目的.gitignore文件時,答案很明顯。 adle文件是並且應該包含在推送到遠程倉庫中。

So the person who made the repo in my question is doing it wrong. The .gitignore file includes:

所以在我的問題中成立回購的人做錯了。 .gitignore文件包括:

.gradle

/local.properties

/.l

/.idea/libraries

.DS_Store

/build

/captures

As seen, more files should of been uploaded to the remote repo.

如圖所示,應該將更多文件上傳到遠程倉庫。

#2

Choose Existing Sources instead of Import

選擇現有來源而不是導入

#3

IF your project is showing error like The project 'xxxxxxx-xx' is not a Gradle-based project then check this link. I hope it helps. This link might cover your possible problem. Let me know the progress.

如果您的項目顯示錯誤,例如項目'xxxxxxx-xx'不是基於Gradle的項目,請檢查此鏈接。我希望它有所幫助。此鏈接可能涵蓋您可能遇到的問題。讓我知道進展情況。

本文发布于:2024-02-02 16:25:30,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170686232745001.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:studio   project   git   android   項目從
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23