java - 任务:url_launcher:testDebugUnitTest FAILED for flutter app
问题描述
Flutter 应用程序运行良好,但某些单元测试失败。然后当我cd android
运行
时./gradlew build
,我得到如下所示的错误。
我尝试过更改 url_launcher 的版本,切换 gradle 版本,清理和重建,但这并没有帮助。
目前在 url_launcher:^5.7.10
> Configure project :app
WARNING: The option setting 'android.enableR8=true' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
> Task :flutter_plugin_android_lifecycle:compileDebugJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :google_maps_flutter:compileDebugJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 warnings
> Task :google_sign_in:compileDebugJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :location_web:compileDebugJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :shared_preferences:compileDebugJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :url_launcher:compileDebugJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :app:stripDebugDebugSymbols
Unable to strip the following libraries, packaging them as they are: libflutter.so.
> Task :flutter_plugin_android_lifecycle:compileProfileJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :google_sign_in:compileProfileJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :location_web:compileProfileJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :google_maps_flutter:compileProfileJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 warnings
> Task :shared_preferences:compileProfileJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :url_launcher:compileProfileJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :app:stripProfileDebugSymbols
Unable to strip the following libraries, packaging them as they are: libapp.so, libflutter.so.
> Task :flutter_plugin_android_lifecycle:compileReleaseJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :google_maps_flutter:compileReleaseJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 warnings
> Task :google_sign_in:compileReleaseJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :location_web:compileReleaseJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :shared_preferences:compileReleaseJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :url_launcher:compileReleaseJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :app:lint
Ran lint on variant debug: 6 issues found
Ran lint on variant release: 5 issues found
Ran lint on variant profile: 5 issues found
Wrote HTML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/app/reports/lint-results.html
Wrote XML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/app/reports/lint-results.xml
> Task :app:stripReleaseDebugSymbols
Unable to strip the following libraries, packaging them as they are: libapp.so, libflutter.so.
> Task :cloud_firestore:lint
Ran lint on variant debug: 2 issues found
Ran lint on variant release: 1 issues found
Ran lint on variant profile: 1 issues found
Wrote HTML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/cloud_firestore/reports/lint-results.html
Wrote XML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/cloud_firestore/reports/lint-results.xml
> Task :firebase_auth:lint
Ran lint on variant debug: 2 issues found
Ran lint on variant release: 2 issues found
Ran lint on variant profile: 2 issues found
Wrote HTML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/firebase_auth/reports/lint-results.html
Wrote XML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/firebase_auth/reports/lint-results.xml
> Task :firebase_core:lint
Ran lint on variant debug: 2 issues found
Ran lint on variant release: 2 issues found
Ran lint on variant profile: 2 issues found
Wrote HTML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/firebase_core/reports/lint-results.html
Wrote XML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/firebase_core/reports/lint-results.xml
> Task :flutter_plugin_android_lifecycle:lint
Ran lint on variant debug: 2 issues found
Ran lint on variant release: 2 issues found
Ran lint on variant profile: 2 issues found
Wrote HTML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/flutter_plugin_android_lifecycle/reports/lint-results.html
Wrote XML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/flutter_plugin_android_lifecycle/reports/lint-results.xml
> Task :flutter_plugin_android_lifecycle:compileDebugUnitTestJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :flutter_plugin_android_lifecycle:testDebugUnitTest
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.mockito.cglib.core.ReflectUtils$2 (file:/Users/abcd/.gradle/caches/transforms-2/files-2.1/678b863a0873dc8bc82b19aa32b3766a/jetified-mockito-core-1.10.19.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.mockito.cglib.core.ReflectUtils$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
> Task :flutter_plugin_android_lifecycle:compileProfileUnitTestJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :flutter_plugin_android_lifecycle:testProfileUnitTest
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.mockito.cglib.core.ReflectUtils$2 (file:/Users/abcd/.gradle/caches/transforms-2/files-2.1/678b863a0873dc8bc82b19aa32b3766a/jetified-mockito-core-1.10.19.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.mockito.cglib.core.ReflectUtils$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
> Task :flutter_plugin_android_lifecycle:compileReleaseUnitTestJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :flutter_plugin_android_lifecycle:testReleaseUnitTest
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.mockito.cglib.core.ReflectUtils$2 (file:/Users/abcd/.gradle/caches/transforms-2/files-2.1/678b863a0873dc8bc82b19aa32b3766a/jetified-mockito-core-1.10.19.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.mockito.cglib.core.ReflectUtils$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
> Task :google_maps_flutter:lint
Ran lint on variant debug: 4 issues found
Ran lint on variant release: 4 issues found
Ran lint on variant profile: 4 issues found
Wrote HTML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/google_maps_flutter/reports/lint-results.html
Wrote XML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/google_maps_flutter/reports/lint-results.xml
> Task :google_maps_flutter:compileDebugUnitTestJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :google_maps_flutter:testDebugUnitTest
Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
> Task :google_maps_flutter:compileProfileUnitTestJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :google_maps_flutter:testProfileUnitTest
Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
> Task :google_maps_flutter:compileReleaseUnitTestJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :google_maps_flutter:testReleaseUnitTest
Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
> Task :google_sign_in:lint
Ran lint on variant debug: 3 issues found
Ran lint on variant release: 3 issues found
Ran lint on variant profile: 3 issues found
Wrote HTML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/google_sign_in/reports/lint-results.html
Wrote XML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/google_sign_in/reports/lint-results.xml
> Task :location:lint
Ran lint on variant debug: 7 issues found
Ran lint on variant release: 7 issues found
Ran lint on variant profile: 7 issues found
Wrote HTML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/location/reports/lint-results.html
Wrote XML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/location/reports/lint-results.xml
> Task :location_web:lint
Ran lint on variant debug: 1 issues found
Ran lint on variant release: 1 issues found
Ran lint on variant profile: 1 issues found
Wrote HTML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/location_web/reports/lint-results.html
Wrote XML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/location_web/reports/lint-results.xml
> Task :shared_preferences:lint
Ran lint on variant debug: 9 issues found
Ran lint on variant release: 9 issues found
Ran lint on variant profile: 9 issues found
Wrote HTML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/shared_preferences/reports/lint-results.html
Wrote XML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/shared_preferences/reports/lint-results.xml
> Task :url_launcher:lint
Ran lint on variant debug: 4 issues found
Ran lint on variant release: 4 issues found
Ran lint on variant profile: 4 issues found
Wrote HTML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/url_launcher/reports/lint-results.html
Wrote XML report to file:///Users/abcd/AndroidStudioProjects/project_n/build/url_launcher/reports/lint-results.xml
> Task :url_launcher:compileDebugUnitTestJavaWithJavac
warning: [options] source value 7 is obsolete and will be removed in a future release
warning: [options] target value 7 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
> Task :url_launcher:testDebugUnitTest
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.robolectric.util.ReflectionHelpers$6 (file:/Users/abcd/.gradle/caches/transforms-2/files-2.1/b6456734fcbe0dfa99a1c0273f7fb70c/jetified-shadowapi-4.3.jar) to method java.lang.ClassLoader.getPackage(java.lang.String)
WARNING: Please consider reporting this to the maintainers of org.robolectric.util.ReflectionHelpers$6
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
io.flutter.plugins.urllauncher.MethodCallHandlerImplTest > stopListening_doesNothingWhenUnset FAILED
java.lang.RuntimeException at ReflectionHelpers.java:223
Caused by: java.lang.RuntimeException at ReflectionHelpers.java:208
Caused by: java.lang.IllegalAccessException at UnsafeFieldAccessorImpl.java:76
io.flutter.plugins.urllauncher.MethodCallHandlerImplTest > stopListening_unregistersExistingChannel FAILED
java.lang.RuntimeException at ReflectionHelpers.java:223
Caused by: java.lang.RuntimeException at ReflectionHelpers.java:208
Caused by: java.lang.IllegalAccessException at UnsafeFieldAccessorImpl.java:76
io.flutter.plugins.urllauncher.MethodCallHandlerImplTest > startListening_unregistersExistingChannel FAILED
java.lang.RuntimeException at ReflectionHelpers.java:223
Caused by: java.lang.RuntimeException at ReflectionHelpers.java:208
Caused by: java.lang.IllegalAccessException at UnsafeFieldAccessorImpl.java:76
io.flutter.plugins.urllauncher.MethodCallHandlerImplTest > onMethodCall_closeWebView FAILED
java.lang.RuntimeException at ReflectionHelpers.java:223
Caused by: java.lang.RuntimeException at ReflectionHelpers.java:208
Caused by: java.lang.IllegalAccessException at UnsafeFieldAccessorImpl.java:76
io.flutter.plugins.urllauncher.MethodCallHandlerImplTest > onMethodCall_canLaunchReturnsFalse FAILED
java.lang.RuntimeException at ReflectionHelpers.java:223
Caused by: java.lang.RuntimeException at ReflectionHelpers.java:208
Caused by: java.lang.IllegalAccessException at UnsafeFieldAccessorImpl.java:76
io.flutter.plugins.urllauncher.MethodCallHandlerImplTest > onMethodCall_launchReturnsNoActivityError FAILED
java.lang.RuntimeException at ReflectionHelpers.java:223
Caused by: java.lang.RuntimeException at ReflectionHelpers.java:208
Caused by: java.lang.IllegalAccessException at UnsafeFieldAccessorImpl.java:76
io.flutter.plugins.urllauncher.MethodCallHandlerImplTest > startListening_registersChannel FAILED
java.lang.RuntimeException at ReflectionHelpers.java:223
Caused by: java.lang.RuntimeException at ReflectionHelpers.java:208
Caused by: java.lang.IllegalAccessException at UnsafeFieldAccessorImpl.java:76
io.flutter.plugins.urllauncher.MethodCallHandlerImplTest > onMethodCall_launchReturnsTrue FAILED
java.lang.RuntimeException at ReflectionHelpers.java:223
Caused by: java.lang.RuntimeException at ReflectionHelpers.java:208
Caused by: java.lang.IllegalAccessException at UnsafeFieldAccessorImpl.java:76
io.flutter.plugins.urllauncher.MethodCallHandlerImplTest > onMethodCall_launchReturnsActivityNotFoundError FAILED
java.lang.RuntimeException at ReflectionHelpers.java:223
Caused by: java.lang.RuntimeException at ReflectionHelpers.java:208
Caused by: java.lang.IllegalAccessException at UnsafeFieldAccessorImpl.java:76
io.flutter.plugins.urllauncher.MethodCallHandlerImplTest > onMethodCall_canLaunchReturnsTrue FAILED
java.lang.RuntimeException at ReflectionHelpers.java:223
Caused by: java.lang.RuntimeException at ReflectionHelpers.java:208
Caused by: java.lang.IllegalAccessException at UnsafeFieldAccessorImpl.java:76
10 tests completed, 10 failed
> Task :url_launcher:testDebugUnitTest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':url_launcher:testDebugUnitTest'.
> There were failing tests. See the report at: file:///Users/abcd/AndroidStudioProjects/project_n/build/url_launcher/reports/tests/testDebugUnitTest/index.html
* 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 6m 56s
971 actionable tasks: 898 executed, 73 up-to-date
为什么会这样?url_launcher 包有问题吗?我该如何解决这个问题?
解决方案
推荐阅读
- python - 从源代码还是通过 Pip 安装 OpenCV?
- java - 如何在 java 流中仅查找和匹配一个元素列表?
- angular - RxJS operator with array
- visual-studio-code - VSCode链接票证/自定义规则?
- java - ViewPager2#onpageselect StackOverflowError
- asp.net-core-webapi - 使用WebApi接口用pkce流实现IdentityServer是真的吗
- elasticsearch - 有没有办法在 Kibana 中更改文档的默认视图?
- spring-boot - 无法在关闭的连接上调用方法,在连接 tera 数据池的理想时间后面临此问题
- php - PHP shell_exec 一段时间后返回空字符串
- python - 从存储桶(Google Cloud Storage)获取文件类型 json 以上传并保存在 VM 实例中