gradle 由于url_launcher_android抖动导致构建失败?

enxuqcxy  于 2023-01-02  发布在  Android
关注(0)|答案(1)|浏览(150)

在我的pubspec.yml中,我没有添加任何名为url_launcher的库。但是,在某个地方可能会使用一些库,这一点我不知道。
然后

clean gradle
build gradle(its takes too much time approx. 3 hr.)

生成中出现以下异常。

> Task :url_launcher_android:testDebugUnitTest

io.flutter.plugins.urllauncher.MethodCallHandlerImplTest > stopListening_doesNothingWhenUnset STANDARD_OUT
    Downloading from maven 

io.flutter.plugins.urllauncher.MethodCallHandlerImplTest > stopListening_doesNothingWhenUnset STANDARD_ERROR
    Downloading: org/robolectric/android-all/4.1.2_r1-robolectric-r1/android-all-4.1.2_r1-robolectric-r1.pom from repository sonatype at https://oss.sonatype.org/content/groups/public/
    Transferring 2K from sonatype
    Downloading: org/sonatype/oss/oss-parent/9/oss-parent-9.pom from repository sonatype at https://oss.sonatype.org/content/groups/public/
    Transferring 6K from sonatype
    Downloading: org/robolectric/android-all/4.1.2_r1-robolectric-r1/android-all-4.1.2_r1-robolectric-r1.jar from repository sonatype at https://oss.sonatype.org/content/groups/public/
    Transferring 41879K from sonatype

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

io.flutter.plugins.urllauncher.WebViewActivityTest > extractHeaders_returnsEmptyMapWhenHeadersBundleNull PASSED

11 tests completed, 10 failed

> Task :url_launcher_android:testDebugUnitTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':url_launcher_android:testDebugUnitTest'.

应用程序级别分级

android {
    compileSdkVersion 33
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "abc"
        minSdkVersion 24
        targetSdkVersion 33
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            multiDexEnabled true
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}
slhcrj9b

slhcrj9b1#

Android #将传递给canLaunchUrl的任何URL方案作为条目添加到AndroidManifest.xml中,否则,从Android 11(API 30)或更高版本开始,在大多数情况下,它将返回false。必须将元素作为根元素的子元素添加到清单中。

<!-- Provide required visibility configuration for API level 30 and above -->
<queries>
  <!-- If your app checks for SMS support -->
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="sms" />
  </intent>
  <!-- If your app checks for call support -->
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="tel" />
  </intent>
</queries>

相关问题