-1

When i create new flutter project and click run i have this problem

"Could not initialize class com.android.sdklib.repository.AndroidSdkHandler"

enter image description here

Flutter doctor enter image description here

  • Does this answer your question? [Error:Could not initialize class com.android.sdklib.repositoryv2.AndroidSdkHandler](https://stackoverflow.com/questions/37513651/errorcould-not-initialize-class-com-android-sdklib-repositoryv2-androidsdkhandl) – Payam Asefi Feb 10 '22 at 19:33

2 Answers2

0
  1. go to Android/build.gradle.

  2. if jCenter() exist try this change:

    buildscript {
        ext.kotlin_version = '1.3.50'
        repositories {
            google()
          jCenter()   // change this to mavenCentral()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:4.1.0'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        }
    }
    
    allprojects {
        repositories {
            google()
           jCenter()   // change this to mavenCentral()
        }
    }
    
Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
MedCh
  • 355
  • 4
  • 9
0

Run this in the console: flutter clean

General Grievance
  • 4,555
  • 31
  • 31
  • 45