firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.27k stars 575 forks source link

New firebase-analytics 21.4.0 increases dex by 1.2 mb #5446

Open carlonzo opened 1 year ago

carlonzo commented 1 year ago

[REQUIRED] Step 2: Describe your environment

[REQUIRED] Step 3: Describe the problem

I've recently bumped the Firebase bom from 32.3.1 to 32.4.0 which updates firebase-analytics from 21.3.0 to 21.4.0.

Firebase-analytics now depends on androidx.privacysandbox.ads which depends on a bunch of new libraries which make my total dex increase by 1.2mb compressed (and 2.9mb uncompressed).

Here is part of the new dependencies graph

+--- com.google.firebase:firebase-analytics:21.4.0
|    |    |    |    |    |    +--- com.google.android.gms:play-services-measurement:21.4.0
|    |    |    |    |    |    |    +--- androidx.collection:collection:1.0.0 -> 1.2.0 (*)
|    |    |    |    |    |    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
|    |    |    |    |    |    |    +--- com.google.android.gms:play-services-ads-identifier:18.0.0 -> 18.0.1 (*)
|    |    |    |    |    |    |    +--- com.google.android.gms:play-services-basement:18.1.0 -> 18.2.0 (*)
|    |    |    |    |    |    |    +--- com.google.android.gms:play-services-measurement-base:21.4.0 (*)
|    |    |    |    |    |    |    +--- com.google.android.gms:play-services-measurement-impl:21.4.0
|    |    |    |    |    |    |    |    +--- androidx.collection:collection:1.0.0 -> 1.2.0 (*)
|    |    |    |    |    |    |    |    +--- androidx.core:core:1.2.0 -> 1.12.0 (*)
|    |    |    |    |    |    |    |    +--- androidx.privacysandbox.ads:ads-adservices:1.0.0-beta05
|    |    |    |    |    |    |    |    |    +--- androidx.annotation:annotation:1.6.0 -> 1.7.0 (*)
|    |    |    |    |    |    |    |    |    +--- androidx.core:core-ktx:1.8.0 -> 1.12.0 (*)
|    |    |    |    |    |    |    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.21 -> 1.9.10 (*)
|    |    |    |    |    |    |    |    |    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1 -> 1.7.3 (*)
|    |    |    |    |    |    |    |    |    \--- androidx.privacysandbox.ads:ads-adservices-java:1.0.0-beta05 (c)
|    |    |    |    |    |    |    |    +--- androidx.privacysandbox.ads:ads-adservices-java:1.0.0-beta05
|    |    |    |    |    |    |    |    |    +--- androidx.annotation:annotation:1.2.0 -> 1.7.0 (*)
|    |    |    |    |    |    |    |    |    +--- androidx.concurrent:concurrent-futures:1.1.0 (*)
|    |    |    |    |    |    |    |    |    +--- androidx.core:core-ktx:1.8.0 -> 1.12.0 (*)
|    |    |    |    |    |    |    |    |    +--- androidx.privacysandbox.ads:ads-adservices:1.0.0-beta05 (*)
|    |    |    |    |    |    |    |    |    +--- com.google.guava:guava:31.1-android
|    |    |    |    |    |    |    |    |    |    +--- com.google.guava:failureaccess:1.0.1
|    |    |    |    |    |    |    |    |    |    +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|    |    |    |    |    |    |    |    |    |    +--- com.google.code.findbugs:jsr305:3.0.2
|    |    |    |    |    |    |    |    |    |    +--- org.checkerframework:checker-qual:3.12.0
|    |    |    |    |    |    |    |    |    |    +--- com.google.errorprone:error_prone_annotations:2.11.0 -> 2.15.0
|    |    |    |    |    |    |    |    |    |    \--- com.google.j2objc:j2objc-annotations:1.3

The new update brings in the following dependencies I was not having before:

androidx.privacysandbox.ads:ads-adservices:1.0.0-beta05
androidx.privacysandbox.ads:ads-adservices-java:1.0.0-beta05
com.google.code.findbugs:jsr305:3.0.2
com.google.guava:failureaccess:1.0.1
com.google.guava:guava:31.1-android
com.google.j2objc:j2objc-annotations:1.3
org.checkerframework:checker-qual:3.12.0

which, as said before brings a big increase in dex. Is this something that was meant to happen? I believe most of the increase comes from guava which is a fairly large dependency. any way we could opt-out from androidx.privacysandbox.ads dependency? (or the ads-adservices-java module)

google-oss-bot commented 1 year ago

I found a few problems with this issue:

wellcao commented 1 month ago

是的,我也注意到androidx.privacysandbox.ads:ads-adservices:1.0.0-beta05这个库,这个库的AndroidManifest中声明了 <uses-library android:name="android.ext.adservices" android:required="false"/> 但是在ROM打包时会强制校验user-library,如果system的AndroidManifest中没有这个user-library,而应用的AndroidManifest中声明了,会导致ROM编译失败。