12

When I try to launch my app in Android Studio emulator I get this error:

    Could not find com.android.tools.build:aapt2:3.3.2-5309881.
Searched in the following locations:
  - file:/C:/Users/jalal/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881.pom
  - file:/C:/Users/jalal/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881-windows.jar
  - file:/C:/Users/jalal/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881.pom
  - file:/C:/Users/jalal/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881-windows.jar
  - file:/C:/Users/jalal/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881.pom
  - file:/C:/Users/jalal/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881-windows.jar
  - https://jitpack.io/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881.pom
  - https://jitpack.io/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881-windows.jar
  - https://jcenter.bintray.com/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881.pom
  - https://jcenter.bintray.com/com/android/tools/build/aapt2/3.3.2-5309881/aapt2-3.3.2-5309881-windows.jar
Required by:
    project :app
Onur A.
  • 3,007
  • 3
  • 22
  • 37
kingjalal
  • 133
  • 1
  • 1
  • 8

3 Answers3

33

add the google() in build.gradle

allprojects {
    repositories {
     google()  -->add this line 
     jcenter()   
    }
Mudassir Khan
  • 1,714
  • 1
  • 20
  • 25
10

I had to add the google() in two places to solve this

The path is <applicationName>\build.gradle. Note that there is another one which should not be confused with - <applicationName>\app\build.gradle.

1.

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

2.

allprojects {
    repositories {
        jcenter()
        google()
    }
}
James Poulose
  • 3,569
  • 2
  • 34
  • 39
3

Hi, I solved this way.. in the project directory

android>build.gradle

classpath 'com.android.tools.build:gradle:3.0.1'

android>app>build.gradle

android {
    buildToolsVersion "28.0.3"
}
ahmedfeyzi
  • 51
  • 3