4

I just installed Android Studio 3.1 and wanted to create a new project with Kotlin and C++ support. I changed the gradle options in the settings as I always do whenever I install a new Android Studio version (see the picture 1) My default settings for a new Android Studio Project

After that I sync the project and the Android Studio beggins downloading a lot of dependencies (more than usual), but always get stuck when downloading this one:

Download https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.2.30/kotlin-compiler-embeddable-1.2.30.jar 14m 48s 86ms

If you look at the end there is the amount of time spent on that download (15 min before I killed the proccess for the n-time)...

I downloaded the .jar manually outside AS (in less than 5 mins)... and now my question is ...

Where can I put this file so that AS sucks it up from my local machine and stops trying to download it from the internet, never again!!!!!

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Javier88
  • 41
  • 6

2 Answers2

3

This is easy, follow these steps:

  • build your project using gradlew build
  • you'll see gradle is downloading. Here you can make use of proxies to make it faster (you can see the progress indicator which is invisible in the IDE)
  • when all dependencies are downloaded and it starts compiling your code, kill the process
  • refresh the project in the IDE

To ensure the IDE is not doing extra work, enable this option:

image

Then AS will stop trying to download anything and give error when there must be something to be downloaded. When you see that, rebuild with gradlew build.

ice1000
  • 6,406
  • 4
  • 39
  • 85
  • I appreciate the time you have taken to answer my question but, In the third point you say"when all dependencies are downloaded", and thats was the main problem, AS got stuck downloading one dependency, and I wanted to know where could I put that dependency (since I have downloaded manually) so that AS didn't try to do it by itself. After sooooome time, the AS finally downloaded the file and the problem was solved. – Javier88 Apr 04 '18 at 16:05
  • 1
    IDE and terminal are using different network (in China the latter is often faster), and you can see download progress in the terminal. – ice1000 Apr 04 '18 at 18:58
  • Thanks, suggestion to use 'gradlew build' helped me a lot. At least there I can see the progress of downloads. The IDE status bar just shows one of downloads while in gradlew terminal you may see parallel dependency download statuses. – Alireza Kazemi Dec 20 '19 at 09:48
  • i was going to say "thanks, this answer is really helpful" and then i saw your username. nice meeting you here! – Tony Beta Lambda Oct 06 '20 at 05:42
1

Create a 'libs' folder in your app folder and place the '.jar' file there.

In your build.gradle file make sure you have

dependencies {
   compile file tree(dir: 'libs', include: ['*.jar'])

  ...with other dependencies...
}
Daud Oladipo
  • 63
  • 1
  • 6