簡體   English   中英

React Native和build.gradle

[英]React Native and build.gradle

我是React Native的新手,我和一位同事在一個新應用上合作。 我創建了一個新的react本機項目,它也生成了一個.gitgnore文件。 在其中,所有.gradle文件(以及/ android /文件夾中的build.gradle文件)都將被忽略。

當我把項目推送到Github並且我的同事拉,他npm install下載node_modules(也被排除< - 我已經閱讀了這背后的理性)然后他運行react-native run-android 這失敗了。 我們意識到,如果他在/ android /中創建build.gradle文件並復制粘貼我本地擁有的build.gradle的內容(由git忽略),一切運行順利。

我的主要問題是:1)是否應該忽略build.gradle文件,因為默認情況下本機做反應? 2)如果是,如果團隊需要獲取build.gradle內容來運行項目,那么團隊應該如何處理反應原生項目? 3)如果我的磁盤驅動器出現故障會怎樣? 我可以從git中提取所有內容,但我沒有build.gradle。 我應該從頭開始嗎?

.gitignore文件的內容:

# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml

# node.js
#
node_modules/
npm-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
*.keystore

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots

# Bundle artifact
*.jsbundle

它是.gitignore .gradle文件而不是*.gradlebuild,gradle

因此,您的問題的答案是build.gradle不會被忽略,不應該被忽略。

.gitignore中包含的android相關內容包括:

build/
.idea
.gradle
local.properties
*.iml
android/gradle.properties

對於標准,您可以參考以下兩個示例.gitignore文件。(您可以使用以下鏈接內容替換.gitignore內容並進行檢查。)

在此處輸入鏈接描述 https://github.com/facebook/react-native/blob/master/.gitignore https://github.com/facebook/react-native/blob/master/local-cli/templates/HelloWorld/ _gitignore

您必須簽入build.gradle文件,只應忽略.gradle目錄。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM