Skip to content

Commit

Permalink
Switch from individual Firebase Android SDK versions to Android BoM (#…
Browse files Browse the repository at this point in the history
…949)

* Remove play-services-base dependency from all except AdMob.

* Update Gradle files to use Android BoM instead of individual versions.

* Update readme for Android BoM.

* Fix formatting

* Add note about play-services-base

* Add play-services-base back in for now, will fix in a future PR.

* ADd back to admob too

* Add play-services-base back to RC

* Add play_services to separate dependency that can be included with or without app.

* Add Play Services by default; if you don't want it, use appWithoutPlayServices.

* Fix error, modify readme

* Fix gradle dependencies file

* Fix note

* Update to latest BoM.
  • Loading branch information
jonsimantov authored Jun 10, 2022
1 parent 20a0450 commit 486bb50
Show file tree
Hide file tree
Showing 13 changed files with 113 additions and 77 deletions.
33 changes: 19 additions & 14 deletions Android/firebase_dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ import org.gradle.util.ConfigureUtil;

// A map of library to the dependencies that need to be added for it.
def firebaseDependenciesMap = [
'app' : ['com.google.firebase:firebase-analytics:21.0.0'],
'app' : ['com.google.firebase:firebase-analytics'],
'play_services' : ['com.google.android.gms:play-services-base:18.0.1'],
'admob' : ['com.google.firebase:firebase-ads:19.8.0',
'com.google.firebase:firebase-analytics:21.0.0'],
'analytics' : ['com.google.firebase:firebase-analytics:21.0.0'],
'auth' : ['com.google.firebase:firebase-auth:21.0.5'],
'database' : ['com.google.firebase:firebase-database:20.0.5'],
'dynamic_links' : ['com.google.firebase:firebase-dynamic-links:21.0.1'],
'firestore' : ['com.google.firebase:firebase-firestore:24.1.2'],
'functions' : ['com.google.firebase:firebase-functions:20.1.0'],
'installations' : ['com.google.firebase:firebase-installations:17.0.1'],
'invites' : ['com.google.firebase:firebase-invites:17.0.0'],
'com.google.firebase:firebase-analytics'],
'analytics' : ['com.google.firebase:firebase-analytics'],
'auth' : ['com.google.firebase:firebase-auth'],
'database' : ['com.google.firebase:firebase-database'],
'dynamic_links' : ['com.google.firebase:firebase-dynamic-links'],
'firestore' : ['com.google.firebase:firebase-firestore'],
'functions' : ['com.google.firebase:firebase-functions'],
'installations' : ['com.google.firebase:firebase-installations'],
'invites' : ['com.google.firebase:firebase-invites'],
// Messaging has an additional local dependency to include.
'messaging' : ['com.google.firebase:firebase-messaging:23.0.5',
'messaging' : ['com.google.firebase:firebase-messaging',
'firebase_cpp_sdk.messaging:messaging_java',
'androidx.core:core:1.6.0-alpha03',
'com.google.flatbuffers:flatbuffers-java:1.12.0'],
'performance' : ['com.google.firebase:firebase-perf:20.1.0'],
'remote_config' : ['com.google.firebase:firebase-config:21.1.0'],
'storage' : ['com.google.firebase:firebase-storage:20.0.1'],
'performance' : ['com.google.firebase:firebase-perf'],
'remote_config' : ['com.google.firebase:firebase-config'],
'storage' : ['com.google.firebase:firebase-storage'],
'testlab' : []
]

Expand Down Expand Up @@ -149,6 +149,10 @@ project.afterEvaluate {
firebaseCpp.dependencies.libSet.add('play_services')
}

// Add the bill-of-materials
project.dependencies {
implementation platform('com.google.firebase:firebase-bom:30.1.0')
}
for (String lib : firebaseCpp.dependencies.libSet) {
// Generate and include the proguard file
generateAndAddProguard(lib)
Expand All @@ -166,4 +170,5 @@ project.afterEvaluate {
}
}
}

}
3 changes: 2 additions & 1 deletion admob/admob_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ android {
}

dependencies {
implementation 'com.google.firebase:firebase-analytics:21.0.0'
implementation platform('com.google.firebase:firebase-bom:30.0.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-ads:19.8.0'
}

Expand Down
3 changes: 2 additions & 1 deletion app/app_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ android {
}

dependencies {
implementation 'com.google.firebase:firebase-analytics:21.0.0'
implementation platform('com.google.firebase:firebase-bom:30.0.0')
implementation 'com.google.firebase:firebase-analytics'
}

afterEvaluate {
Expand Down
3 changes: 2 additions & 1 deletion app/google_api_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ android {
}

dependencies {
implementation 'com.google.firebase:firebase-analytics:21.0.0'
implementation platform('com.google.firebase:firebase-bom:30.0.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.android.gms:play-services-base:18.0.1'
implementation project(':app:app_resources')
}
Expand Down
2 changes: 1 addition & 1 deletion app/integration_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ android {

apply from: "$gradle.firebase_cpp_sdk_dir/Android/firebase_dependencies.gradle"
firebaseCpp.dependencies {
app
appWithoutPlayServices
}

apply plugin: 'com.google.gms.google-services'
Expand Down
5 changes: 3 additions & 2 deletions app/invites_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ android {
}

dependencies {
implementation 'com.google.firebase:firebase-analytics:21.0.0'
implementation 'com.google.firebase:firebase-dynamic-links:21.0.1'
implementation platform('com.google.firebase:firebase-bom:30.0.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-dynamic-links'
implementation project(':app:app_resources')
}

Expand Down
5 changes: 3 additions & 2 deletions auth/auth_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ android {
}

dependencies {
implementation 'com.google.firebase:firebase-analytics:21.0.0'
implementation 'com.google.firebase:firebase-auth:21.0.5'
implementation platform('com.google.firebase:firebase-bom:30.0.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-auth'
implementation project(':app:app_resources')
}

Expand Down
5 changes: 3 additions & 2 deletions database/database_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ android {
}

dependencies {
implementation 'com.google.firebase:firebase-analytics:21.0.0'
implementation 'com.google.firebase:firebase-database:20.0.5'
implementation platform('com.google.firebase:firebase-bom:30.0.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-database'
//implementation project(':app:app_resources')
}

Expand Down
5 changes: 3 additions & 2 deletions firestore/firestore_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ android {
}

dependencies {
implementation 'com.google.firebase:firebase-analytics:21.0.0'
implementation 'com.google.firebase:firebase-firestore:24.1.2'
implementation platform('com.google.firebase:firebase-bom:30.0.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-firestore'
}

afterEvaluate {
Expand Down
5 changes: 3 additions & 2 deletions messaging/messaging_java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ android {
}

dependencies {
implementation 'com.google.firebase:firebase-analytics:21.0.0'
implementation 'com.google.firebase:firebase-messaging:23.0.5'
implementation platform('com.google.firebase:firebase-bom:30.0.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.flatbuffers:flatbuffers-java:1.12.0'
}

Expand Down
32 changes: 18 additions & 14 deletions release_build_files/Android/firebase_dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ import org.gradle.util.ConfigureUtil;

// A map of library to the dependencies that need to be added for it.
def firebaseDependenciesMap = [
'app' : ['com.google.firebase:firebase-analytics:21.0.0'],
'app' : ['com.google.firebase:firebase-analytics'],
'play_services' : ['com.google.android.gms:play-services-base:18.0.1'],
'admob' : ['com.google.firebase:firebase-ads:19.8.0',
'com.google.firebase:firebase-analytics:21.0.0'],
'analytics' : ['com.google.firebase:firebase-analytics:21.0.0'],
'auth' : ['com.google.firebase:firebase-auth:21.0.5'],
'database' : ['com.google.firebase:firebase-database:20.0.5'],
'dynamic_links' : ['com.google.firebase:firebase-dynamic-links:21.0.1'],
'firestore' : ['com.google.firebase:firebase-firestore:24.1.2'],
'functions' : ['com.google.firebase:firebase-functions:20.1.0'],
'installations' : ['com.google.firebase:firebase-installations:17.0.1'],
'invites' : ['com.google.firebase:firebase-invites:17.0.0'],
'com.google.firebase:firebase-analytics'],
'analytics' : ['com.google.firebase:firebase-analytics'],
'auth' : ['com.google.firebase:firebase-auth'],
'database' : ['com.google.firebase:firebase-database'],
'dynamic_links' : ['com.google.firebase:firebase-dynamic-links'],
'firestore' : ['com.google.firebase:firebase-firestore'],
'functions' : ['com.google.firebase:firebase-functions'],
'installations' : ['com.google.firebase:firebase-installations'],
'invites' : ['com.google.firebase:firebase-invites'],
// Messaging has an additional local dependency to include.
'messaging' : ['com.google.firebase:firebase-messaging:23.0.5',
'messaging' : ['com.google.firebase:firebase-messaging',
'com.google.firebase.messaging.cpp:firebase_messaging_cpp@aar',
'androidx.core:core:1.6.0-alpha03',
'com.google.flatbuffers:flatbuffers-java:1.12.0'],
'performance' : ['com.google.firebase:firebase-perf:20.1.0'],
'remote_config' : ['com.google.firebase:firebase-config:21.1.0'],
'storage' : ['com.google.firebase:firebase-storage:20.0.1'],
'performance' : ['com.google.firebase:firebase-perf'],
'remote_config' : ['com.google.firebase:firebase-config'],
'storage' : ['com.google.firebase:firebase-storage'],
'testlab' : []
]

Expand Down Expand Up @@ -124,6 +124,10 @@ project.afterEvaluate {
firebaseCpp.dependencies.libSet.add('play_services')
}

// Add the bill-of-materials
project.dependencies {
implementation platform('com.google.firebase:firebase-bom:30.1.0')
}
for (String lib : firebaseCpp.dependencies.libSet) {
// Messaging includes an aar, which to be depended on properly requires
// the folder containing it to be added this way.
Expand Down
84 changes: 51 additions & 33 deletions release_build_files/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,88 +78,91 @@ distributed as part of the core Firebase

Feature | Required Libraries and Gradle Packages
-------------------------- | --------------------------------------
All Firebase SDKs | platform(com.google.firebase:firebase-bom:30.0.0)
| | (Android Bill of Materials)
Firebase AdMob | libfirebase_admob.a
| | libfirebase_app.a
| | com.google.firebase:firebase-analytics:21.0.0
| | com.google.firebase:firebase-analytics
| | (Maven package)
| | com.google.firebase:firebase-ads:19.8.0
| | (Maven package)
| | com.google.android.gms:play-services-base:18.0.1
| | (Maven package)
Firebase Analytics | libfirebase_analytics.a
| | libfirebase_app.a
| | com.google.firebase:firebase-analytics:21.0.0
| | com.google.firebase:firebase-analytics
| | (Maven package)
Firebase Authentication | libfirebase_auth.a
| | libfirebase_app.a
| | com.google.firebase:firebase-analytics:21.0.0
| | com.google.firebase:firebase-analytics
| | (Maven package)
| | com.google.firebase:firebase-auth:21.0.5
| | com.google.firebase:firebase-auth
| | (Maven package)
Firebase Dynamic Links | libfirebase_dynamic_links.a
| | libfirebase_app.a
| | com.google.firebase:firebase-analytics:21.0.0
| | com.google.firebase:firebase-analytics
| | (Maven package)
| | com.google.firebase:firebase-dynamic-links:21.0.1
| | com.google.firebase:firebase-dynamic-links
| | (Maven package)
Cloud Firestore | libfirebase_firestore.a
| | libfirebase_auth.a
| | libfirebase_app.a
| | com.google.firebase:firebase-analytics:21.0.0
| | com.google.firebase:firebase-analytics
| | (Maven package)
| | com.google.firebase:firebase-firestore:24.1.2
| | com.google.firebase:firebase-firestore
| | (Maven package)
| | com.google.firebase:firebase-auth:21.0.5
| | com.google.firebase:firebase-auth
| | (Maven package)
Firebase Functions | libfirebase_functions
| | libfirebase_auth.a (optional)
| | libfirebase_app.a
| | com.google.firebase:firebase-analytics:21.0.0
| | com.google.firebase:firebase-analytics
| | (Maven package)
| | com.google.firebase:firebase-functions:20.1.0
| | com.google.firebase:firebase-functions
| | (Maven package)
| | com.google.firebase:firebase-auth:21.0.5
| | com.google.firebase:firebase-auth
| | (Maven package)
Firebase Installations | libfirebase_installations.a
| | libfirebase_app.a
| | com.google.firebase:firebase-installations:17.0.1
| | com.google.firebase:firebase-installations
| | (Maven package)
Firebase Messaging | libfirebase_messaging.a
| | libfirebase_app.a
| | com.google.firebase:firebase-analytics:21.0.0
| | com.google.firebase:firebase-analytics
| | (Maven package)
| | com.google.firebase:firebase-messaging:23.0.5
| | com.google.firebase:firebase-messaging
| | (Maven package)
| | libmessaging_java.jar (Android service)
| | androidx.core:core:1.7.0 (Maven package)
| | androidx.core:core:1.8.0 (Maven package)
Firebase Realtime Database | libfirebase_database.a
| | libfirebase_auth.a
| | libfirebase_app.a
| | com.google.firebase:firebase-analytics:21.0.0
| | com.google.firebase:firebase-analytics
| | (Maven package)
| | com.google.firebase:firebase-database:20.0.5
| | com.google.firebase:firebase-database
| | (Maven package)
| | com.google.firebase:firebase-auth:21.0.5
| | com.google.firebase:firebase-auth
| | (Maven package)
Firebase Remote Config | libfirebase_remote_config.a
| | libfirebase_app.a
| | com.google.firebase:firebase-analytics:21.0.0
| | com.google.firebase:firebase-analytics
| | (Maven package)
| | com.google.firebase:firebase-config:21.1.0
| | com.google.firebase:firebase-config
| | (Maven package)
Firebase Storage | libfirebase_storage.a
| | libfirebase_auth.a
| | libfirebase_app.a
| | com.google.firebase:firebase-analytics:21.0.0
| | com.google.firebase:firebase-analytics
| | (Maven package)
| | com.google.firebase:firebase-storage
| | (Maven package)
| | com.google.firebase:firebase-storage:20.0.1
| | com.google.firebase:firebase-auth
| | (Maven package)
| | com.google.firebase:firebase-auth:21.0.5
Google Play services module| com.google.android.gms:play-services-base:18.0.1
| | (Maven package)

Important: Each version of the Firebase C++ SDK supports specific Firebase
Android SDK module versions. Please ensure that you reference the correct
version of each Maven package listed above in your Gradle file.
The Firebase C++ SDK uses an Android BoM (Bill of Materials) to specify a single
Firebase Android SDK version number to use, rather than individual versions for
each library. For more information, please see the [Firebase Android SDK
documentation](https://firebase.google.com/docs/android/learn-more#bom).

Note: AdMob C++ is not currently compatible with the latest Firebase AdMob
Android SDK (20.x.x). Please ensure that you use firebase-ads version 19.8.0 in
Expand All @@ -169,10 +172,10 @@ compatibility.
#### Gradle dependency file

Firebase C++ includes an `Android/firebase_dependencies.gradle` file
that helps you include the correct Android dependencies and native C++
libraries for each Firebase product. To use it, include the following
in your build.gradle file (you can omit any Firebase products you
aren't using):
that helps you include the correct Android dependencies and Proguard
files for each Firebase product. To use it, include the following in
your build.gradle file (you can omit any Firebase products you aren't
using):

```
apply from: "$gradle.firebase_cpp_sdk_dir/Android/firebase_dependencies.gradle"
Expand All @@ -192,6 +195,16 @@ firebaseCpp.dependencies {
}
```

#### Google Play services module

If you wish to use the `google_play_services::CheckAvailability` and
`MakeAvailable` functions, or `firebase::ModuleInitializer`, you must include
com.google.android.gms:play-services-base as a dependency as well, as listed
under "Google Play services module" in the table above. If you use the Gradle
dependency file described above, this dependency will automatically be included.
To omit it (not recommended), specify `appWithoutPlayServices` instead of `app`
in `firebaseCpp.dependencies`.

### iOS Dependencies

iOS users can include either xcframeworks or static libraries depending upon their
Expand Down Expand Up @@ -598,6 +611,11 @@ workflow use only during the development of your app, not for publicly shipping
code.

## Release Notes
### Upcoming Release
- Changes
- General (Android): Switched over to Android BoM (Bill of Materials)
for dependency versions. This requires Gradle 5.

### 9.1.0
- Changes
- General (Android): Fixed a bug that required Android apps to include
Expand Down
5 changes: 3 additions & 2 deletions storage/storage_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ android {
}

dependencies {
implementation 'com.google.firebase:firebase-analytics:21.0.0'
implementation 'com.google.firebase:firebase-storage:20.0.1'
implementation platform('com.google.firebase:firebase-bom:30.0.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-storage'
}

afterEvaluate {
Expand Down

0 comments on commit 486bb50

Please sign in to comment.