Gradle - location for cached libraries in Windows - android

I am trying to develop a simple android application using Android Studio 3.1.1. While building I am getting a sync failed error from gradle. The bottom Build panel shows this error message.
Could not HEAD
'http://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.2.0/kotlin-stdlib-jre8-1.2.0.pom'.
Received status code 503 from server: Service Unavailable Enable
Gradle 'offline mode' and sync project
In my organization the access to this CDN is blocked. I tried by enabling the 'offline mode', now I am getting this error.
No cached version of org.jetbrains.kotlin:kotlin-stdlib-jre8:1.2.0
available for offline mode. Disable Gradle 'offline mode' and sync
project
I downloaded the file kotlin-stdlib-jre8-1.2.0.pom, but I don't know where to put it so that Gradle can use it (as a cached version).
Is there any way to make this work when the CDN site is not accessible?
Or anyone know the windows folder where the gradle stores the cached libs?

Gradle supports an array of repository types. If you cannot use a Maven repository hosted by your organisation, there are other options available, like a flat directory repository or something else.
I would not recommend attempting to trick Gradle in believing it downloaded the dependencies. These are internal formats, subject to change from version to version.

Related

Gradle doens't work offline in Android Studio 2021.2.1

I'm trying to use Android Studio offline because in the place I work, IT policy doesn't allow me to download .jar or .zip or some similar files though I can request the files which I want to download from IT team. I tried to create a hello world project offline but gradle didn't synchronised so I couldn't even run a simple project.
Here are the things I tried for running android studio offline;
I downloaded gradle version 7.2 complete build from official website,
Specified Gradle location using the menu File --> Settings --> Build, .. --> Gradle,
Choose version 7.2. for both Android Gradle plugin and Gradle versions in File --> Project Structure --> Project menu.
Added the zip of gradle version 7.2 to gradle-wrapper.properties as;
...
distributionUrl=file\:/gradle-7.2-all.zip
...
Switched to gradle offline mode
Downloaded offline-gmave-stable.zip from offline sources on the official website and set a gadle script according to https://gist.github.com/eladkarako/a4ffac49e21b02356246604917911f9c
At the end of all of the steps above, I still get connection errors.
Here is the error I got;
Could not resolve all artifacts for configuration ':classpath'.
Could not download gradle-7.2.0.jar (com.android.tools.build:gradle:7.2.0): No cached version available for offline mode
... (around 80 more jar files)
Possible solution:
Disable offline mode and rerun the build
It's third day and I couldn't even started to write a line of code. Could you please help me out?

Android Studio 3.6: Gradle "Offline Mode" is not working

I have an unstable internet connection so i want to work in Offline Mode.
I build my project with internet connection and then turn on the Offline Mode. I did not change anything, but the build fails telling me some dependency that i don't have in my Gradle files is not cached.
No cached version listing for com.google.android.gms:play-services-basement:[15.0.1,16.0.0) available for offline mode.
I even added this in my dependencies but it didn't work.
I guess that Gradle does not cache all the dependency tree but only the direct dependencies.
Is there a way to manually download these packages and copy to Gradle cache?
Thanks.

React-native app offline with android studio

I'm develeoping react-native app on a computer without internet connection(I can't connect it to the internet),
I have configure the local repository and the android plugin according to android studio guide here
and also linked the gradle localy.
All the configures worked fine but the project is still not compiled, I get unresolved dependencies of the react native modules(example here) that I used.
I'm trying to solve this issue for two weeks and failed.
I didn't find any solution for this yet
The android studio version is 3.5.2 and the gradle version is 5.4.1
Any idea? Any help would be appreciated
Well, working offline with gradle will prove a little hard unless you build the project once when you have internet.
The problem is that gradle needs to resolve the dependencies and for this it's not only looking in node_modules, but also at different online repositories.
If you don't have internet - gradle isn't able to fetch the required packages and you get a build error.
In your case you've configured android studio to use offline versions of gradle and maven, but what your build can't find is soloader, yoga etc - those are libraries that are not available in the offline maven build you downloaded. As far as I can see from the content of that build it only contains the android dependencies.
You'll need to get the soloaded, yoga etc and provide those to your build for offline use. I guess that the easiest thing would be to build the project once when online... Afterwards gradle should reuse the cached packages.

How to disable *sources.jar download during Sync in Android Studio project

IDE keeps sending *-sources.jar requests on each sync. This files are missing on server, so it leads to waste of time on each sync (especially on multi module projects). Is there a gradle or IDE option to disable this file requests? or optimize number of requests for multi module project?
There are few solutions how to build project offline:
Do it in terminal
gradle --offline build
Change it in gradle window (Android Studio 3.6.1)

Unable to create & sync android project in mac with android studio 3.1.4

Unknown host 'jcenter.bintray.com: nodename nor servname provided, or not known'. You may need to adjust the proxy settings in Gradle.
Enable Gradle 'offline mode' and sync project
Learn about configuring HTTP proxies in Gradle
if I do it in offline mode getting different errors
these are my gradle files tried different build tool versions in last few days but non working please help.

Categories

Resources