connection timed out error in online mode and could not open file in offline mode - android studio

113 views Asked by At
repositories {
    maven { url "https://jitpack.io" }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.github.PhilJay:MPAndroidChart:v2.2.2'
}

I am getting the Error:Connection timed out: connect in online mode whereas while changing the gradle setting to offline, I could not open the library.

2

There are 2 answers

0
Muhammad Saad On

Perhaps, your internet connection is too slow. You can download this library from github and import in your project.

Here is github repository link: https://github.com/PhilJay/MPAndroidChart

Just click on download button then select download ZIP and after downloading, copy the folder MPChartLib and paste into your project root directory and compile with gradle.

In your settings.gradle, include ':app', ':MDChartLib' and build.gradle(Module:app), compile project(':MDChartLib')

1
Shivam Oberoi On

Please connect to "Internet" and make it sync again.