git分支更改后Android Studio丢失文件
Posted
技术标签:
【中文标题】git分支更改后Android Studio丢失文件【英文标题】:Android Studio loses files after git branch change 【发布时间】:2022-01-22 17:22:06 【问题描述】:正如标题所说,android Studio 在分支更改时会丢失/删除项目目录。每次都发生在同一个分支上。这是一个颤振项目,存储库托管在 github 上。我尝试从这个分支创建一个新分支,并且发生了同样的事情。签出其他分支时,项目目录都在那里。 Android studio
更新:
扑扑医生:
[✓] Flutter (Channel stable, 2.5.1, on macOS 11.6 20G165 darwin-x64, locale en-HR)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for ios and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.56.2)
[✓] VS Code (version 1.55.2)
[✓] Connected device (1 available)
.gitignore:
# Created by https://www.gitignore.io/api/dart,flutter,visualstudiocode
# Edit at https://www.gitignore.io/?templates=dart,flutter,visualstudiocode
### Dart ###
# See https://www.dartlang.org/guides/libraries/private-files
# Files and directories created by pub
.dart_tool/
.packages
build/
# If you're building an application, you may want to check-in your pubspec.lock
pubspec.lock
# Directory created by dartdoc
# If you don't generate documentation locally you can remove this line.
doc/api/
# Avoid committing generated javascript files:
*.dart.js
*.info.json # Produced by the --dump-info flag.
*.js # When generated by dart2js. Don't specify *.js if your
# project includes source files written in JavaScript.
*.js_
*.js.deps
*.js.map
### Flutter ###
# Flutter/Dart/Pub related
**/doc/api/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
**/android/key.properties
# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*
**ios/Flutter/flutter_export_environment.sh
**ios/Flutter/.last_build_id
**ios/Flutter/Flutter.podspec
# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
### VisualStudioCode ###
.vscode/*
!.vscode/tasks.json
!.vscode/extensions.json
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.svn/
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
# End of https://www.gitignore.io/api/dart,flutter,visualstudiocode
*.env
【问题讨论】:
其他分支是否包含这些文件?该分支是否删除了这些文件? 您使用的是什么版本的 Android Studio? .gitignore 文件中有什么? 【参考方案1】:我设法通过将.idea/
中的所有文件添加到 git(workspace.xml
除外)来解决此问题。我想这是因为vcs.xml
、*.iml
和来自.idea/
的其他文件不在存储库中,并且在更改分支时没有生成,但只有在重置 Android Studio 之后才会生成。
【讨论】:
以上是关于git分支更改后Android Studio丢失文件的主要内容,如果未能解决你的问题,请参考以下文章