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 包有问题吗?我该如何解决?