幕后发生了一些事情,由于依赖堆栈中的冲突,我的项目将不再构建和/或运行。
我试图修改依赖项的版本号,并确认facebookSDK项目设置为使用支持lib v22构建。我怎样才能弄清楚是什么导致v23 appcompat支持lib进入我的项目?
以下是我得到的构建错误:
/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.0/res/values-v23/values-v23.xml 错误:(2)检索项目的父项时出错:找不到与给定名称匹配的资源 '机器人:TextAppearance.Material.Widget.Button.Inverse'。 错误:(2)检索项目的父项时出错:找不到与给定名称“android:Widget.Material.Button.Colored”匹配的资源。
和gradle信息:
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 22
multiDexEnabled true
}
}
dependencies {
compile project(':facebookSDK')
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.android.support:multidex:1.0.0'
...
}
答案 0 :(得分:2)
Facebook及其facebook-android-sdk
尝试尽可能保持最新的依赖关系。您的23.0.0
Android支持库版本存在问题,我23.1.1
...: - )
我强烈建议您将现有配置更改为此配置:
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 22
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:multidex:1.0.0'
...
compile 'com.facebook.android:facebook-android-sdk:4.+'
}
看,你甚至可以将facebook-android-sdk添加为Gradle的依赖项,这样你就可以删除existsin文件夹而不用担心保持新鲜感。
你也可以保持低targetSdkVersion
,这在你不想实现Android权限或打盹模式兼容性等方面很好。
希望它会有所帮助
答案 1 :(得分:1)
您可以将这些行更新为最新版本,而不会影响您可以运行代码的API级别。您缺少v23资源,因此请至少使用版本23进行编译。
compileSdkVersion 22
buildToolsVersion "22.0.1"
这些行应该是相同的版本,但在使用support:design
库时甚至不需要它们。随意删除这些。
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:appcompat-v7:22.2.1'
对于这一行,我非常怀疑您使用的是所有Google Play服务。请阅读您应用中的only using those you really need。
compile 'com.google.android.gms:play-services:8.4.0'
在你缩小这些可能性后,我建议你使用这些(从经验来看,似乎工作正常)。
compile 'com.android.support:design:23+'
compile 'com.android.support:cardview-v7:23+'
由于您尚未显示Facebook依赖关系,因此很难就此提供建议