Android StudioGradle

Gradle error, Could not find method jcenter() for arguments [] on repository container

Could not find method jcenter()

When i tried to see project dependencies using gradle command in Android Studio Terminal, I get following error,Could not find method jcenter() for arguments [] on repository container.

project_path>gradle -q dependencies app
FAILURE: Build failed with an exception.
Where:
Build file 'projectpathbuild.gradle' line: 4
What went wrong:
A problem occurred evaluating root project 'ProjectName'.
> Could not find method jcenter() for arguments [] on repository container.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

i search for a solution and i see, this issue is due to AndroidStudio using old gradle, in which jcenter() is not supported. Not really sure about exact fix for this. But this following command worked fine,

project_path>gradlew -q :appName:dependencies
+--- project :simplecropimagelib
+--- project :library
| --- com.google.android.gms:play-services:+ -> 6.5.87
| --- com.android.support:support-v4:21.0.0 -> 21.0.2
| --- com.android.support:support-annotations:21.0.2
--- com.android.support:appcompat-v7:21.0.2
--- com.android.support:support-v4:21.0.2 (*)

*the appName you can see in settings.gradle file.

Hope it helps somebody…
Cheers:)

 

 

2 thoughts on “Gradle error, Could not find method jcenter() for arguments [] on repository container

Leave a Reply

Your email address will not be published. Required fields are marked *