Home > Software engineering >  Why I get this error when adding `url_launcher: ^6.1.5` to flutter app?
Why I get this error when adding `url_launcher: ^6.1.5` to flutter app?

Time:08-14

I've created a new flutter project and added url_launcher: ^6.1.5 to yaml file as dependency, when I run the app I get the following error. I have only this dependency. Checked different VPNs, Can open and download the jar files in Chrome, but still with no clue and can't run the app.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':url_launcher_android'.
> Could not resolve all files for configuration ':url_launcher_android:classpath'.
   > Could not find gradle-3.4.2.jar (com.android.tools.build:gradle:3.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.2/gradle-3.4.2.jar
   > Could not find builder-3.4.2.jar (com.android.tools.build:builder:3.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.4.2/builder-3.4.2.jar
   > Could not find tracker-26.4.2.jar (com.android.tools.analytics-library:tracker:26.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/tracker/26.4.2/tracker-26.4.2.jar
   > Could not find shared-26.4.2.jar (com.android.tools.analytics-library:shared:26.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/shared/26.4.2/shared-26.4.2.jar
   > Could not find crash-26.4.2.jar (com.android.tools.analytics-library:crash:26.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/26.4.2/crash-26.4.2.jar
   > Could not find lint-gradle-api-26.4.2.jar (com.android.tools.lint:lint-gradle-api:26.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.4.2/lint-gradle-api-26.4.2.jar        
   > Could not find gradle-api-3.4.2.jar (com.android.tools.build:gradle-api:3.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-api/3.4.2/gradle-api-3.4.2.jar
   > Could not find databinding-compiler-common-3.4.2.jar (androidx.databinding:databinding-compiler-common:3.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler-common/3.4.2/databinding-compiler-comm
on-3.4.2.jar
   > Could not find manifest-merger-26.4.2.jar (com.android.tools.build:manifest-merger:26.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/manifest-merger/26.4.2/manifest-merger-26.4.2.jar       
   > Could not find sdk-common-26.4.2.jar (com.android.tools:sdk-common:26.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/sdk-common/26.4.2/sdk-common-26.4.2.jar
   > Could not find builder-test-api-3.4.2.jar (com.android.tools.build:builder-test-api:3.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-test-api/3.4.2/builder-test-api-3.4.2.jar       
   > Could not find ddmlib-26.4.2.jar (com.android.tools.ddms:ddmlib:26.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/ddms/ddmlib/26.4.2/ddmlib-26.4.2.jar
   > Could not find sdklib-26.4.2.jar (com.android.tools:sdklib:26.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/sdklib/26.4.2/sdklib-26.4.2.jar
   > Could not find layoutlib-api-26.4.2.jar (com.android.tools.layoutlib:layoutlib-api:26.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/layoutlib/layoutlib-api/26.4.2/layoutlib-api-26.4.2.jar       
   > Could not find dvlib-26.4.2.jar (com.android.tools:dvlib:26.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/dvlib/26.4.2/dvlib-26.4.2.jar
   > Could not find repository-26.4.2.jar (com.android.tools:repository:26.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/repository/26.4.2/repository-26.4.2.jar
   > Could not find common-26.4.2.jar (com.android.tools:common:26.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/common/26.4.2/common-26.4.2.jar
   > Could not find bundletool-0.7.2.jar (com.android.tools.build:bundletool:0.7.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/0.7.2/bundletool-0.7.2.jar
   > Could not find protos-26.4.2.jar (com.android.tools.analytics-library:protos:26.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/26.4.2/protos-26.4.2.jar
   > Could not find builder-model-3.4.2.jar (com.android.tools.build:builder-model:3.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-model/3.4.2/builder-model-3.4.2.jar
   > Could not find apkzlib-3.4.2.jar (com.android.tools.build:apkzlib:3.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/apkzlib/3.4.2/apkzlib-3.4.2.jar
   > Could not find apksig-3.4.2.jar (com.android.tools.build:apksig:3.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/apksig/3.4.2/apksig-3.4.2.jar
   > Could not find annotations-26.4.2.jar (com.android.tools:annotations:26.4.2).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/annotations/26.4.2/annotations-26.4.2.jar
   > Could not find databinding-common-3.4.2.jar (androidx.databinding:databinding-common:3.4.2).

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

BUILD FAILED in 2s
Running Gradle task 'assembleDebug'...                              3.9s
Exception: Gradle task assembleDebug failed with exit code 1

Flutter Doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.19044.1826], locale en-US)
Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK 
version 33.0.0)

** build.gradle**

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

CodePudding user response:

In pubspec.yaml add version of url launcher as any and try again. It should fetch an appropriate version of the package

url_launcher: any

CodePudding user response:

see if this helps you build fail when adding url_launcher to my project

  • Related