'Could not resolve all files for configuration ':app:androidApis'
CONFIGURE SUCCESSFUL in 1s
Calling mockable JAR artifact transform to create file: C:\Users...gradle\caches\transforms-1\files-1.1\android.jar\637e2bccbff6bd0f7a7583f7e9d4551b\android.jar with input C:\Users...\AppData\Local\Android\Sdk\platforms\android-28\android.jar
Gradle sync failed: Could not resolve all files for configuration ':app:androidApis'. Failed to transform file 'android.jar' to match attributes {artifactType=android-mockable-jar, returnDefaultValues=false} using transform MockableJarTransform
Cannot create mockable android.jar zip file is empty
I am new to android studio. I have tried all the answers I could get none worked. I changed my gradle plugin to 3.1.1 and lower is still the same thing. I have clean build and invalidate cache/reset.
Do I have to install a lower android studio. Why is this happening for a new project? Andriod studio 3.2.1
Solution 1:[1]
@Openwell thanks a lot. you save my day!
I found the source of the problem. I noticed that the andriod.jar file in C:\Users**\AppData\Local\Android\Sdk\platforms\android-28 was missing, the file was 0kb. which shouldn't be so. So I reinstalled the Android SDK platform and sources by uninstalling it from SDK Manager and installed it back. then the problem was solved.
Solution 2:[2]
I just changed the compiled version to API level to which I have downloaded in the SDK Manager. For me in File=>Project Structure, the compiled version is set to 29 which I haven't downloaded SDK. So I changed it to 28 which I have downloaded.Then it worked.
Solution 3:[3]
After upgrading AndroidStudio version to 4.1, also upgraded Android Gradle plugin to 4.1.0.
But in Project root folder build.gradle file, In dependencies, it has this below gradle classpath for com.google.gms:google-services version as 4.3.0. Caused the issue.
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.google.gms:google-services:4.3.0'
}
after upgrading com.google.gms:google-services to latest version, and Sync project.
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.google.gms:google-services:4.3.4'
}
Solved the issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kevin Yuan |
| Solution 2 | Bharath |
| Solution 3 | praveenb |
