2016-09-22 151 views
0

我在build.gradle文件中將minifyEnabled更改爲true。然後,我就這個問題Android Gradle構建失敗(發佈構建類型)

Warning:Exception while processing task java.io.IOException: Please correct the above warnings first. 
    :app:transformClassesAndResourcesWithProguardForRelease FAILED 
    Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'. 
    > java.io.IOException: Please correct the above warnings first. 

依賴

compile fileTree(include: ['*.jar'], dir: 'libs') 
compile files('libs/YouTubeAndroidPlayerApi.jar') 
debugCompile project(path: ':djlibrary') 
releaseCompile project(path: ':djlibrary') 
compile 'com.android.support:cardview-v7:24.1.1' 
compile 'com.android.support:appcompat-v7:24.1.1' 
compile 'com.android.support:design:24.1.1' 
compile 'com.google.firebase:firebase-database:9.2.1' 
compile 'com.google.firebase:firebase-messaging:9.2.1' 
compile 'com.google.firebase:firebase-auth:9.2.1' 
compile 'com.google.android.gms:play-services-gcm:9.2.1' 
compile 'com.facebook.android:facebook-android-sdk:[4,5)' 
compile 'com.android.support:support-v4:24.1.1' 
compile 'com.android.support:recyclerview-v7:24.1.1' 

有一些問題使用ProGuard。請幫助我把它做

+0

http://stackoverflow.com/questions/33877134/errorexecution-failed-for-task-androidtransformclassesandresourceswithprogua –

+0

@jay檢查此鏈接可能會有所幫助[http://stackoverflow.com/questions/27547757/proguardrelease-failed - 當編譯 - apk與組裝發佈 - 在 - 安卓工作室] –

+0

'請先糾正上述警告。「你的警告告訴你什麼? – nenick

回答

0

當使用火力地堡認證compile 'com.google.firebase:firebase-auth:9.2.1'嘗試添加以下標誌到proguard-rules.pro:

-keepattributes Signature 
-keepattributes *Annotation* 

Set up Firebase Authentication for Android更多。

對於Firebase實時數據庫compile 'com.google.firebase:firebase-database:9.2.1'您需要考慮模型對象在混淆後如何被序列化和反序列化。有關詳情,請閱讀Set up Firebase Realtime Database for Android