![](/img/trans.png)
[英]Calligraphy font not getting applied In release build of Android app with dexguard
[英]FCM 15.0.2 cannot make token in release build with Dexguard
我正在使用 FCM 和 Dexguard。 FCM 無法在發布版本中制作令牌。 但是,它在調試版本中運行良好。
我的畢業設置
classpath 'com.google.gms:google-services:3.2.1'
compile 'com.google.android.gms:play-services-base:15.0.2'
compile 'com.google.android.gms:play-services-analytics:15.0.2'
compile 'com.google.firebase:firebase-core:15.0.2'
compile 'com.google.firebase:firebase-messaging:15.0.2'
並且, ShrinkResources = false
並由 Dexguard 優化 5 次
gradle version : 4.1
android gradle plugin : 2.3.3
dexguardFile 中與 FCM 相關的選項
-keep public class com.google.firebase.** { *; }
-keep public class com.google.firebase.iid.FirebaseInstanceId { public *;}
Firebase 15+ 需要一些額外的規則。 例如,最新的 DexGuard 版本 8.2.09 包括所有必要的配置。
添加以下 dexguard 規則以解決問題:
-keep class com.google.firebase** { *; }
-dontshrink
似乎 dexguard 刪除了所有未在代碼中直接引用的類。 因此,如果允許縮小,那么在混淆過程中將刪除諸如服務類以獲取 firebase 令牌 (FirebaseInstanceIdService) 的入口點。
由於 T. Neidhart 上面的回答,我在 Firebase 分析中遇到了類似的問題,它適用於調試版本,但不適用於發布版本,我從 Dexguard 8.4.13 示例中找到了這個塊 - samples/advanced/GooglePlayServices/AdMob/dexguard-project。 txt ,它為我解決了問題。
-keep public class !**.internal.**, com.google.** {
public protected *;
}
# We can repackage all obfuscated classes in a new internal package.
-repackageclasses com.google.internal
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.