Skip to main content

How To Solve Gradle Error Failed to resolve: com.android.support:appcompat-v7:26.0.0 When Building An Android App

If you are building your Android applications in Android Studio or another IDE, you may come across the following error:

Could not resolve all dependencies for configuration ':app:_debugApkCopy'. > Could not find any version that matches com.android.support:appcompat-v7:27.+. Versions that do not match: 26.0.0-alpha1 25.3.1 25.3.0 25.2.0 25.1.1 + 31 more Required by: project :app > Could not find any version that matches com.android.support:design:27.+. Versions that do not match: 26.0.0-alpha1 25.3.1 25.3.0 25.2.0 25.1.1 + 21 more Required by: project :whateverYourProjectAppNameIs

This is happening because there has been a change that requires an update in your code. You used to be able to download the Google support files through the SDK Manager. This is the familiar place where you select all of the items that you want to add and the system will then fetch those items and add them to your setup. Google, however, has now decided that they will not provide support libraries in this way anymore. Google now requires you to go through their Maven repositories to get support files. This means that you will need to modify where Gradle looks for support files. It is very simple to update your project to look in the right place.

  1. Locate the build.gradle for your PROJECT. NOTE - Make sure you locate your PROJECT build.gradle file and not the build.gradle file for your modules.
  2. Under jCenter(), add a new item for maven. It should look like this: 

    allprojects {
        repositories {
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
    }
    

  3. Save and build your project now. The error should now be gone and you should be good to go :-).

Since, Gradle was complaining about not being able to locate the dependency, you don't need to update the dependencies area in the module build.gradle file at this time. Just adding the line for the Maven repository should be enough to get Gradle building your application.


Enjoy!
Kila Morton

Comments

Post a Comment

Popular posts from this blog

How To Solve The 'sudo' is not recognized as an internal or external command, operable program or batch file Message

Recently, I was talking with a developer about  sudo and how they initially didn't realize what sudo was. The developer had never worked on anything other than computers running Microsoft Windows. That gave me the idea for this little programming tip on the alternative to sudo when you are using a Windows machine. First, some history. Sudo can be called the one command to rule them all when you are working on a Unix based system. In fact, it really IS the one command to rule them all on those types of systems! Sudo is pronounced "sue dough" and it stands for "super user do" or "substitute user do". It is a program that allows you to run programs with the security privileges of another user. That user, by default, is the superuser for the machine you are on - hence, the original meaning of "super user do". The sudo program was enhanced to include the ability to run commands as other special users - not only as the superuser - hence ...

How To Solve Connection attempt failed with "EAI_NONAME - Neither Nodename Nor Servname Provided, Or Not Known

If you have ever tried to import a file into FileZilla from your domain host only to find that using the supplied settings produced the, Connection-attempt-failed-with-EAI_NONAME---Neither-nodename-nor-servname-provided-or-not-known".   error, you are in luck. I am going to show you a quick way to take care of this issue. When you are using an FTP client to connect to your site, you typically have a setup that looks something like this. (Note - if you are using FileZilla, your screen looks EXACTLY like this, since this is the ftp client I am using here.) Notice the area I have highlighted in Yellow. This is the problem child in this scenario. Although your hosting company may have stated that you should use ftp.YourWebsite.com, that is often NOT the correct thing for you to use to gain remote ftp access to your site. The error means that the program cannot resolve the dns entry for your site. Instead of using ftp.YourWebsite.com, you need to replace the host ftp.YourWeb...

How To Reset Your Entry Processes Or How To Clear Your Entry Processes In A Shared Hosting Environment Using CPanel

One of the most frustrating things is to wake up one morning and discover that your website is down (a 508 error) and you don't have a tool to get it back up and, instead, have to contact your hosting company to reset things for you. Sometimes, if you are using a content management system, the issue may be something as simple as a plugin. Do you really want to have to reach out to your host every time you have an issue? If you don't, I am going to show you one way to get your account back up and running. This will not work for everyone, but if you are using certain technologies, it will work for you. What you will need: Access to your cPanel. An account running PHP ISSUE: You have used up all of your allocated server resources and your site is now experiencing a 503 or 508 error and is not allowing any traffic to reach your site. SOLUTION: Log into your cPanel account. If you do not have a cPanel account, this won't work for you. Search for Select PHP Versi...