How to solve this error of Android Studio? - android

A problem occurred configuring root project 'My Application'.
Could not resolve all artifacts for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:3.6.2.
Required by:
project :
No cached version of com.android.tools.build:gradle:3.6.2 available for offline mode.
No cached version of com.android.tools.build:gradle:3.6.2 available for offline mode.
This is my error and I don't know how to solve this please help me to solve this

In Android Studio select
View > Tool Windows > Gradle
from the menu bar.Here On the top of the Gradle window ,click on Toggle Offline Mode button in the Gradle window.

Related

Jenkins: Ionic android build failed

I am beginner of ionic mobile development and now I am setting CI for my mobile application using Jenkins (on localhost). I am facing an error that I am unable to resolve for many days. ionic compiles successfully but at the last at the time of android build preparation it fails and gives error I mentioned below.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.0.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.0.0.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> corphttpsproxyhost.yourdomain: Name or service not known
> Could not resolve com.android.tools.build:gradle:3.0.0.
> Could not get resource 'https://maven.google.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Could not GET 'https://maven.google.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> corphttpsproxyhost.yourdomain
Please let me know where I am committing mistake, or is there any other dependency issue.
Thanks
I think you did not add gradle 3.0.0
You can do this by going to “Configure System” (Jenkins 1.x) or to “Global Tool Configuration” (Jenkins 2.x). From the home page navigate to:
Manage Jenkins -> Configure System (Jenkins 1.x)
Manage Jenkins -> Global Tool Configuration (Jenkins 2.x)
Scroll down a little bit and you should encounter a small section for gradle with a single button labeled “Gradle installations…”. Click on that button to expand the configuration panel.
The gradle configuration panel will ask for a few parameters. Here you can set the tool to a static path, or let Jenkins handle the installation for you. We recommend using “Install automatically” for ease of use. Below is an example of an automatic installation of gradle 3.0.0
than you have to select this gradle version from your project configration.
in bbuild tab
add Invoke Gradle script
Invoke Gradle
X Gradle Version 3.0.0
than build it it may help you

Failed to resolve dependencies .?

Hello i have just imported my android studio project from one pc to another one and when building it is showing the error , Unresolved dependencies detected while building project in offine mode . I have unchecked OFFLINE WORK in Gradle settings . After Unchecking it its now showing the error
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.android.support:support-v4:23.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-v4/23.0.1/support-v4-23.0.1.pom
https://jcenter.bintray.com/com/android/support/support-v4/23.0.1/support-v4-23.0.1.jar
file:/C:/Users/user/AppData/Local/Android/sdk1/extras/android/m2repository/com/android/support/support-v4/23.0.1/support-v4-23.0.1.pom
file:/C:/Users/user/AppData/Local/Android/sdk1/extras/android/m2repository/com/android/support/support-v4/23.0.1/support-v4-23.0.1.jar
file:/C:/Users/user/AppData/Local/Android/sdk1/extras/google/m2repository/com/android/support/support-v4/23.0.1/support-v4-23.0.1.pom
file:/C:/Users/user/AppData/Local/Android/sdk1/extras/google/m2repository/com/android/support/support-v4/23.0.1/support-v4-23.0.1.jar
Required by:
TheFlame:app:unspecified > com.android.support:appcompat-v7:22.2.0
TheFlame:app:unspecified > com.android.support:design:22.2.0
TheFlame:app:unspecified > com.android.support:recyclerview-v7:22.2.0
Could not find com.android.support:support-v4:23.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-v4/23.0.1/support-v4-23.0.1.pom
https://jcenter.bintray.com/com/android/support/support-v4/23.0.1/support-v4-23.0.1.jar
file:/C:/Users/user/AppData/Local/Android/sdk1/extras/android/m2repository/com/android/support/support-v4/23.0.1/support-v4-23.0.1.pom
file:/C:/Users/user/AppData/Local/Android/sdk1/extras/android/m2repository/com/android/support/support-v4/23.0.1/support-v4-23.0.1.jar
file:/C:/Users/user/AppData/Local/Android/sdk1/extras/google/m2repository/com/android/support/support-v4/23.0.1/support-v4-23.0.1.pom
file:/C:/Users/user/AppData/Local/Android/sdk1/extras/google/m2repository/com/android/support/support-v4/23.0.1/support-v4-23.0.1.jar
Required by:
TheFlame:app:unspecified > me.dm7.barcodescanner:zxing:1.8.3 > me.dm7.barcodescanner:core:1.8.3
can anyone please help me on this fast.
Similiar Issue
Make sure to update both "Android Support Repository" and "Android Support Library" in SDK Manager
And also ensure the Gradle Sync is completed in Android Studio.
Try this:
1) Open SDK Manager
2) Launch standalone SDK Manager
3) Extras and check update for Support Library
4) Install it
5) Sync Gradle

Error:Failed to find: com.google.protobuf:protobuf-java:2.5 in Android Studio imported project

I imported an existing Android project in the Android Studio but it does not build because of this :
Error:A problem occurred configuring project ':appName'.
> A problem occurred configuring project ':myTracksLib'.
> Could not resolve all dependencies for configuration ':myTracksLib:_debugCompile'.
> Could not find com.google.protobuf:protobuf-java:2.5.
Searched in the following locations:
https://jcenter.bintray.com/com/google/protobuf/protobuf-java/2.5/protobuf-java-2.5.pom
https://jcenter.bintray.com/com/google/protobuf/protobuf-java/2.5/protobuf-java-2.5.jar
file:/Users/name/Library/Android/sdk/extras/android/m2repository/com/google/protobuf/protobuf-java/2.5/protobuf-java-2.5.pom
file:/Users/name/Library/Android/sdk/extras/android/m2repository/com/google/protobuf/protobuf-java/2.5/protobuf-java-2.5.jar
file:/Users/name/Library/Android/sdk/extras/google/m2repository/com/google/protobuf/protobuf-java/2.5/protobuf-java-2.5.pom
file:/Users/name/Library/Android/sdk/extras/google/m2repository/com/google/protobuf/protobuf-java/2.5/protobuf-java-2.5.jar
Required by:
AppName:myTracksLib:unspecified
How can I solve that? Project builds in Eclipse so I do not know why this is happening.
I have seen this but I do not know how it related to Android Studio or not.
According to the search function of Maven Central:
http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.google.protobuf%22%20AND%20a%3A%22protobuf-java%22
There's a 2.5.0 version, not 2.5. Try changing the version in your build script to 2.5.0.

Android Studio - Could not download artifact

I am new to Android Studio IDE. I have created a sample project using Android Studio and when I tried to build it, it comes with the following error.
Error:A problem occurred configuring root project 'SampleApp".
> Could not resolve all dependencies for configuration ':classpath'.
> Could not download artifact 'org.bouncycastle:bcprov-jdk15on:1.48:bcprov-jdk15on.jar': No
cached version available for offline mode
Can anyone please figure out what I did wrong.
It needs to download that library in order to do your build, but you've (perhaps inadvertantly) put Android Studio into offline mode. To fix it, go to Preferences > Gradle and ensure that the "Offline work" checkbox is not checked.
I think you should add following code at the top level of your build.gradle:
repositories {
mavenCentral()}
You might also need to try with --refresh-dependencies.
You can take more help from this here.

Android Studio Gradle Download Error

When I load Android Studio, I get an error
Gradle 'HelloWorld' project refresh failed
Error:Could not download artifact 'com.android.tools.build:builder-model:0.12.1:builder- model.jar': No cached version available for offline mode
Not only this but Android Studio takes a long time to load a project; stuck on Gradle Resolve Dependencies.
I am on Windows 8.1 and using JDK 8
How would I fix this?
You probably have Android Studio configured to use Gradle in offline mode, and it's failing because it lacks dependencies that it needs to download. Make sure your computer has internet connectivity, and in Preferences > Gradle > Offline work, make sure that setting is unchecked.
For Android Studio 3.3.2 -
Open File > Settings > Gradle > (unchecked) offline work on Global Gradle Setting.
Make sure that you have internet connection and try to sync your project more (or File > Sync project with gradle files).
the simplest solution is -
click file > project structure > Gradle Setting >
now check if your "Gradle user Home" field is empty if it is . then enter the path of your gradle.
your gradle should be stored in
C > users > .gradle
copy the path and enter it here and now click on gradle build button on top right in your android studio.

Categories

Resources