I need to use android studio at work, but the proxy doesn't let me download the packages, so I try to use android studio in offline mode following this tutorial:
https://developer.android.com/studio/intro/studio-config#offline
So I completed the steps, and created a project. I activated 'offline work' in the Android Studio->settings->gradle, but when I try to build it, android studio still tries to download gradle. I also get an error when syncing: Unknown host 'services.gradle.org'. You may need to adjust the proxy settings in Gradle.
btw the 2 zip files for maven and gradle each contain one folder. do I need to extract these folders or their content into the manual-offline-m2 folder? I assume the latter but I tried both and it didn't work
Related
I don't have stable internet connection in my area so I think of using the offline component found on Android studio download page namely Android Gradle Plugin and Google Maven dependencies I followed the offline component set instructions on this page https://developer.android.com/r/studio-offline/instructions
But after all the set up if I open Android studio and click on a sample project I use to have a build sync error pointing to the manual-offline-m2 . I need help in this area .
NB: if I connect to the internet and open a new sample project in Android studio without those offline set up it will build successfully. [![Screenshot of the build sync failure.][2]][2]
[2]: https://i.stack.imgur.com/XoddD.jpg
Android Studio require a Internet connection because when you open new project, Android Studio is reinstalling Gradle.
The image you have provided is not clear. However, Gradle build can run without an internet connection. You have to enable offline-mode from settings. (Settings > Build, Execution, Deployment > Gradle & check Offline work checkbox) Then Gradle will avoid using network resources. But sometimes it may cause errors, at that time you may want an internet connection.
EDIT:
To enable offline work in Android Studio 3.6+ go to View > Tool Windows > Gradle from the menu bar & open the Gradle window. Then click Toggle Offline Mode button.
I am new to Android development and have poor internet connection at home, whenever I create a new android project it takes forever to sync and build and most of the times it fails to build at all, I was wondering if there is a way so that I can download and save all the necessary build files like gradle, builder jar etc and use them to make android studio work offline?
Thank you and have great day.
I would suggest at least installing Gradle separately, and configuring projects not to download and use the Gradle wrapper for every new project.
After Android Studio downloads all the other libraries for the first time, then you can turn on offline mode in the IDE, and those packages will be shared for all projects
As soon as you try to use a new library, though, you need to get back online
Enable offline mode
If you are on a slow network connection, your build times may suffer when Gradle attempts to use network resources to resolve dependencies. You can tell Gradle to avoid using network resources by using only the artifacts that it has cached locally.
To use Gradle offline when building with Android Studio, proceed as follows:
Open the Preferences window by clicking File > Settings (on Mac, Android Studio > Preferences).
In the left pane, click Build, Execution, Deployment > Gradle.
Check the Offline work checkbox.
Click Apply or OK.
If you're building from the command line, pass the --offline option.
For more info, visit https://developer.android.com/studio/build/optimize-your-build
I'm new to Android development (and to gradle), as is our small team. We have one developer who has been working on a project for a couple weeks, and who has been checking their code into GitHub periodically.
When I download their code and attempt to open in Android Studio 2.2, I get asked about various project settings. This surprised me, because it seems that all the project settings should already be specified somewhere in a file saved in the project settings. My coworker ought to be able to save all of their project configuration settings into the project file, upload it to the repository, and I should be able to download all of his files and simply build and run the project on my machine, assuming we're running the same version of Android Studio and both have the same SDK(s) installed.
My question is, what file(s) contain the project settings under Android Studio 2.2 and 2.1 (the version he started development with)? I've tried searching online and here on stack overflow for "what file contains project settings in android studio". However, this only gets me results that talk about what a project is, and what dialog boxes contain certain settings. I'd like to know which files (gradle, xml, etc) files contain the project settings (build, SDK, workspace, etc).
I've also tried uninstalling 2.2 and going back to 2.1.2, but that doesn't help much either. In both cases, I'm getting questions about project settings as well as build errors. I don't want to address all of those issues here though.
Thanks so much for you help!
From the location where you have installed Android Studio,
you will have something like .AndroidStudio2.2 folder this contains settings for version AndroidStudio2.2
What you do is Unistall studio and installng new one(AndroidStudio2.2), it will ask you to take settings from just give this path mentioned.
Other than this,
your gradle file will have all settings of your project.
it will be of module level and project level.
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've installed a fresh version of Android Studio and from there created a new application. It created my file but the Gradle causes me a lot of problem. For the whole day straight it always try to download the gradle-1.10-all.zip but as always it fails.
Message is:
Gradle:Download http://services.gradle/org/distributions/gradle-1.10-all.zip
Hope they decide to add up some progress bar for this. LOL
I'm in doubt that this is due to internet connection just to take note. Although I'm investigating about the possible solution via HTTP proxy.
Now for an alternate solution I tried to download the whole zip file instead from http://www.gradle.org/downloads. While I successfully downloaded and extracted the whole zip file. Then from android Studio I tried setting the Global Gradle Settings into offline work and as well as the Project-level settings into: use local gradle distribution and mapped the extracted zip file (although I'm not sure if this is the correct way to do this)
Does anyone know on how should I do the workarounds for this?
Hope that maybe someone can help me work with this or someone who already solved this issue since for now I don't have a plan to update from this version anymore given that each and everytime that the Android Studio updates it was always been a pain in the ass and Second I need to work on most of my projects offline.
Found out the solution on this. First you need to download the whole zip file from: http://www.gradle.org/downloads
Next step is to just let the Android Studio Create the folder for the .gradle in your User then from there you can just halt the project initialization and then go to the location of the .gradle folder. In my case it's:
C:\Users\USER\.gradle\wrapper\dists\gradle-1.10-all\SOME_SORT_OF_STRING
Just copy and paste the whole zip file on the location (no need to unzip the file). Also you have to make sure it has the same version with the one in your gradle wrapper folder which in my case is gradle-1.10-all.
Try restarting the Android Studio. You can create a new project once again and let it extract the zip file. It should now start on downloading the other files needed and from here you will need a reliable and stable internet connection. The succeeding files will have a smaller size compared to the zip package but in my case since I don't have a stable connection I used to tether my mobile phone instead and viola! Android Studio installation is now complete and running.
There exist options for offline working.
On command line add --offline option to your gradle command.
In Android studio you can set this option in the setting on the gradle configuration part. Just check the checkbox
Another way of doing is to find a friend that is already started using the studio, You can copy .gradle ,. androidstudio/.androidstudiobeta and .android directories in your user directory. If gradel is your only problem just copy that one only.