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
#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.
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.
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.
Related
I try to build my gradle project and I get the following error:
1:36 PM Gradle sync failed: Unable to make field private static final java.util.Map java.lang.ProcessEnvironment.theCaseInsensitiveEnvironment accessible: module java.base does not "opens java.lang" to unnamed module #7d417077 (5 s 556 ms)
build.gradle file
and no, I do not know gradle and no I am not planning on learning it, but I have no chioce. Thanks in advance
I've had a similar problem with an old BungeeCord plugin, which used Gradle 4.10. In my case - it seems like that old Gradle doesn't work properly with Java 16, so I've manually changed contents of gradle/wrapper/gradle-wrapper.properties file to use Gradle 7.0.
Old file:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip
New file:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
Now it works ok, no more Gradle errors.
It seems like it can be cause by different things.
I solved it changing the JDK to the embedded android JDK and adding it to the path and JAVA_HOME environement variables.
I got this error in IntellJ when opening an Android project that someone sent me. It's a Gradle error and I'm not sure of the root cause. I think it's no Gradle JVM set in the .idea folder of whoever sent me the project.
My fix was explicitly set the Gradle JVM in IntelliJ in File -> Settings -> Build, Execution & Development -> Build Tools -> Gradle and set it to 11, or whatever. It's the same fix as another answer from me over here
I faced the same error while using a download project. Here the problem is with the version compatibility of Java and Gradle. The project was using Gradle 4.10.1 and my Gradle JDK was 17 which caused the error, I just changed my Gradle JDK to version 11. This solved the error for me.
Solution:
Go to File -> Project Structure -> Project. and note your Gradle Version. Gradle Version
Now go to this link: Compatibility Matrix - Gradle User Manual and look for a close enough Java version. Compatibility Matrix
Now go to File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle. Under Gradle JDK click Download JDK.Gradle JDK
Select the version and Download then Apply. Select Download
Rebuild the Project now.
I am trying to setup Android Studio For Offline builds, using latest gradle.
System - Windows 10 64 Bit.
What i have done so far?
Downloaded and Installed Android Studio 4.0.1 Windows 64 Bit from official website. Android SDK and AVD also selected during installation. (Internet Install)
Downloaded Offline components.
Android Gradle Plugin.
Google Maven Dependencies.
From -https://developer.android.com/studio#downloads
And setup according to docs for offline setup.
Downloaded Latest Complete Gradle zip file from :
https://gradle.org/releases.
Gradle version 6.5.1 (gradle-6.5.1-all.zip)
Pasted Gradle zip into .gradle/wrapper/dists/
And extracted it their.
And changed the path From File-> Settings->Build Tools->Gradle to above extracted folder.
When i tried to build, i got following errors:
Could not find com.android.tools.build:gradle:4.0.1 Searched in the following locations: - file:/C:/Users/Xevns/.android/manual-offline-m2/gmaven_stable/.../gradle-4.0.1.pom
Once inspected the offline components achieve, i think it uses Old Android Gradle plugin v3.5.0 beta and Old maven dependecy. But in project its using Gradle plugin 4.0.1 and Gradle 6.5.1.
Please help, where find it latest and setup.
The so called: latest versions of the Android Gradle plugin link does not contain the latest version. You have to select one that is in that package:
Grandle Scripts -> build.grandle :
classpath 'com.android.tools.build:gradle:3.4.0'
The Android Grandle Plugin package does not contain library versions that are needed for that "tools.build:grandle" version - (download manualy from repos?)
Other dependencies (appcompat,constraint-layout, ...) the same problem, requested versions are not included in downloaded Google Maven package.
I am trying to run/debug the application in android studio version 3.6.2 but returning an error saying Cannot parse result path string:
Build output box shows:
Build failed:
Cannot parse result path string:
The problem is with the gradle version
I simply had to switch from version 6.5 to 6.5.1 and after rebuilding it worked just fine.
If you are on windows go File -> Project Structure, on project change the gradle version.
The problem might be the gradle version. Using a gradle version above 6.5 should fix the problem to allow the build to complete. If the problem persists, I would suggest reinstalling android studio with updated gradle version.
To change gradle version: Navigate to file-> project structure and access the dropdown menu besides gradle.
Go to gradle project >>update dependencies classpath .
Thats all
This seems to be a issue with gradle cache. Try below methods
Method1: Try invalidate cahce/restart option from menu.
Method2: Clear the gradle cache manually by deleting "cache" folder from the below location "C:\Users\USER_NAME.gradle\caches"
Yesterday I upgraded Android Studio to version 3.0, but I'm working with LibGdx and after the upgrade I cannot build my project.
When I'm try to build, it gives me an error:
Error:(2, 0) Plugin with id 'jetty' not found
How should I fix this?
Currently html module using deprecated jetty plugin which is removed in Gradle 4.1 version.
Android Studio 3.0 using Gradle-4.1 and android-gradle-plugin:3.0.0
Gradle 4.1 is not supported yet in LibGDX, there is an issue for the same, which is now upgraded for Gradle 4.6
If you still want to use Android Studio 3.0
Downgrade Gradle to 3.3 from 4.1
Find gradle folder inside your project, Open gradle-wrapper.properties and change distributionUrl for 3.3
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Downgrade Android-gradle-plugin to 2.3.3 from 3.0.0
Open root build.gradle file and find artifact and change version
classpath 'com.android.tools.build:gradle:2.3.3'
Comment/delete google() from repo list
--------------------------------------------------------------------------------
EDIT : Update LibGDX project to Gradle 4.6 - AS USER
Upgrade Gradle to 4.6 :
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Find root build.gradle file of your project and add Google's Maven repo in project repositories list as well as in buildScript repo list
repositories {
//..
google()
jcenter() // Required for org.jetbrains.trove4j:trove4j library
}
Update Android Gradle Plugin :
classpath 'com.android.tools.build:gradle:3.1.3'
Known issues with the Android Gradle Plugin
Configuration on demand with Gradle 4.6 and above:
If you're using Android Gradle Plugin 3.0.x or 3.1.x with Gradle 4.6
and above, you should disable configuration on demand to avoid some
unpredictable build errors. (If you are using Android Gradle Plugin
3.2.0 or higher, you do not need to take any action to disable configuration on demand.)
Disable configuration on demand in your gradle.properties file as shown below:
org.gradle.configureondemand=false
To disable configuration on demand in the Android Studio settings, choose File > Settings (Android Studio > Preferences on Mac), select the Compiler category in the left pane, and clear the Configure on demand checkbox.
In Android Studio 3.2 Beta 1 and higher, the options for enabling configuration on demand have been removed.
Update Android buildToolsVersion to 27.0.3 and SdkVersion to 27
Remove instrumentTest.setRoot('tests') from sourceSets inside android build.gradle file
replace all compile with implementation inside root build.gradle file
New GWT Gradle Plugin added in html module, check latest build.gradle of html module.
Run your project with Run Configuration or On Terminal using gradle task.
If you're going to create new project use gdx-setup.jar of latest build.
Suggestion from Jetty Plugin team is to switch to gretty
Please check this
Error while replacing jetty plugin to gretty plugin gradle
I followed the instructions on here http://www.programmingmoney.com/setup-libgdx-android-studio/ for installing and using LibGdx on Android Studio 1.0(official release). I am on step 4, the actual generation step. When I tried import project, I got this exception
Gradle version 2.1 is required. Current version is 2.2.1. If using the gradle wrapper, try editing the distributionUrl in C:\Users\chris\AndroidStudioProjects\SetUpGame\gradle\wrapper\gradle-wrapper.properties to gradle-2.1-all.zip.
This was a similar error to what this person got in this thread - Upgrading project to Android Studio 1.0 (Gradle problems).
When i went to view gradle-wrapper.properties with notepad ++, this was what i saw
distributionUrl=http\://services.gradle.org/distributions/gradle-2.1-all.zip
which meant that this didn't have to be changed. (the answer that was given in the other thread)
Does anyone know what the issue is? Is Android studio version 1.0 too new for Libgdx? I m not that familiar with Gradle.
Look through all your build.gradle files and update the version of the Android Gradle plugin that's specified. If you see buildscript --> dependencies blocks, update them to version 1.0.0 of the Android Gradle plugin like so:
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
I think there may be a bug where if you have the wrong version of the plugin, it gives you a bogus error about having the wrong version of Gradle, and you get ping-ponging error messages when you change it back and forth because it's not fixing the root cause of the error, which is this different version number.