我正在使用flutter在android studio上进行我的第一个项目
我通过flutter create project_name
创建了默认项目,但是当我使用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...
Running Gradle task 'assembleDebug'...
它仍然像这样:/ 我在Windows上工作,并且工作正常,但是解决了所有在Linux Mint tina上运行它所面临的问题后,我没有获得任何结果 但是一段时间后,我得到了这些错误
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: /home/simo/.gradle/wrapper/dists/gradle-5.6.2-all/9st6wgf78h16so49nn74lgtbb/gradle-5.6.2-all.zip
Running Gradle task 'assembleDebug'...
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:61)
Running Gradle task 'assembleDebug'...
at org.gradle.wrapper.Install.createDist(Install.java:48)
Running Gradle task 'assembleDebug'...
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
Running Gradle task 'assembleDebug'...
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 120.3s (!)
[!] Gradle threw an error while trying to update itself. Retrying the update...
Running Gradle task 'assembleDebug'...
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: /home/simo/.gradle/wrapper/dists/gradle-5.6.2-all/9st6wgf78h16so49nn74lgtbb/gradle-5.6.2-all.zip
Running Gradle task 'assembleDebug'...
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:61)
Running Gradle task 'assembleDebug'...
at org.gradle.wrapper.Install.createDist(Install.java:48)
Running Gradle task 'assembleDebug'...
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
Running Gradle task 'assembleDebug'...
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 120.2s (!)
[!] Gradle threw an error while trying to update itself. Retrying the update...
Gradle task assembleDebug failed with exit code 1
该如何解决?先感谢您 !
当我运行该命令时: flutter run -v --enable-software-rendering
[ +15 ms] executing: [/home/simo/flutter/] git -c log.showSignature=false log
-n 1 --pretty=format:%H
[ +25 ms] Exit code 0 from: git -c log.showSignature=false log -n 1
--pretty=format:%H
[ ] 0b8abb4724aa590dd0f429683339b1e045a1594d
[ ] executing: [/home/simo/flutter/] git describe --match v*.*.*
--first-parent --long --tags
[ +6 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long
--tags
[ ] v1.12.13+hotfix.8-0-g0b8abb472
[ +7 ms] executing: [/home/simo/flutter/] git rev-parse --abbrev-ref
--symbolic @{u}
[ +6 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/stable
[ ] executing: [/home/simo/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
[ +42 ms] executing: [/home/simo/flutter/] git rev-parse --abbrev-ref HEAD
[ +9 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] stable
[ +83 ms] executing: /home/simo/Android/Sdk/platform-tools/adb devices -l
[ +10 ms] Exit code 0 from: /home/simo/Android/Sdk/platform-tools/adb devices
-l
[ ] List of devices attached
emulator-5554 device product:sdk_gphone_x86
model:Android_SDK_built_for_x86 device:generic_x86 transport_id:1
[ +16 ms] /home/simo/Android/Sdk/platform-tools/adb -s emulator-5554 shell
getprop
[ +33 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required,
skipping update.
[ +2 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required,
skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping
update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping
update.
[ +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required,
skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping
update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping
update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required,
skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required,
skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required,
skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required,
skipping update.
[ +124 ms] Generating
/home/simo/Documents/first_app_flutter/android/app/src/main/java/io/flutter/plug
ins/GeneratedPluginRegistrant.java
[ +23 ms] ro.hardware = ranchu
[ +31 ms] Using software rendering with device Android SDK built for x86. You
may get
better performance with hardware mode by configuring hardware
rendering for your
device.
[ +16 ms] Launching lib/main.dart on Android SDK built for x86 in debug mode...
[ +10 ms] executing: /home/simo/Android/Sdk/platform-tools/adb -s emulator-5554
shell -x logcat -v time -t 1
[ +25 ms] Exit code 0 from: /home/simo/Android/Sdk/platform-tools/adb -s
emulator-5554 shell -x logcat -v time -t 1
[ ] --------- beginning of system
02-19 13:26:36.363 W/AppOps ( 2133): Noting op not finished: uid
10102 pkg com.google.android.gms code 41 time=1582115190374
duration=0
[ +7 ms] executing: /home/simo/Android/Sdk/platform-tools/adb version
[ ] executing: /home/simo/Android/Sdk/platform-tools/adb -s emulator-5554
logcat -v time -T 02-19 13:26:36.363
[ +26 ms] Android Debug Bridge version 1.0.41
Version 29.0.5-5949299
Installed as /home/simo/Android/Sdk/platform-tools/adb
[ +2 ms] executing: /home/simo/Android/Sdk/platform-tools/adb start-server
[ +11 ms] Building APK
[ +18 ms] Running Gradle task 'assembleDebug'...
[ +1 ms] gradle.properties already sets `android.enableR8`
[ +2 ms] Using gradle from
/home/simo/Documents/first_app_flutter/android/gradlew.
[ +8 ms] executing: /home/simo/android-studio/jre/bin/java -version
[ +52 ms] Exit code 0 from: /home/simo/android-studio/jre/bin/java -version
[ ] openjdk version "1.8.0_202-release"
OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
OpenJDK 64-Bit Server VM (build 25.202-b49-5587405, mixed mode)
[ +3 ms] executing: [/home/simo/Documents/first_app_flutter/android/]
/home/simo/Documents/first_app_flutter/android/gradlew -Pverbose=true
-Ptarget=/home/simo/Documents/first_app_flutter/lib/main.dart
-Ptrack-widget-creation=true -Pfilesystem-scheme=org-dartlang-root
-Ptarget-platform=android-x86 assembleDebug
[ +145 ms] Downloading
https://services.gradle.org/distributions/gradle-5.6.2-all.zip
答案 0 :(得分:1)
虽然这个问题是 1 年前的问题,但我会为那些将要面对这个问题的人分享我的经验。
我也遇到了这个问题,我尝试了以下步骤,它对我有用。
flutter clean
flutter run