当前位置:   article > 正文

Flutter 启动时 gradle 的错误_could not open settings generic class cache for se

could not open settings generic class cache for settings file

Flutter 启动时 gradle 的错误

错误内容

在启动一个 Flutter 项目时,遇到了 gradle 相关的错误,具体错误信息如下:

* What went wrong:
Could not open settings remapped class cache for 3gvp67rxesfd2nfkbvtuzjg3o (C:\Users\&unser_name%\.gradle\caches\5.6.2\scripts-remapped\settings_3j4cktj76tcwqa3p6pnijdwdi\3gvp67rxesfd2nfkbvtuzjg3o\settings8410a2d21ed2f87c8a0398566330ee52).
> Could not open settings generic class cache for settings file 'C:\Users\Administrator\AndroidStudioProjects\flutter_app\android\settings.gradle' (C:\Users\Administrator\.gradle\caches\5.6.2\scripts\3gvp67rxesfd2nfkbvtuzjg3o\settings\settings8410a2d21ed2f87c8a0398566330ee52).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 57

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Finished with error: Gradle task assembleDebug failed with exit code 1
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

对我无效的解决方案

有的资料说删除.gradle/caches可以解决问题,没用。

有的说删除项目文件夹下andoird/build.gradleandroid/settings.gradle以及android/app/build.gradle三个文件中关于package的行。然而我的这三个文件中并没有相关行……当然也就没有任何卵用。

有效的解决方案

看了很多资料后尝试将现在使用的 JDK 从java 13改为java 8,问题得到了解决。

运行得到正确的结果:

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'...                                  
Running Gradle task 'assembleDebug'... Done                        68.0s
√ Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...                         1.8s
D/FlutterActivity( 8673): Using the launch theme as normal theme.
D/FlutterActivityAndFragmentDelegate( 8673): Setting up FlutterEngine.
D/FlutterActivityAndFragmentDelegate( 8673): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.
D/FlutterActivityAndFragmentDelegate( 8673): Attaching FlutterEngine to the Activity that owns this Fragment.
D/FlutterView( 8673): Attaching to a FlutterEngine: io.flutter.embedding.engine.FlutterEngine@4bf553e
D/FlutterActivityAndFragmentDelegate( 8673): Executing Dart entrypoint: main, and sending initial route: /
D/EGL_emulation( 8673): eglMakeCurrent: 0xeed7fbe0: ver 2 0 (tinfo 0xe3bd5bb0)
D/eglCodecCommon( 8673): setVertexArrayObject: set vao to 0 (0) 1 0     
I/m.example.myap( 8673): NativeAlloc concurrent copying GC freed 1908(215KB) AllocSpace objects, 3(60KB) LOS objects, 57% free, 1114KB/2650KB, paused 653us total 486.487ms
I/OpenGLRenderer( 8673): Davey! duration=1832ms; Flags=1, IntendedVsync=4010927657182, Vsync=4010994323846, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=4010999132700, AnimationStart=4010999214400, PerformTraversalsStart=4010999287600, DrawStart=4012168475900, SyncQueued=4012173764500, SyncStart=4012175660200, IssueDrawCommandsStart=4012179313100, SwapBuffers=4012455218300, FrameCompleted=4012761766600, DequeueBufferDuration=161026000, QueueBufferDuration=513000,
I/Choreographer( 8673): Skipped 107 frames!  The application may be doing too much work on its main thread.
D/EGL_emulation( 8673): eglMakeCurrent: 0xe3b242a0: ver 2 0 (tinfo 0xe3b8cb90)
Syncing files to device Android SDK built for x86...
D/eglCodecCommon( 8673): setVertexArrayObject: set vao to 0 (0) 1 0
Syncing files to device Android SDK built for x86...             9,633ms (!)
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/841772
推荐阅读
相关标签