Android Studio 添加百分比布局时出错 Failed to reslove 如何解决

在看《第一行代码》第二版按书上写的操作,导入百分比布局时出错。按网上的解决方法,尝试改了几个percent版本不好使。
在\Android\sdk\extras\android\m2repository\com\android\support\percent下打开**maven-metadata.xml**如下
<?xml version="1.0" encoding="UTF-8"?>

com.android.support
percent

25.3.1

22.2.0
23.0.0
23.0.1
23.1.0
23.1.1
23.2.0
24.0.0-alpha1
23.2.1
23.3.0
24.0.0-alpha2
23.4.0
24.0.0-beta1
24.0.0
24.1.0
24.1.1
24.2.0
24.2.1
25.0.0
25.0.1
25.1.0
25.1.1
25.2.0
25.3.0
26.0.0-alpha1
25.3.1

20170322231651


AS里的**build.gradle**文件如下
apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.jingzi.uilayouttest"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android support:percent:24.0.0'
testCompile 'junit:junit:4.12'
}
更新时报错:**Error(27,13)Failed to reslove:com.android.support:percent:24.2.1**
请问应该如何解决?

你没有24.2.1这个版本啊

那怎么看自己有哪个版本?不是在maven-metadata.xml里看到了24.2.1吗,试了24.0.0和26.0.0-alpha1也不好使啊TAT

同求解决方法啊!要疯了

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
applicationId "activitytest.example.com.linearlayout"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:percent:26.1.0'
testCompile 'junit:junit:4.12'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

}

虽然不太懂,但是我成功了,代码发给你
按照书上的代码我的一开始也错了,但是通过他的提示信息(大致说的是导入版本与目标版本不同)因为我的targetSdkVersion 是26,所以切成了api26的版本且为最新本,就成功了
希望能给与一些参考,毕竟聊胜于无

你的是不是少了一个点,android.support