Failed to RESOLVE:COM.ANDROID.SUPPORT:APPCOMPAT-V7: error handling

Source: Internet
Author: User

Have you ever had an error when using Android Studio, are you still worrying about its appearance? No problem, read this article, I make sure you will solve it and will be proud to think that this is only a small case-level error. Let's get to the point, first of all, when this error occurs:

1. When you write a project on a different computer from Android Studio, and then copy it down and import it on your computer's Android studio, you will get an error (not the same version of Android Studio installed on two PCs)

2. The version of your Android Studio SDK Platform tool is too low and then, without knowing the project build file (Build.gradle file), open the SDK Manger Update the version of the Project Builder (SDK Build-tools)

Read the above two cases, in fact, you can find their common point, that is the version of the problem, so the above two cases with the same solution can be, how simple

Specific solutions:

1. Since it's a version issue, go to the SDK tool version of your computer installation, click the SDK Manager icon, and then select updates to see

Here, my SDK tool version is 26.1.1.

2. Once you have a clear version of your SDK tools, we will continue to review the version, followed by the SDK build tool (SDK Build-tools) version, or the SDK manager, this time with the Android SDK selected, and then the SDK on the right. Tools (just check the tick option on the line)

Look at this picture, it seems to be able to understand something, right, you will find that I am here is the Android SDK Build-tools (is the SDK build tool I have mentioned earlier) version is 27, and my SDK Tools is 26,

Obviously the version is low, but these do not directly cause the project error, after reading the data, we will look at another one

3. Click to open the project build file Gradle Scripts, and then continue to click Build.gradle (MODULE:APP) PS: There are two names of the same, choose the second one, see the code below the comment line can be

[Java]View PlainCopy
  1. Apply plugin: ' com.android.application '
  2. Android {
  3. Compilesdkversion //SDK compilation with version 27
  4. Buildtoolsversion "27.0.0" //Build tool version number is 27.0.0 corresponding SDK build-tools27
  5. Defaultconfig {
  6. ApplicationID "Com.example.haha.myapplication"
  7. Minsdkversion
  8. Targetsdkversion
  9. Versioncode 1
  10. Versionname "1.0"
  11. Testinstrumentationrunner "Android.support.test.runner.AndroidJUnitRunner"
  12. }
  13. Buildtypes {
  14. Release {
  15. Minifyenabled false
  16. Proguardfiles getdefaultproguardfile (' proguard-android.txt '), ' Proguard-rules.pro '
  17. }
  18. }
  19. }
  20. dependencies {
  21. Compile Filetree (dir: ' Libs ', include: [' *.jar '])
  22. Androidtestcompile (' com.android.support.test.espresso:espresso-core:2.2.2 ', {
  23. Exclude group: ' Com.android.support ', module: ' support-annotations '
  24. })
  25. Compile ' com.android.support:appcompat-v7:27.+ '
[Java]View PlainCopy
    1. //The above line is a remote dependency declaration, here we focus on appcompat-v7:27. +
    2. Testcompile ' junit:junit:4.12 '
    3. }

Let's analyze the appcompat-v7:27.+.

Above we found that our SDK tool version is 26, where the remote dependent package version is 27, then we only need to reduce the version to the SDK tool version of the same OK! [Java]View PlainCopy
  1. Apply plugin: ' com.android.application '
  2. Android {
  3. Compilesdkversion 26//Modify
  4. Buildtoolsversion "27.0.0"
  5. Defaultconfig {
  6. ApplicationID "Com.example.haha.myapplication"
  7. Minsdkversion
  8. Targetsdkversion 26//Modify
  9. Versioncode 1
  10. Versionname "1.0"
  11. Testinstrumentationrunner "Android.support.test.runner.AndroidJUnitRunner"
  12. }
  13. Buildtypes {
  14. Release {
  15. Minifyenabled false
  16. Proguardfiles getdefaultproguardfile (' proguard-android.txt '), ' Proguard-rules.pro '
  17. }
  18. }
  19. }
  20. dependencies {
  21. Compile Filetree (dir: ' Libs ', include: [' *.jar '])
  22. Androidtestcompile (' com.android.support.test.espresso:espresso-core:2.2.2 ', {
  23. Exclude group: ' Com.android.support ', module: ' support-annotations '
  24. })
  25. Compile ' com.android.support:appcompat-v7:26+ '//Modify
  26. Testcompile ' junit:junit:4.12 '
  27. }
Problem solving, because when you create a new project, there is a gradle to help you complete the construction project work, it is natural to build the project according to your highest SDK building tool version, so there will be such a problem, here you may feel that the trough, only the last paragraph is useful, but also so simple, In fact, the front of the cushion to read and add their own understanding, will reap more! If wrong, please give more advice ha! Here's a refill: it's done! Be sure to sync by clicking Sync! SYNC! sync! important things then say 3 times, or click the Try Again shown below

Failed to RESOLVE:COM.ANDROID.SUPPORT:APPCOMPAT-V7: error handling

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.