Android Studio 3.2 - Could not find com.android.tools.build:aapt2:3.2.0-4818971

前端 未结 6 529
一向
一向 2020-12-05 12:50

I was following a tutorial to develop icon pack for android and when I imported the project I got several errors and it was solved here - Gradle Version 4.6 - Absolute path

相关标签:
6条回答
  • 2020-12-05 13:15

    see the dependencies of module :licensing and use com.android.tools.build:aapt2:3.2.0 (or even "com.android.tools.build:aapt2:3.2.0:windows") there, which is the final version ...that 4818971 version should ordinary come with an alpha prefix/suffix (the version number seems to be incorrect). maybe adding repository google() might be required, too. ordinary, that dependency should be present; removing that dependency might be another possible option.

    0 讨论(0)
  • 2020-12-05 13:22

    Most likely you do not have the Google repository in your project's build.gradle file. Add google() in BOTH locations as shown below:

    buildscript {
    
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.2.0'
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    
    0 讨论(0)
  • 2020-12-05 13:27

    I was able to solve the issue by adding google() in both locations:

    File -> Project Structure -> Project -> *Now add ", google()" in

    Android Plugin Repository

    and

    Default Library Repository

    *

    0 讨论(0)
  • 2020-12-05 13:33

    For those people who still face exactly the same problem even after adding two google to BOTH positions in relevant gradle file.I would suggest you to check Android Studio -> Preferences -> HTTP Proxy page.
    If you find it says some warnings like "...have set JVM proxy to 127.0.0.1".Then you should consider vpn-related issues which depends on your context.
    If your desktop is MacOS, then go to Network setting page, advance->proxy tab,uncheck all the checkbox there.
    Back to your IDE as following steps: Android Studio->File->Invalidate Caches/Restart.After that,go back to check Android Studio -> Preferences -> HTTP Proxy page again,previous warnings should be gone.Run again.

    0 讨论(0)
  • 2020-12-05 13:37

    When you upgrade to 4.6 version of gradle. You need following upgrades too. Gradle Plugin Release page.

    1. Android Studio 3.+

    You need Android Studio version 3.+ to have 4.6 version of gradle. At the time of post latest release was 3.2.1. You can see latest release on this page.

    2. Gradle Plugin 3.1.+

    You need 3.1.+ gradle plugin for gradle-4.6 support. Check in project level build.gradle.

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

    At the time of post latest version was 3.2.1. You can see latest release here.

    3. Add Google Maven Library

    You need to add Google Maven library to project level build.gradle like below code.

    buildscript {
        repositories {
            google()
            ...
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.2.1'
            ...
        }
    }
    
    allprojects {
        repositories {
            google()
            ...
        }
    }
    
    0 讨论(0)
  • 2020-12-05 13:39

    I solved my issue by upgrading my classpath from

        'com.google.gms:google-services:4.0.0
    

    to

        'com.google.gms:google-services:4.2.0'
    

    hope this helps

    0 讨论(0)
提交回复
热议问题