Home > Enterprise >  cant run the flutter apps on android studio
cant run the flutter apps on android studio

Time:11-23

i'm going to learn flutter. so i installed the latest version of flutter(Flutter 3.3.8) and make the path of that on windows. then i installed the latest version of android studio(Android Studio Dolphin | 2021.3.1 Patch 1) and installed the flutter plugin and sdk and emulator of api 32 and 29 on it.

also i installed the java jdk and jre v8.

but when i try to run the defult app on emulator in recevied this error on terminal :

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
   > Could not find com.android.tools.build:gradle:7.1.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom
       - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom
     Required by:
         project :

and here it is the result of doctor command of flutter :


C:\Users\new>flutter doctor -v
[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.18363.535], locale en-US)
    • Flutter version 3.3.8 on channel stable at E:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 52b3dc25f6 (9 days ago), 2022-11-09 12:09:26  0800
    • Engine revision 857bd6b74c
    • Dart version 2.18.4
    • DevTools version 2.15.0

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at C:\Users\new\AppData\Local\Android\sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: E:\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.13 0-b1751.21-8125866)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C  " workload, including all of its default components

[√] Android Studio (version 2021.3)
    • Android Studio at E:\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13 0-b1751.21-8125866)

[√] VS Code, 64-bit edition (version 1.71.2)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (3 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 12 (API 32) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.18363.535]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 107.0.5304.107

[√] HTTP Host Availability
    • All required HTTP hosts are available

I would be grateful if you could guide me in solving this problem. thx to all!

build.gradle codes

CodePudding user response:

Add google() to your repositories(buildscript and allprojects sections) of app level build.gradle file. The Android Gradle plugin is located there: your_project_folder/android/build.gradle

buildscript {
  ...
  repositories {
    google()
    mavenCentral()
  }
}

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

CodePudding user response:

after some days and try many ways to solve this problem! found the right solution :

proxy setting was my problem and config that with new proxy settings solve that problem!

thanks everyone.

solved!

  • Related