gpt4 book ai didi

android - React Native 和 build.gradle

转载 作者:太空狗 更新时间:2023-10-29 13:02:46 25 4
gpt4 key购买 nike

我是 React Native 的新手,我和一位同事一起开发了一款新应用。我创建了一个新的 React Native 项目,它也生成了一个 .gitgnore 文件。其中所有 .gradle 文件(以及/android/文件夹中的 build.gradle 文件)都被忽略。

当我将项目推送到 Github 并且我的同事拉取时,他 npm install 下载 node_modules(也被排除在外 <- 我已经阅读了这背后的原理)然后他运行 react native 运行安卓。这失败了。我们意识到,如果他在/android/中创建 build.gradle 文件并复制粘贴我在本地拥有的 build.gradle 的内容(被 git 忽略),一切都会顺利进行。

我的主要问题是:1) build.gradle 文件应该像 react native 默认情况下那样被忽略吗?2) 如果是,如果团队需要以某种方式获取 build.gradle 内容以在他们这边运行项目,他们应该如何处理 React Native 项目?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 内容并可以检查。)

enter link description here https://github.com/facebook/react-native/blob/master/.gitignore https://github.com/facebook/react-native/blob/master/local-cli/templates/HelloWorld/_gitignore

关于android - React Native 和 build.gradle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53353851/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com