We can see that the reported error is "Failed to resolve:com.android.support:appcompat-v7:16.+", which is the compile item in the last paragraph of our build.gradle.
As auto-generated "com.android.support:appcompat-v7:16.+" is actually compiled according to our minimum version 16来 select 16.x.x and above compilers, because as does not know what the specific compiler version is, so it uses a generic "16.+" to represent more than 16 of the compiler line. This may be the design of the previous as (not verified, just speculation, there are friends who know can provide instructions, thank you!) , which has been deprecated in the new version.
So we're going to find out what version of the SDK compiler the current as is using?
First step: Find the installation path of the SDK, select D:\Users\Administrator\AppData\Local\Android\sdk\build-tools
Can see the highest version of me here is 26.0.3, and then modify Build.gradle in
Android {
Compilesdkversion 26
Buildtoolsversion ' 26.0.3 '
}
Step Two: Find the installation path of the SDK, select D:\Users\Administrator\AppData\Local\Android\sdk\extras\android\m2repository\com\android\ Support
Can see me here the highest version is 26.0.0-ALPHA1, and then modify compile in "COM.ANDROID.SUPPORT:APPCOMPAT-V7:26.0.0-ALPHA1"
Finally, the compilation succeeds!
Problems with install Repository and Sync Project when you debug Android studio