我更新到SDK版本26后,我尝试构建一个apk但是出现了这个错误:
Error:Execution failed for task ':app:transformClassesWithFirebasePerformancePluginForFacebookDebug'.
> android/support/v7/app/ActionBarActivity
保持SDK版本25很好,但在build.gradle中收到错误消息说:
all com.android.support libraries must use the exact same version
依赖关系报告(失败的地方):
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:transformClassesWithFirebasePerformancePluginForFacebookDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithFirebasePerformancePluginForFacebookDebug'.
> android/support/v7/app/ActionBarActivity
更新1: 我找到了根本原因但仍然需要一些建议。我查看了依赖项报告。支持库26.1.0来自另一个库
+--- com.onesignal:OneSignal:3.6.2
| +--- com.google.android.gms:play-services-gcm:[10.2.1,11.3.0) -> 11.2.2
| | +--- com.google.android.gms:play-services-base:11.2.2 (*)
| | +--- com.google.android.gms:play-services-basement:11.2.2 (*)
| | \--- com.google.android.gms:play-services-iid:11.2.2
| | +--- com.google.android.gms:play-services-base:11.2.2 (*)
| | \--- com.google.android.gms:play-services-basement:11.2.2 (*)
| +--- com.google.android.gms:play-services-location:[10.2.1,11.3.0) -> 11.2.2
| | +--- com.google.android.gms:play-services-base:11.2.2 (*)
| | +--- com.google.android.gms:play-services-basement:11.2.2 (*)
| | \--- com.google.android.gms:play-services-tasks:11.2.2 (*)
| +--- com.android.support:support-v4:[26.0.0,26.2.0) -> 26.1.0 (*)
| \--- com.android.support:customtabs:[26.0.0,26.2.0) -> 26.1.0 (*)
\---
更新2: 我已将facebook sdk用法设置如下:
compile('com.facebook.android:facebook-android-sdk:4.26.0') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
但仍然得到相同的错误
那么如何从中解决冲突?
答案 0 :(得分:1)
你需要坚持使用支持库25.3.1
,因为facebook sdk版本4.26.0仍在使用它。您可以查看其build.gradle,它仍在使用25.3.1
:
// Facebook Dependencies
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:customtabs:25.3.1'
对于信号错误,请阅读Troubleshooting Android n关于它,此处摘录:
OneSignal会自动添加以下依赖项;
com.google.android.gms - Version 11.2.+ com.android.support - Version 26.1.+
如果您在build.gradle中收到上述混合版本警告 请确保更新您的其他依赖项以匹配这些 版本
如果您必须继续使用这些版本的旧版本,请添加 以下4行,将版本替换为您需要的版本。
compile 'com.google.android.gms:play-services-gcm:11.2.+' compile 'com.google.android.gms:play-services-location:11.2.+' compile 'com.android.support:support-v4:26.1.+' compile 'com.android.support:customtabs:26.1.+'
答案 1 :(得分:0)
最终,我通过强制分配版本来解决它。感谢@Eugen Pechanec和@ישואוהבאותך鼓舞我。
def gmsVersion = '11.2.2'
compile("com.google.android.gms:play-services-gcm:${gmsVersion}") {
force = true
}
compile("com.google.android.gms:play-services-location:${gmsVersion}") {
force = true
}
def androidSupportVersion = '25.3.1'
compile("com.android.support:support-v4:${androidSupportVersion}") {
force = true
}
compile("com.android.support:customtabs:${androidSupportVersion}") {
force = true
}