【发布时间】:2017-09-22 09:04:42
【问题描述】:
在我将 TabLayout 添加到 .xml 布局之前,一切都运行良好且编译正常。添加后,项目只是拒绝编译,并且我的所有 .xml 文件都停止显示任何内容,并且我的所有库导入都说“无法解析符号...”。
我不明白为什么我以前编译良好的所有导入现在都简单地说:
无法解决:com.android.support:support-v13:26
无法解决:com.android.support:appcompat-v7:26
并且没有提供任何按钮(例如“安装存储库和同步项目”)是可点击的。
请看一下gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.prett.myapplication"
minSdkVersion 22
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'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
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:26'
compile 'com.android.support:support-v13:26'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
}
我尝试过“使缓存无效/重新启动”,但没有任何影响。
附言
compile 'com.android.support:design:25.3.1'
这么说
此支持库不应使用与 compileSdkVersion (26) 不同的版本 (25)
这也会导致问题吗?
【问题讨论】:
-
不管怎样,所有支持库使用相同的版本
标签: java android gradle android-support-library