Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flutter build apk 出错 运行example时没效果 #4

Closed
ckdgit opened this issue Jul 11, 2019 · 7 comments
Closed

flutter build apk 出错 运行example时没效果 #4

ckdgit opened this issue Jul 11, 2019 · 7 comments

Comments

@ckdgit
Copy link

ckdgit commented Jul 11, 2019

Git error. Command: git fetch
fatal: not a git repository (or any of the parent directories): .git
Git error. Command: git fetch
fatal: not a git repository (or any of the parent directories): .git
Git error. Command: git fetch
fatal: not a git repository (or any of the parent directories): .git
Git error. Command: git fetch
fatal: not a git repository (or any of the parent directories): .git

@ckdgit
Copy link
Author

ckdgit commented Jul 11, 2019

完整日志:
flutter build apk
You are building a fat APK that includes binaries for android-arm, android-arm64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Initializing gradle... 0.8s
Resolving dependencies... 1.4s
Git error. Command: git fetch
fatal: not a git repository (or any of the parent directories): .git
Git error. Command: git fetch
fatal: not a git repository (or any of the parent directories): .git
Git error. Command: git fetch
fatal: not a git repository (or any of the parent directories): .git
Git error. Command: git fetch
fatal: not a git repository (or any of the parent directories): .git
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 49.3s
Built build/app/outputs/apk/release/app-release.apk (10.0MB).

flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v1.7.4, on Mac OS X 10.13.6 17G2208, locale zh-Hans-CN)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[!] Xcode - develop for iOS and macOS (Xcode 10.1)
! CocoaPods out of date (1.6.0 is recommended).
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To upgrade:
brew upgrade cocoapods
pod setup
[✓] iOS tools - develop for iOS devices
[✓] Android Studio (version 3.4)
[!] IntelliJ IDEA Ultimate Edition (version 2018.2.4)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected device (1 available)

flutter run也是一样的错误

@kangwang1988
Copy link
Contributor

@ckdgit
这应该是之前pub的一个bug,简要来说就是在pub获取依赖的过程中,如果之前的git依赖失败了,导致出现了空文件夹,那么下一次直接就去fetch了,这直接导致了无法正确获取到依赖,也就没办法构建aop中依赖的获取依赖->构建snapshot->实现transformer的内容,这个问题我已经透过pr解决了,已经merge:
dart-lang/pub#2159

建议使用最新的版本来看下。

@kangwang1988
Copy link
Contributor

临时的一个解决方案是删除 ~/.pub-cache/git下面cache文件夹下的空文件夹,重新运行,dart会自己去获取依赖的,不过因为有对于sdk(dart-lang)的获取,所以这个时间可能久一点。

@ckdgit
Copy link
Author

ckdgit commented Jul 12, 2019

好的,谢谢,我试一试

@kangwang1988
Copy link
Contributor

@ckdgit
我理解这个不是aspectd的问题,所以先关掉issue了,如果你确信这是aspectd的问题,下面评论,我reopen这个issue.

@ckdgit
Copy link
Author

ckdgit commented Jul 15, 2019

@kangwang1988
通过上面的办法删除cache中的文件还是不行,应该不是找不到aspected依赖库的问题,
下面是aspected.dart文件171代码
await runCommandAndStreamOutput( <String>[sdkBinaryName('pub'), 'get', '--verbosity=warning'], workingDirectory: snapshotDir.parent.path, environment: <String, String>{'FLUTTER_ROOT': Cache.flutterRoot});
我在flutter_tools中输出了些日志看到是这一块代码逻辑报的错误,导致之后的逻辑没走,snapshot目录下的内容也没有生成。
请问会是什么原因导致的,这里应该就是执行了flutter packages get的逻辑,搞不清楚为什么一直跑不通。

@ckdgit
Copy link
Author

ckdgit commented Jul 15, 2019

不过我把那一段根据dart版本比较生成snapshot的逻辑给注释了,现在已经跑通了,还是麻烦您看下我上一条中的问题 ,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants