Reputation: 1
I found an old android project from github but I can't run it. It gives me a lot of errors. like
9:13 PM Gradle sync failed: Could not find com.android.tools.build:gradle:3.6.2.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.6.2/gradle-3.6.2.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.6.2/gradle-3.6.2.jar
Required by:
:Android-Hospital-Management-Client-master:unspecified
Consult IDE log for more details (Help | Show Log) (8 s 451 ms)
I thought it because that not update the dependencies and I change compile to implementation like this and update all the dependices like the below.
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.shivam.openmrs"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible,GradleCompatible
implementation 'com.android.support:appcompat-v7:22.1.1'
implementation 'br.com.liveo:navigationdrawer-material:1.0.5'
implementation 'com.rengwuxian.materialedittext:library:1.8.2'
implementation 'com.github.navasmdc:MaterialDesign:@aar'
implementation 'com.afollestad:material-dialogs:0.6.2.4'
implementation 'com.parse.bolts:bolts-android:1.5.0'
implementation fileTree(dir: 'libs', include: 'Parse-*.jar')
implementation fileTree(dir : 'libs', include: 'commons-lang3-3.4.jar')
implementation fileTree(dir : 'libs', include: 'commons-io-2.4.jar')
implementation 'com.getbase:floatingactionbutton:1.5.1'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.jjoe64:graphview:4.0.1'
implementation 'com.github.PhilJay:MPAndroidChart:v2.1.0'
}
This is a photo of that error um getting after run it.
Error:
.
How I fix this and run it ?
Upvotes: 0
Views: 2943
Reputation: 175
Change the gradle version to newer version such as 4.0.2 in build.gradle and sync project
Upvotes: 2
Reputation: 1347
Please find this panel at the left of Android Studio to check offline mode
rm -rf ~/.gradle/caches/
after that please click on Invalidate Caches/Restart
from File menu then further processing will happen which downloads all the libraries again so it takes time but also resolves this issue.
Upvotes: 0
Reputation: 372
It would definitely give a lot of errors because your android studio configuration is too different from any other project configuration.
It also happens with me many times. If I found one error then more other errors came out. but I solved the way to get out of here
The main stuff to run the projects is the XML and Java and little bit of drawable and value. So just copy all of that and paste into your project Because this stuff doesn't get changed with time.
I hope it would help you And if it is much important to you so you would definitely do the steps given. So, have a nice day!!! Stay learning, Stay safe
:)
Upvotes: 0
Reputation: 961
please try it
Click File > Settings (on macOS, Android Studio > Preferences ) to open the Settings dialog.
In the left pane, expand Build, Execution, Deployment and then click Gradle .
Under Global Gradle settings, uncheck the Offline work checkbox.
Click Apply or OK for your changes to take effect.
Upvotes: 0