2017-09-20 64 views
1

我更新的SDK版本26後,我試圖建立一個APK,但得到這個錯誤:Android SDK中26生成錯誤

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' 
} 

,但仍得到相同的錯誤

所以如何我能解決這個衝突嗎?

+1

添加您的build.gradle。你的一些依賴鏈接到舊的支持庫 – DeKaNszn

+0

@DeKaNszn添加 –

+0

你能添加'./gradlew app:dependencies --configuration releaseCompileClasspath'的輸出嗎? – DeKaNszn

回答

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 
} 
+0

恭喜!現在,您可以將此答案標記爲已接受。 –

1

您需要堅持使用支持庫25.3.1,因爲facebook sdk版本4.26.0仍在使用它。你可以,但它仍然使用25.3.1看看它的build.gradle

// 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' 

對於onesignal錯誤,請閱讀Troubleshooting Androidñ一下,這裏摘錄:

OneSignal automatically adds the following dependencies;

com.google.android.gms - Version 11.2.+ 
com.android.support - Version 26.1.+ 

If you get mixed version warnings like above in your build.gradle please make sure to update your other dependencies to match these versions.

If you must keep using an older version of these decencies add the following 4 lines, replacing the versions with the ones you require.

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.+' 
+0

檢查更新 –

+0

是的,但它會與Facebook SDK衝突,因爲它仍然使用25.3.1? –

+0

您可以嘗試將sdk更改爲26.1.0,並在Facebook sdk中將支持庫依賴項用於排除。 –