2016-09-28 79 views
4

我正在使用MobileFirst 7庫作爲原生Android應用程序,但已經發現它嚴重增加了我的Android應用程序(通過65,536 limit推送它)的dex方法計數。IBM MobileFirst 7依賴關係

Adding the IBM MobileFirst Platform Foundation SDK to a new or existing application with Android Studio文章中,我增加了以下我build.gradle

compile group: 'com.ibm.mobile.foundation', 
     name: 'ibmmobilefirstplatformfoundation', 
     version: '7.1.0.0', 
     ext: 'aar', 
     transitive: true 

methodscount.com的MobileFirst庫(和它的依賴),在高達39364種方法拉(可用DEX方法計數的60% )!

我想通Proguard的可能有助於降低使用MobileFirst的影響,但發現的例子proguard-project.txt具有以下指令:

-keep class com.google.** { *;} 

據我瞭解,這有效地告訴Proguard的不刪除任何Google Guava的方法。 MobileFirst還有其他一些庫,但我從番石榴開始,因爲它是最大的。

於是我決定看看多少MobileFirst如何利用番石榴庫:

$ unzip ibmmobilefirstplatformfoundation-7.1.0.aar 
$ jadx --output-dir temp/ classes.jar 
$ grep -roh . -e 'com.google.common.*' | sort | uniq 

其中發現零個引用任何番石榴庫(授予的反編譯器可能會丟失一些參考的),但它似乎排除了番石榴的依賴性?

compile(group: 'com.ibm.mobile.foundation', 
     name: 'ibmmobilefirstplatformfoundation', 
     version: '7.1.0.0', 
     ext: 'aar', 
     transitive: true) { 
    exclude group: 'com.google.guava', module: 'guava' 
} 

如果不是這種情況(但不包括番石榴將是一個問題),那麼:

  • 有沒有可以用來僅保留,在MobileFirst是必要的方法更好Proguard的規則依賴呢?
  • MobileFirst所依賴的其他大型圖書館是否也被排除?

回答

1

如果你不使用JSONStore功能,您可以安全地排除下列:

  • guava.jar
  • 公地codec.jar
  • jackson- *
+0

謝謝!這有助於一噸! org.bouncycastle。*的任何機會都可以被排除(因爲它是下一個大的依賴)?我相信它是在MobileFirst擁有的「org.bouncycastle:bcprov-jdk15on:1.48」依賴下提取的? – Travis