At office, I am behind a proxy. The internet access is restricted.
So I performed a gradle sync at home and copied the folder ".gradle" present at C:\Users\username.gradle from my home PC to the same location on my office PC.
Now on my office PC, I set gradle in Android Studio to "Work Offline" but still whenever I try to perform a gradle sync, I get an error stating
Error: Could not download google-services.jar (com.google.gms:google-services:3.0.0): No cached version available for offline mode
However on digging through the ".gradle" folder I was able to locate the google-service.jar file at
C:\Users\username\.gradle\caches\modules-2\files-2.1\com.google.gms\google-services\3.0.0\32b833222c886ecfb37d79b1a05ce1eddb702db1
I am not sure how to proceed. Please help.
I had to dig for this a long time in the 2019.2 version. This option has moved in the UI. It is now in the toolbar of the gradle tools:
see JetBrains documentation at https://www.jetbrains.com/help/idea/jetgradle-tool-window.html#offline
This Error occurs when in your Android Studio's Gradle Tools Offline Mode option is Enabled.
When Enabled it lookes like this.
To fix it, you can Disable mode by clicking on the option shown in below screenshot.
> Update: I heard Google Listened to the suggestion! and now in new android studio versions, when you start a new project, a popup will come with option to either build with gradle online or offline.. Great for you all..
You need to re-enable your gradle online mode
Google changed the location of doing this...
After the latest version as at this time i am typing this answer, which is version below
Android Studio 3.6.1
built on February 27, 2020
I have sent a message to the them so Google changes this in next update..Cos the new location confuses the Software engineers who are used to the old way of doing it...
But for now follow these clear 2 steps to find it and toggle it Online or Offline easily..
Just Go to the top-right hand corner of your SDK and click the vertical Gradle tab as circled in red in the my picture below...
Then you Click this icon (which looks like a symbol in an electrical schematic circuit) on the gradle table that comes out.. As Circled in Red in my picture below..
Maybe helps someone. Just remove --offline in "Command-line Options:"
click on gradle on the right
toggle offline mode
try again (sync with gradle files)
It seems that in newer versions of IntelliJ (I am on 2018.1) you may need to uncheck the Offline checkbox in Gradle preferences.
Just for reference 2019.1 Ultimate IntelliJ, go to Gradle -> Settings (a top-rightmost icon) -> Uncheck the Offline work in Global Gradle settings.
Gradle Tab not presented, go to View -> Tool Windows -> Gradle to show it first.
I'm using android studio in MacBook
step 1 - Go to preferences by clicking android studio on the left
uppermost corner.
step 2 - Go inside Build,Execution,Deployment.
step 3 - Finally select Gradle.
step 4 - then, uncheck offline work. Click apply then ok.
step 5- lastly try to sync once again.
Hope this will work because it works for me.
You can set startParameter.offline=false in your settings.gradle
Try running gradle with the --debug flag, in addition to the --offline flag. That will tell you exactly where it's looking for the files.
One possible reason for the error is that the path of the .gradle folder is different between your home and office PC, possibly because your username is different on each machine. The .gradle cache uses absolute paths (see .gradle/caches/modules-2/metadata-2.16/artifact-at-repository.bin for an example). This is a documented Gradle issue: https://discuss.gradle.org/t/copying-the-gradle-cache-to-another-machine/7546/13. If possible, use the same GRADLE_HOME at home and work to resolve the issue.
How to configure gradle to work "offline" (using cached dependencies)
Uncheck the 'Offline work' under the Global Gradle settings fixes my issue.
Related
I have an old Android Studio project that I need to resurrect briefly.
I've installed a fresh new copy of Android Studio, and unarchived the project into a location Android Studio can see. I need to sync to gradle, but I have no idea how to do this-- everywhere I should be able to see an option to do this (that I know about), there is no trace.
I know it should be in the File menu. It is not.
I know I should be able to adjust the file menu with File, Setting, Menu and Toolbars-- that interface promises that 'sync project....' is in the File menu. It is not.
File, Settings, Plugins assures me gradle is installed. Is it? I don't know, can't prove it by me.
File, Settings, Plugins also tells me I can use the gradle tool window through View, Tool Windows, Gradle. No I cannot. There is no such menu entry under View, Tool Windows.
Where the heck did they hide sync to gradle?
You can double tap Shift and type "sync" to see the option.
You can find it at the top
I am trying to put gradle in offline mode as it is taking way too long to do its job. Now from what I read online it is supposed to be under View->Tool Windows the there should be a gradle there for me to click so I can toggle it to offline however I do not have the gradle link on my Menu. I also tried via Settings->Build,Execution and Deployment->Gradle but to no avail. gradle settings
I was now considering editing the gradle files themselves however I'm not too keen as I don't know what the cost of that will be since I dont really know how this machine works under the bonnet.
Anyone with knowledge please assist, thanks
Try accessing Gradle settings from the sidebar to the right of the window and find 'Toggle Offline Mode'
Toggle Offline Mode - Gradle Settings
I can't click the run button. Does anyone know how to fix it?
Click Run on the menu and then Edit Configurations... then click on Android Application on the left and click the + button. Choose Android Application from the pop-up menu. Then pick the module (its normally app or something like that). Then click apply and ok.
If you have more errors after that, try to re-import the project in Android Studio.
When creating the Run Configuration, the dropdown for Module had only <no module> for me. Invoking menu File -> Sync Project with Gradle Files added app to the dropdown for Module. Then the Run button became enabled.
The above answer didn't work for me, instead closing the project and restaring the AS IDE worked for me.
Just click the dropdown button on left side of RUN button (in your image the dropdown which is in red box) select 'app' option from that and RUN button will be enabled.
Please refer below screenshot.
just to go File -> Sync Project with Gradle files then it solves problem.
for flutter project, if the run button is disabled then you have to
tools>> flutter>> flutter packages get >>enter your flutter sdk path >>finish
This should solve your problem...
Above answer didn't work for me, just do click File -> Invalidate/cache -> Invalidate and Restart.
open your existing application by selecting build.gradle file. it will automatically sync the project and run button will be clickable
Run 'app' button disable issue coming sometimes in Android Studio Dolphin
Sync your project with gradle files
It was quite silly for me, I just opened the Run > Run Configurations window
everything seemed to be fine there, I didn't change anything, when I closed the window the button was enabled.
If you have changed jdk version then go to File->Project Structure->Select SDK Location from left bar->update JDK Location in editbar in right bar.
If your IDE is in power save mode, then the run button etc. are also disabled.
You can verify this via the file -> power save mode, make sure it is disabled.
If you are on a Mac, try clicking on File, then click on "Sync project with Gradle files" .... Run button should turn green again in a few seconds.
if you're importing an eclipse project to android studio, you'll also encounter the same issue as above. Double Check if grade>app has
apply plugin: 'com.android.application' on the top as sometimes android studio imports it as a library.
You have to reconfigure the FlutterSDK path in Android Studio: Go to Setting -> Language & Frameworks -> Flutter and set the path to Flutter SDK
I just clicked on the debug icon and it started working.
Build->Clean Project
make the run button enable again in my case
For me increasing the version of compile SDK to latest solved my issue, Go to
build.gradle(app-level)
compileSdkVersion 30
Because My Emulator is Api-level 30
Select the project view in the android studio.
Remove all gradle folders.
Restart the android studio.
This will work.
The issue is happening since the gradle was configured for an android studio in another machine and the files pushed on the git and are using in your studio.
After removing these gradle files and restarting the studio, the studio will generate gradle files for your system. This will solve the issue.
I opened the wrong folder.... Verify is your root folder in Android studio has the build.gradle file.
If you are trying to run the Flutter Project in Android Studio, and the run button is disabled then here is the solution
Click on add configuration
and select Flutter and then select the main class in dataentrypoint
I'm using Linux where I had a symlink in my home folder pointing to a folder containing the Android Studio projects. Loading a project using the symlink failed, loading a project from the folder where the symlink is pointing to worked!
My solution was to go to that multiselect button, then "Edit Configurations" -> Go to "+" and select the module (in this case it would be an app if you do not have a multiproject -> then apply and OK
Happened to me twice, and then I figured out it happened after I upgraded my flutter version. When I opened (flutter SDK path) in (flutter) tab in (system preferences) I found it empty.
Solution was to point out to flutter directory on my disk from (flutter SDK path) in (flutter) tab in (Android studio preferences).
Run button is bounded with Configuration that is why you should check if your project is build, synced and indexed and after that you can select a Configuration
For me, more than 1 instance of adb was initialized and due to this run button was disabled. I had to open ActivityManager (on mac) and kill all the initialized adb instances.
go to Build-> Clean Project
Selecting a different build variant (in the Build Variants view), then reselecting the initial build variant, fixed this issue for me.
After updating Gradle as suggested in this answer the following error appears while using Android Studio 0.2.0
How to get over this one?
go to Settings-Plugins-IDE Settings and just disable and enable again needed plugins - it helped me.
I think it was some bug on Studio
I have the same error, and I solve it as mentioned above:
go as flow file-->settings-->plugins
then uncheck the red options
apply settings You will get error message no problem
recheck the unchecked options
press ok
it will request to restart android studio press ok button and it will solve the error and work fine again
1.Go to settings -> uncheck all red check one's -> apply
2.It will restart your android studio -> OK
3.Go to settings -> Plugins -> check the unchecked one's->apply
4.Restart and update them all.
//done
//thankyou
I try to remove and reinstall Extras or disable and enable plugins but the problem is not solved.
I find a solution to correct that is to reset Android Studio You have to remove this directory and restart Android Studio to detect the SDK location:
~/Library/Preferences/AndroidStudio*
~/Library/Caches/AndroidStudio*
~/Library/Logs/AndroidStudio*
As you see, image uploaded by you, Configure, go to that menu. Now click on Settings. Try to find Plugins in IDE Settings. Here look out for Gradle and check whether it is installed or not.
If not, Click on Install JetBrains Plugin... or Browse Categories and find Gradle. Now on top, besides Refresh button there is a Download and Install button. Using that button install Gradle Plugin.
Andorid studio -> preferences > plugins, enable "support" plugin. And then if there are red plugin, disabled it and restart android studio
Go to File->Settings-> Plugins then uncheck then check all the red highlighted plugin then restart the android studio if require
I solved it this way..
Go to file then settings (Ctrl+alt+S) > then go to plugins > on the "show" dropdown button select disabled > unchecke the check-buttons then they'll disappear> again select disabled then check them and press OK. On request to restart android studio, restart it and it'll be working fine
For Mac, this worked
Menu > Preferences > Plugins
Uncheck all
Android studio will ask to restart, restart it
Check all again
Restart Again
And Voila!
Unchecking the gradle plugin and checking it again then restarting android studio and selecting the SDK location and downloading the missing dependencies worked for me
I solved this problem with reset android studio settings.
On Windows:
Go to your User Folder - on Windows 7/8 this would be:
[SYSDRIVE]:\Users[your username] (ex. C:\Users\JohnDoe)
In this folder there should be a folder called .AndroidStudioBeta or .AndroidStudio (notice the period at the start - so on some OSes it would be hidden).
Delete this folder (or better yet, move it to a backup location - so you can return it if something goes wrong).
This should reset your Android Studio settings to default.
https://stackoverflow.com/a/19397632/793880
2020/12/10 - Ubuntu 18.04 and Android Studio 4.2
I solved it this way:
Using strace I've found the user installed plugins directory on "/home//.local/share/Google/AndroidStudioPreview4.2" (not documented in any place i've read, nor official doc, nor IntelijIdea either)
Just deleted the directories of the failing plugins (that are not listed with installed plugins, so can't uncheck anything), and problem fixed.
I set up my Github with android studio, everything worked fine, the problem now is though, that I can't seem to turn off, or get out of version control to use the IDE normally again.
This means that errors aren't shown, and it is really hard to debug because of this.
So how do I turn off version control (VCS) in Android Studio?
To disable VCS in Android Studio on a Mac do the following:
Android Studio > Preferences...
In the Preferences window, select Version Control and under Directory choose VCS dropdown to be <none>
Don't forget to click "Apply" in the general Preferences buttons at the bottom.
For 2022...
It would seem that Android Studio nowadays does not automatically start with version control turned on for a new project.
The default seems to be "off" at the beginning of a new project.
(It does conveniently make a ".gitignore" file for you but it does not default to trying to use version control.)
However, if later you do manually yourself start using git in the folder in question, Studio does turn on vcs inside Studio, i.e. exactly as seen in the image above. In that case you'll have turn it off inside Studio, exactly as shown above.
In Android Studio 1.2.x
FILE -> SETTINGS -> VERSION CONTROL
Here the root is shown, Press (-) button to delete.
The other answers weren't working for me, so I am adding my solution.
This message was driving me crazy:
I had trouble with the other suggestions, as my settings was not allowing me to save changes for version control none.
So I went into Version Control / Ignored Files and removed all ignored files for that project.
Then when I clicked back on Version Control
I found this in this answer here.
VCS is a project specific setting which you can modify by going to File -> Settings then checking under the Version Control heading.
Alternatively, you could disable a specific VCS plugin under the Plugins heading.
Note: I have not used GitHub as VCS, but you should still be getting error display (syntax checking) in the IDE. VCS usage should not disable that, since that would make the use of an IDE completely pointless.
You can delete vcs.xml file and it will remove the VCS connected with your app. 'vcs.xml' file can be found in this location "YourProject\ .idea\vcs.xml"
Project > .idea > vcs.xml
change vcs value to 'none'
Note : only current enabled project.