注意。我可以找到许多标题相似的问题,但是它们都没有在相同的上下文中,而且它们提出的解决方案都对我没有用。
我正尝试按照官方教程开始使用Flutter。 (https://flutter.io/get-started/test-drive/#terminal)
当我尝试跑步时
flutter run
该过程挂在“解决依赖项”上
bruno@bruno-Latitude-E5430-non-vPro ~/Projects/myapp $ flutter run
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle... 0.7s
Resolving dependencies... -^C
bruno@bruno-Latitude-E5430-non-vPro ~/Projects/myapp $
所以,我尝试使用'-v'
flutter run -v
该进程挂在'[] [android /] / home / bruno / Projects / myapp / android / gradlew app:properties'
bruno@bruno-Latitude-E5430-non-vPro ~/Projects/myapp $ flutter run -v
[ +29 ms] [/home/bruno/development/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +31 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/beta
[ ] [/home/bruno/development/flutter/] git rev-parse --abbrev- ref HEAD
[ +6 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] beta
[ ] [/home/bruno/development/flutter/] git ls-remote --get-url origin
[ +5 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ ] [/home/bruno/development/flutter/] git log -n 1 -- pretty=format:%H
[ +6 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[ ] c7ea3ca377e909469c68f2ab878a5bc53d3cf66b
[ ] [/home/bruno/development/flutter/] git log -n 1 --pretty=format:%ar
[ +8 ms] Exit code 0 from: git log -n 1 --pretty=format:%ar
[ ] 7 weeks ago
[ ] [/home/bruno/development/flutter/] git describe --match v*.*.* --first-parent --long --tags
[ +6 ms] Exit code 0 from: git describe --match v*.*.* --first- parent --long --tags
[ ] v0.5.1-0-gc7ea3ca
[ +141 ms] /home/bruno/Android/Sdk/platform-tools/adb devices -l
[ +6 ms] Exit code 0 from: /home/bruno/Android/Sdk/platform-tools/adb devices -l
[ ] List of devices attached
emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 transport_id:3
[ +161 ms] /home/bruno/Android/Sdk/platform-tools/adb -s emulator-5554 shell getprop
[ +32 ms] ro.hardware = ranchu
[ +16 ms] Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
[ +608 ms] Launching lib/main.dart on Android SDK built for x86 in debug mode...
[ +5 ms] Initializing gradle...
[ +7 ms] Using gradle from /home/bruno/Projects/myapp/android/gradlew.
[ +56 ms] /home/bruno/Projects/myapp/android/gradlew -v
[ +632 ms]
------------------------------------------------------------
Gradle 4.1
------------------------------------------------------------
Build time: 2017-08-07 14:38:48 UTC
Revision: 941559e020f6c357ebb08d5c67acdb858a3defc2
Groovy: 2.4.11
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_152-release (JetBrains s.r.o 25.152-b01)
OS: Linux 4.13.0-45-generic amd64
[ +2 ms] Resolving dependencies...
[ ] [android/] /home/bruno/Projects/myapp/android/gradlew app:properties
该,我试图直接从终端运行“ android / gradlew app:properties”:
并收到此错误:
bruno@bruno-Latitude-E5430-non-vPro ~/Projects/myapp $ android/gradlew app:properties
FAILURE: Build failed with an exception.
* What went wrong:
Project 'app' not found in root project 'myapp'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
出了什么问题????
bruno@bruno-Latitude-E5430-non-vPro ~/Projects/myapp $ tree
.
├── android
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ ├── com
│ │ │ │ └── example
│ │ │ │ └── myapp
│ │ │ │ └── MainActivity.java
│ │ │ └── io
│ │ │ └── flutter
│ │ │ └── plugins
│ │ │ └── GeneratedPluginRegistrant.java
│ │ └── res
│ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ └── values
│ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle
│ │ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradle.properties
│ ├── gradlew
│ ├── gradlew.bat
│ ├── local.properties
│ └── settings.gradle
├── ios
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ ├── Generated.xcconfig
│ │ └── Release.xcconfig
│ ├── Runner
│ │ ├── AppDelegate.h
│ │ ├── AppDelegate.m
│ │ ├── Assets.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ │ ├── Icon-App-20x20@1x.png
│ │ │ │ ├── Icon-App-20x20@2x.png
│ │ │ │ ├── Icon-App-20x20@3x.png
│ │ │ │ ├── Icon-App-29x29@1x.png
│ │ │ │ ├── Icon-App-29x29@2x.png
│ │ │ │ ├── Icon-App-29x29@3x.png
│ │ │ │ ├── Icon-App-40x40@1x.png
│ │ │ │ ├── Icon-App-40x40@2x.png
│ │ │ │ ├── Icon-App-40x40@3x.png
│ │ │ │ ├── Icon-App-60x60@2x.png
│ │ │ │ ├── Icon-App-60x60@3x.png
│ │ │ │ ├── Icon-App-76x76@1x.png
│ │ │ │ ├── Icon-App-76x76@2x.png
│ │ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ ├── LaunchImage.png
│ │ │ └── README.md
│ │ ├── Base.lproj
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── GeneratedPluginRegistrant.h
│ │ ├── GeneratedPluginRegistrant.m
│ │ ├── Info.plist
│ │ └── main.m
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
│ └── Runner.xcworkspace
│ └── contents.xcworkspacedata
├── lib
│ └── main.dart
├── myapp_android.iml
├── myapp.iml
├── pubspec.lock
├── pubspec.yaml
├── README.md
└── test
└── widget_test.dart
35 directories, 63 files
答案 0 :(得分:1)
运行flutter doctor
。
如果一切正常,那么您的环境似乎有一个神秘的问题。
我将从检查您的PATH,导出等开始。
答案 1 :(得分:1)
从gradlew docs:“执行任何Gradle构建的推荐方法是在Gradle Wrapper(简称为“ Wrapper”)的帮助下进行。Wrapper是一个调用已声明版本的脚本,如有必要,请事先下载。”
所以,我的猜测是该过程没有停止,只是需要很长时间才能完成。我会检查网络活动以查看是否正在下载某些内容。
PS:手动运行gradlew命令时遇到的错误不是问题,如果进入android目录,它应该可以工作。
答案 2 :(得分:0)
我遇到了这个问题。事实证明,我在Android Studio项目的key.properties
文件夹中找不到android/
。
我得到的确切错误是:
* Error running Gradle:
ProcessException: Process "/Users/fakeuser/git/fakereponame/android/gradlew" exited abnormally:
Command: /Users/fakeuser/git/fakereponame/android/gradlew app:properties
Finished with error: Please review your Gradle project setup in the android/ folder.
出现此错误是因为我的android/app/build.gradle
具有这段代码,这是从flutter教程中提取的。它对key.properties
进行文件检查,但没有给出非常描述性的错误:
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}