A J
A J

Reputation: 4652

Android Studio 2.2 giving error while creating new project

I just updated my android studio to

Android Studio 2.2 Build #AI-145.3276617, built on September 15, 2016 JRE: 1.8.0_76-release-b03 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

Now when I create a new project I am getting build error.

Error:Failed to resolve: javax.inject:javax.inject:1 <a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

enter image description here

Upvotes: 3

Views: 13722

Answers (7)

Mahalakshmi
Mahalakshmi

Reputation: 330

this worked for me add the following code to the build.gradle:

repositories {
        maven { url "http://jcenter.bintray.com"}
        jcenter()
    }

Upvotes: 0

halxinate
halxinate

Reputation: 1559

Doublecheck if you need to use the proxy server (i.e working on a corporate workstation from home may still require using the corporate proxy with the VPN link or without. In that case, don't trust the VS HTTP proxy settings, it's not supporting https, rather setup your gradle to use them:

In the gradle.properties file put:

systemProp.http.proxyHost=your_proxyserver_url
systemProp.http.proxyPort=your_proxyserver_port_number
systemProp.http.proxyUser=your_proxyserver_user_name
systemProp.http.proxyPassword=your_proxyserver_user_password
systemProp.http.nonProxyHosts=localhost
systemProp.http.auth.ntlm.domain=your_corporate_domain_name_url

systemProp.https.proxyHost=your_proxyserver_url
systemProp.https.proxyPort=your_proxyserver_port_number
systemProp.https.proxyUser=your_proxyserver_user_name
systemProp.https.proxyPassword=your_proxyserver_user_password
systemProp.https.nonProxyHosts=localhost
systemProp.https.auth.ntlm.domain=your_corporate_domain_name_url

Upvotes: 0

Adam Staszak
Adam Staszak

Reputation: 1704

  1. Check Your internet connection - if it is okay
  2. In Android Studio, disable offline mode, if it is enabled
  3. Just refresh gradle

Upvotes: 1

Kalpesh Narwani
Kalpesh Narwani

Reputation: 84

i have solved it gradle is not able to download dependencies. Check your internet connection

use fast internet

Upvotes: 5

Vanilla_Alan
Vanilla_Alan

Reputation: 9

add the code blow in your project level build.gradle:

repositories {
    mavenCentral()
}

Upvotes: 0

Bala555
Bala555

Reputation: 189

Don't add some codes to build.gradles or any other files

Just refresh it after connect to internet, Because it want some files to download.

You can also download that files externally but it's huge process, Better do it with android studio.

Upvotes: 0

Shima Erfan
Shima Erfan

Reputation: 457

This errors is related to jcenter . probably jcenter doesn't support your area. I had this error too, just a few hours ago. Add this to your app level build.gradle above the buildTypes

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    mavenCentral() }

and in project level build.gradle use mavenCentral and jcenter both together in all places that you see jcenter, like this:

mavenCentral()
jcenter()

Upvotes: 0

Related Questions