-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,173
  • 68
  • 59
  • 86
MedCh
  • 56
  • 2
  • 3
0

Run this in the console: flutter clean

General Grievance
  • 4,259
  • 21
  • 28
  • 43