Zum Inhalt springen →

Flutter – Failed to download the Android dependencies

Nachdem ich in den letzen Tagen immer wieder Problem mit Flutter hatte, habe ich heute morgen entscheiden, Flutter mal ganz neu zu installieren. Dabei bin ich exakt wie unter https://flutter.dev/docs/get-started/install/macos beschrieben vorgegangen und bis zu Schritt 4 (Optionally, pre-download development binaries:) gekommen.

Der Befehl flutter precache ist immer wieder mit der Fehlermeldung „Failed to download the Android dependencies“ abgebrochen. Jetzt kann man natürlich sagen, OK, der Schritt ist ja optional, aber leider ist er das nicht wirklich. Lässt man den Schritt hier weg, landet man spätestens beim kompilieren einer Flutter App wieder bei dem Problem.

Um etwas mehr details über das Problem zu bekommen habe ich dann den Befehl „flutter precache“ mal mit der „Verbose“ Option gestartet und mir mal angesehen, was da im Detail falsch läuft.

/Users/michaeljentsch/flutter/packages/flutter_tools/gradle/resolve_dependencies.gradle --project-cache-dir
/var/folders/h2/nvjvcl052qz0nmh109r7yl9r0000gn/T/flutter_gradle_wrapper.aOzCvl resolveDependencies
  [+95070 ms]  FAILURE: Build failed with an exception. 

Da ist also das Problem. Gradle kann die Abhängigkeiten nicht richtig auflösen. Dann werde ich wohl mal versuchen, den Gradle cache zu löschen . Evtl. ist da eine Datei defekt.

Ein erster Blick in den Gradle cache sagt mir, dass dort ca. 800MB Zeug drin ist.

  Michaels-Air-9:caches michaeljentsch$ pwd
 /Users/michaeljentsch/.gradle/caches
 Michaels-Air-9:caches michaeljentsch$ du -sh .
 802M . 

Also dann weg damit:

 Michaels-Air-9:caches michaeljentsch$ pwd
 /Users/michaeljentsch/.gradle/caches
 Michaels-Air-9:caches michaeljentsch$ rm -rf *
 Michaels-Air-9:caches michaeljentsch$  

Und direkt noch mal flutter precache aufrufen. Mal sehen, was passiert …..

Vorerst sieht es ja ganz gut aus.

 Michaels-Air-9:~ michaeljentsch$ flutter precache
 Downloading Android Maven dependencies...                 ⣟ 

Jetzt ist etwas Geduld angesagt. Aber it ein wenig Glück funktioniert dann wieder alles ganz normal. Falls nicht, währe wohl der nächste Schritt mal Android Studio neu zu installieren. Darauf habe ich aber eigentlich keine Lust .

Mist!

 Michaels-Air-9:~ michaeljentsch$ flutter precache
 Failed to download the Android dependencies                             
 Downloading Android Maven dependencies...               95,5s 

OK, bevor ich Android Studio neu installiere, sehe ich mir den Fehler lieber noch mal genauer an.

 
 
 
 
 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #f2f2f2; background-color: #000000} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Menlo; color: #f2f2f2; background-color: #000000; min-height: 14.0px} span.s1 {font-variant-ligatures: no-common-ligatures} 
 * Where:
                      Build file '/Users/michaeljentsch/flutter/packages/flutter_tools/gradle/resolve_dependencies.gradle' line: 61
 

                      * What went wrong:
                      A problem occurred evaluating root project 'gradle'.
                      > Could not resolve all files for configuration ':flutterDebug'.
                         > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
                           Required by:
                               project :
                            > Could not resolve io.flutter:flutter_embedding_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
                               > Could not get resource
                               'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_debug-1
                               .0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom'.
                                  > Could not GET
                                  'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_debu
                                  g-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom'.
                                     > Connect to 149.232.149.2:82 [/149.232.149.2] failed: connect timed out
                         > Could not resolve io.flutter:armeabi_v7a_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
                           Required by:
                               project :
                            > Could not resolve io.flutter:armeabi_v7a_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
                               > Could not get resource
                               'http://download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/armeabi_v7a_debug-1.0.0-e1e6ced
                               81d029258d449bdec2ba3cddca9c2ca0c.pom'.
                                  > Could not GET
                                  'http://download.flutter.io/io/flutter/armeabi_v7a_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/armeabi_v7a_debug-1.0.0-e1e6
                                  ced81d029258d449bdec2ba3cddca9c2ca0c.pom'.
                                     > Connect to 149.232.149.2:82 [/149.232.149.2] failed: connect timed out
                         > Could not resolve io.flutter:arm64_v8a_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
                           Required by:
                               project :
                            > Could not resolve io.flutter:arm64_v8a_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
                               > Could not get resource
                               'http://download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/arm64_v8a_debug-1.0.0-e1e6ced81d0
                               29258d449bdec2ba3cddca9c2ca0c.pom'.
                                  > Could not GET
                                  'http://download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/arm64_v8a_debug-1.0.0-e1e6ced8
                                  1d029258d449bdec2ba3cddca9c2ca0c.pom'.
                                     > Connect to 149.232.149.2:82 [/149.232.149.2] failed: connect timed out
                         > Could not resolve io.flutter:x86_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
                           Required by:
                               project :
                            > Skipped due to earlier error
                         > Could not resolve io.flutter:x86_64_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
                           Required by:
                               project :
                            > Could not resolve io.flutter:x86_64_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
                               > Could not get resource
                               'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/x86_64_debug-1.0.0-e1e6ced81d029258d
                               449bdec2ba3cddca9c2ca0c.pom'.
                                  > Could not GET
                                  'http://download.flutter.io/io/flutter/x86_64_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/x86_64_debug-1.0.0-e1e6ced81d0292
                                  58d449bdec2ba3cddca9c2ca0c.pom'.
                                     > Connect to 149.232.149.2:82 [/149.232.149.2] failed: connect timed out
 

                      * 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
 

                      BUILD FAILED in 1m 34s 

Da sind je eine Menge URLs, enthalten, die nicht heruntergeladen werden konnten. Evtl. liegt es doch nicht an mir ….. Also mal sehen.

Folgender URL „http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_debug-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom“ konnte nicht heruntergeladen werden. Im Browser geht es aber. Der Inhalt der Datei sieht auch gut aus:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>io.flutter</groupId>
  <artifactId>flutter_embedding_debug</artifactId>
  <version>1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c</version>
  <packaging>jar</packaging>
  <dependencies>
    
    <dependency>
      <groupId>android.arch.lifecycle</groupId>
      <artifactId>common</artifactId>
      <version>1.1.1</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>android.arch.lifecycle</groupId>
      <artifactId>common-java8</artifactId>
      <version>1.1.1</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>android.arch.lifecycle</groupId>
      <artifactId>runtime</artifactId>
      <version>1.1.1</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-fragment</artifactId>
      <version>28.0.0</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-annotations</artifactId>
      <version>28.0.0</version>
      <scope>compile</scope>
    </dependency>

  </dependencies>
</project>

Was ist da schief gelaufen? Evtl. sind es die Proxy Einstellungen in den gradle.properties?

Tatsächlich hat dort „Irgendwer“ einen Proxy Server eingetragen. So ein Mist. Also dann die beiden Zeilen …

 systemProp.http.proxyHost=XXX.XXX.XXX.XXX
 systemProp.http.proxyPort=XX 

… entfernt und noch mal den Befehl flutter precache aufgerufen.

Das war die Lösung.

Zum Glück nur eine Kleinigkeit :-), die mich aber ganz schön aufgehalten hat. Als nächstes noch mal testen, ob ich nun auch im Android Studio mein Flutter Projekt kompilieren kann.

Launching lib/main.dart on AOSP on IA Emulator in debug mode…
 Running Gradle task 'assembleDebug'…
 ✓ Built build/app/outputs/apk/debug/app-debug.apk.
 Installing build/app/outputs/apk/app.apk…

So gefällt mir das. 🙂

Läuft wieder. Also dann weiter mit dem Coden.

Veröffentlicht in Allgemein