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
Related
Android Studio used to have the option to debug existing APKs from the File->Profile or Debug APK. I have used it in Android Studio version 3.4. Now at version 3.4.1, I cannot find it.
Does anyone know if the option was removed from Android Studio or where can I find it?
I had this same issue and here's how I solved it.
I had disabled APK and NDK support in hopes that it would speed up my IDE. I forgot to turn them back on. So I went into Preferences > Plugins and if you don't have them installed, install Android NDK and Android APK support. If you already have them installed, tick Android APK Support and it will prompt you to enable Android NDK Support if you don't have it enabled already.
Since Android Studio menu can be customize, by some way the option has been removed from your toolbar. To add it again go in File -> Settings -> Appearance & Behavior -> Menus and Toolbar
From here open the Main menu -> File -> File Open Actions folders.
Select the Open line, then click on the plus sign on top of the window next to the search bar. Click Add Action... and search for Profile or Debug APK... options.
Apply and you're good to go !
Edit
After some exchanges in the comments we fixed the issue another way.
You have to go into Settings -> Plugins first. Check if you have the plugin Android APK Support activated/installed. If not then install/activate it.
And now you're really good to go !
That's weird because I am using android studio 3.4.1 and its there:
When I had problems after updating android studio all I did was to re-install it and my problems got fixed.
Also, you should know that downloading another version of Android studio is really user-friendly, check my question about it.
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.
I am using Android Studio 1.0.2 on Mac to develop an app for Google Glass. I have been trying to start with one of the recommended projects that Google supplies on github, but I'm running into a problem. The instructions say to open Android Studio, select Check Out Project from Version Control, select Git in the dropdown menu, choose a location for the files, and then paste the url to the github. So I paste the url and when I click the test button to check the vcs repository url, it says the connection is successful. The problem occurs after I click Clone in this window. All documentation that I have read states that one or two more windows should pop up and that I should select OK in both of them, however, nothing ever shows up. The project never opens, and when I try to find the project following the path I chose, there is only an empty folder with the name "gdk-stopwatch-sample". So, what's going wrong?
I have also tried downloading the zip file from github and then trying to open it via another selection in the Android Studio Startup window like Open an Existing Android Studio Project or Import Non-Android Studio Project but I am very new to Android development and I cannot seem to choose the correct gradle import settings so the projects never run or build correctly if I can manage to open them. I am convinced that the easiest way to start this process will be to check the project out through version control, but I don't understand what's going wrong and I can't find any documentation that discusses this problem. I would greatly appreciate any help on how to get this going.
App found here:
https://github.com/googleglass/gdk-stopwatch-sample
Instructions found here under Before You Begin:
https://developers.google.com/glass/develop/patterns/ongoing-task
I've met with the same problem as you. (also Android Studio 1.0.2, but on windows)
Here's the solution I've found:
for Check-out/clone issue, make sure you've installed git and it is accessible in your android_studio.
At Android_studio, set the git in the following settings page
(My path is under Windows...)
to open the gdk-stopwatch-sample project (using the local gradle_2.2.1), make the following modifications
(1). \gdk-stopwatch-sample\app\build.gradle
(old) runProguard false
(new) minifyEnabled false
(2). \gdk-stopwatch-sample\build.gradle
(old) classpath 'com.android.tools.build:gradle:0.12.+'
(new) classpath 'com.android.tools.build:gradle:1.0.0+'
(3). install SDK Build tools v20 (from SDK manager), if not yet.
If your gradle plugin version is 0.14.0 or higher, you have to go to your build.gradle file and change "runProguard" to "minifyEnabled". You can read more about the recent changes here: http://tools.android.com/tech-docs/new-build-system
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.
I followed googles instructions and exported a test project from Eclipse by using the
Export -> Generate Gradle build files
opened up Android Studio and imported. After getting my support libraries working properly my project would compile with out any errors. My problem started when I tried to run the app on my device. When ever I try to run the app it directs me to use an AVD, never giving me the option to select my device. I obliged, created a new AVD but to no avail only to get build failed error. (I'll add the exact error when I can) NOTE: I can see my device is connected by clicking on "(6)Android" and the bottom left of the screen. I do see all logcat messages in verbose. I added android:debuggable="true"to my manifest but still nothing.
Confused I created a new project directly from Android Studio, hit run and bingo,...it gave me the option to use my device to run it or an AVD. Selecting either results in a successful launch of the dummy "Hello World" app. I think it may have something to do with build variants as my imported project doesn't specify "debug" vs "release" while the Android Studio generated project does.
Anyone else experiencing this?
I found the answer to my own question. Bit of a double whammy. Before installing Android Studio I updated my SDK via Eclipse (as recommended/required by google). Turns out by doing so a few items in my current projects got disconnected. ie. build paths, dependencies, ect. (you now have to place external Jar's in the src/libs folder)
Here is what I did to fix it.
In Eclipse, Preferences -> Java Built Path ->"Order and Export" tab. Make sure items are selected
If you have external Jars, manually copy and paste the jar in the libs folder of the project. (I did this in my Finder)
confirm the project launches via Eclipse
If it runs, export the project again by "Generate Gradle build files" (confirm overwriting existing files, if any)
5.Open Android Studio and re-import the project. Again, confirming overwriting of any existing files.
6.Next to the run bottom at the top of the screen click on the drop down next to your project name. Click "Edit Configurations..." and select "show chooser dialog" if not already selected.
clicked ok to exit,..and PRESTO!!! I finally have a successful project migration.
Hope this saves someone else time.
Cheers!
Yeah i have experienced similar stuff on Eclipse, its quite buggy. Since Android studio is based on it i would expect everything. Still the best solution to everything is to reload project, refresh project or restart IDE.