Working on Linux.
Android Studio 1.4 told me that 1.5 is available in the stable channel;
I upgraded.
Afterward, 1.5 seems to be "looking" for Gradle 2.4; yet 2.8 seems to be what's actually installed.
More details:
After the upgrade, the Gradle sync failed on the project I opened.
Error message:
.../android-studio/gradle/gradle-2.4/lib/plugins/gradle-diagnostics-2.4.jar (No such file or directory)
But the version specific sub-directory within the gradle directory is gradle-2.8
The update procedure itself did not complain about any issues.
The update was done without any open projects; update was done from the main Studio panel.
After the update of Studio itself, via "Configure" from main panel went to "SDK Manager", then updated to newest compatible SDK.
Has anyone else had a similar problem?
Yes, there was a problem in this update.
Open file gradle-wrapper.properties in your project using Android view:
Just change the version 2.4 to 2.8:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
Restart Android Studio.
Resolved - it seems some of the Gradle components were on the classpath for the JVM which studio itself uses; somehow the JVM didn't exit when Studio was to have re-started after the update. Once I bought that down and restarted Studio, the JVM and all, Studio 1.5 seems to be working just fine so far.
Sorry for the interruption to your regularly scheduled development!
There is definitely some issue with the upgrade as I also faced the same problem.
Although restarting the system (Mac) fixed it.
Related
I just upgraded my android studio version and gradle version to the new one as AS suggest me. But now every time I try to build my project gradle has this error:
Could not create parent directory for lock file /opt/android-studio/plugins/gradle/wrapper/dists/gradle-7.5-bin/f1w0cc9nuo0eivz97x2xlu9sv/gradle-7.5-bin.zip.lck
Of course it worked perfectly fine before upgrade and I didn't change anything manually in path or version used.
I know it's a permission error, but I tried to build it as sudo, it downloaded and installed correctly but once I went back to a normal user process, it can't recognize that gradle has already been installed on my system. I have this error
The specified Gradle distribution 'https://services.gradle.org/distributions/gradle-7.5-bin.zip' does not exist.
knowing I didn't change anything in my path or used version while swapping between sudo and normal user.
Does anyone know how to force AS to detect and use already installed gradle version?
One option will be to open Android Studio's settings:
Build, Excecution, Deployment > Build Tools > Gradle
and from there you can specify whether to use Gradle from gradle-wrapper.properties file or from a specified location. The latter should fit your needs.
Tested with AS Chipmunk and Dolphin.
I'm fairly new to using android studio, and I can't seem to wrap my head around what i'm doing wrong.
I'm currently trying to install the Ping Plugin from Cordova, now everytime I try and install it I get the error message
Minimum supported Gradle version is 4.4. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in /Users/sam/Development/Apps/ghost/gradle/wrapper/gradle-wrapper.properties to gradle-4.4-all.zip
So from here I go to File > Project Structure > Project and change the Gradle version to 4.4 and the Android Plugin version to 3.1.1. I then let android studios build and do what it needs to do.
From here I check the gradle-wrapper.properties file and can confirm it says 4.4-all.zip.
I then try and reinstall the plugin, it then throws the same error, so I check my gradle-wrapper.properties file and it resets itself back to 4.1!
Am I doing something stupid?
Again i'm very new to Android Studios, so apologies if i've missed anything.
Incase it helps, some extra details are
OS - macOS High Sierra 10.13.4
Homebrew - Global machine Gradle version 4.7
Android OS - 6.0.1
Cordova - 8.0.0
EDIT
Something else I have noticed, If I go into the .gradle folder in my application, and remove the 4.1 folder and try to install the plugin, it automatically recreates the 4.1 folder and uses it?
Also i've now noticed it has this behaviour every time I run any cordova command, including cordova build android
For anyone else experiencing this behaviour, once I found out that it was any cordova command that was causing the gradle to reset, It was easy to find the answer.
Answer
Basically there is a distributionUrl located inside the GradleBuilder.js file that kept on resetting my gradle back to 4.1. This needed to be changed to 4.4 and the build and plugins worked straight away!
"Moral of this particular story, for me anyway, don't update Android Studio for no good reason" - This should be made the 11th Commandment. I was able to fix this issue by deleting the /platform/android folder and re-installing it making sure not to click on any "highly recommend" upgrade options.
In addition to the answer above and listed in the path below,
Cordova build changes distributionUrl in gradle-wrapper.properties file
I found that on Android Studio 3.1.2, it is necessary to update not just GradleBuilder.js as per all previous advice, but also StudioBuilder.js.
Just to be clear, both files are in the same directory:
$PROJECT_ROOT/platforms/android/cordova/lib/builders/
and the text to be changed in this instance is
'https\://services.gradle.org/distributions/gradle-4.1-all.zip' to
'https\://services.gradle.org/distributions/gradle-4.4-all.zip'
Moral of this particular story, for me anyway, don't update Android Studio for no good reason, as it'll take up 3 hours of your day fixing sh*t. Wait till Cordova has been upgraded to suit before even thinking about it.
I have updated to Android Studio 3.1 Stable Version today(27 March 2018).
I have an old project. With new studio version, it gets build successful and app gets installed on Emulator, but the on the IDE, Activity file shows
Can Not resolver Error
.
gradle file app module
Project level gradle file
I spent a long time on this yesterday after migrating from Android Studio 2.3 to 3.1. Tried everything from other answers to similar questions. Google's maven repository was correctly configured, tried invalidating caches and restarting, restarted the computer, etc.
The one thing that worked for me was closing Android Studio, deleting the .idea folder from my root folder and starting Android Studio again. Since I had everything checked into git before starting the upgrade I was able to do:
rm -rf .idea/
git checkout .idea
So I ended up with my original idea project files, but you should be fine if you can't revert to your checked in idea files. After reopening Android Studio it recreated some of the files I ended up deleting and everything worked again. Hope that helps others with the same problem.
This answer is old but basically suggests the same thing so I guess this problem keeps showing up. https://stackoverflow.com/a/21100896/791560
I was able to Fix:
https://developer.android.com/studio/build/dependencies.html#google-maven
From Android Studio 3.1, if we are working on Old projects built on 3.0 or lower, you need to add maven repository at top level build.gradle file. i.e., add google() under repositories of all projects.
For new projects, it gets added automatically.
App level, build tools version should be at min 27.0.3
Make sure compilesdk version and support library version are the same version level.
I recently upgraded to gradle 3.4.1 on Android Studio 2.3.1. My build was working earlier. Anyway, the error I'm getting is:
I've wiped the data to the avd, made sure the app wasn't on it, restarted android studio and my mac, and made sure I didn't have the android:testOnly="true" flag set (I don't). I also added the flag and set it to false, but I still get the error.
I also had this problem in Android Studio v2.3.1.
I found stability when I set gradle version to 3.3 and android gradle plugin to 2.3.1. Stay off that bleeding edge gradle :)
I can't seem to find the project files in to the newer version of Android Studio. In the screenshot below you can see that it doesn't display the entire project tree.
http://i.stack.imgur.com/ts172.png
The solution offered in this post doesn't fix my problem.
Press alt+1
this work on my android studio 0.3.5 on linux
It happened to me too, in this link it says something about upgrading:
Windows users: Do not install Android Studio 0.2.x in the same location as 0.1.x. Doing so may cause errors such as ClassCastException or other unexpected behaviors. It's best if you remove your previous version of Android Studio 0.1.x.
I fixed it uninstalling my currend Android Studio installation, removing the folder where it was installed with the remaining files, and installing it again. It works correctly now apparently.
I have had the same problem on Android Studio 1.2.2. I have closed and reopen project.