Build failed due to url_launcher_android flutter?

Viewed 16

In my pubspec.yml I didn't add any library named url_launcher. But, In somewhere some library might be used this, that I don't know.

And, after

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

I got following exception in build.

> 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'.

app level gradle

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
        }
    }
}
1 Answers

Android # Add any URL schemes passed to canLaunchUrl as entries in your AndroidManifest.xml, otherwise, it will return false in most cases starting on Android 11 (API 30) or higher. A element must be added to your manifest as a child of the root element.

<!-- 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>

Related