I have not been able to get Firebase Crashlytics fully integrated into my Android app.
On 2503 I added the google-services.json file to the Properties folder in my new test project and added a gradle reference for com.google.firebase:firebase-analytics:17.0.3. The json file is picked up by EBuild. The google services task executes and the intermediate google-services/values/google-services-values.json file is generated with the correct info. But the functionality is missing from the built app.
I did the same process in Android Studio and compared the apks of the two projects, and it seems that EBuild is not merging the final manifest correctly. The manifest in my Android Studio created app is 126 lines long, compared to 36 lines for my EBuild created app, and it is due to a lot of missing google services stuff. For example,
There are a lot of google services generated properties files that are packaged correctly into the final apk, but it seems there should be some stuff merged into the manifest as well that is missing.
When we specāed this task together, e made it create a new folder of resources that get merged into the resources of the app. I dontā recall us discussion that thereās an XML that needs to be merged with the manifest, so no surprise thatās not happening.
is this the generated google-services-values.xml, and soul that me merged with the manifest instead of being deployed as resource?
do you have quick tetscase project you can send me to run and fix this?
No, the google-services-values.xml is only used when generating the R.java file, so it is correct as is.
Right, I didnāt know that anything needed to be merged into the manifest. My fault there. But I donāt think it is the google-services.json stuff that needs to be merged but rather something from the gradle reference com.google.firebase:firebase-analytics:17.0.3 .
Strangely, a few weeks ago I analyzed my EBuild-generated apk and it was identical to the ADS generated apk.
The manifest for this package (com.google.android.gms:play-services-measurement:17.3.0) contains these values, which are all added to the final manifest in ADS but not in EBuild.
There seems to be some competition with multiple packages adding items of the same name:
Added new Android permission 'android.permission.INTERNET' from reference 'play-services-measurement-17.3.0'.
Added new Android permission 'android.permission.ACCESS_NETWORK_STATE' from reference 'play-services-measurement-17.3.0'.
Added new Android permission 'android.permission.WAKE_LOCK' from reference 'play-services-measurement-17.3.0'.
Added new Android permission 'com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE' from reference 'play-services-measurement-17.3.0'.
Added new Android receiver 'com.google.android.gms.measurement.AppMeasurementReceiver' from reference 'play-services-measurement-17.3.0'.
Added new Android receiver 'com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver' from reference 'play-services-measurement-17.3.0'.
Added new Android service 'com.google.android.gms.measurement.AppMeasurementService' from reference 'play-services-measurement-17.3.0'.
Added new Android service 'com.google.android.gms.measurement.AppMeasurementJobService' from reference 'play-services-measurement-17.3.0'.
Added new Android meta-data 'com.google.android.gms.version' from reference 'play-services-basement-17.2.1'.
E: Cannot add new Android receiver 'com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver' from reference 'play-services-measurement-impl-17.3.0', because it already exists.
Added new Android service 'com.google.firebase.components.ComponentDiscoveryService' from reference 'play-services-measurement-api-17.3.0'.
Added new Android provider 'com.google.firebase.provider.FirebaseInitProvider' from reference 'firebase-common-19.3.0'.
E: Cannot add new Android service 'com.google.firebase.components.ComponentDiscoveryService' from reference 'firebase-common-19.3.0', because it already exists.
Added new Android permission 'com.google.android.c2dm.permission.RECEIVE' from reference 'firebase-iid-20.1.5'.
E: Cannot add new Android service 'com.google.firebase.components.ComponentDiscoveryService' from reference 'firebase-iid-20.1.5', because it already exists.
Added new Android receiver 'com.google.firebase.iid.FirebaseInstanceIdReceiver' from reference 'firebase-iid-20.1.5'.
Added new Android activity 'com.google.android.gms.common.api.GoogleApiActivity' from reference 'play-services-base-17.2.1'.
E: Cannot add new Android service 'com.google.firebase.components.ComponentDiscoveryService' from reference 'firebase-installations-16.2.1', because it already exists.
E: Cannot add new Android service 'com.google.firebase.components.ComponentDiscoveryService' from reference 'firebase-installations-16.2.1', because it already exists.
not sure whatās the best approach here ā add the first, and ignore the subsequent ones? add both? (Iām assuming names need to be unique, no?)
Implemented using the former (ignore subsequent dupes), for 20200422-193249-elements-develop and later. Iāll upload a new builds for you once I have on in ~1h our so; testing and feedback appreciated.
Iām not seeing any change in the final manifest. I tried a clean build, and tried removing and re-adding the gradle reference. Also tried adding the sub-references as full project references, but still nothing.
Hereās my āverbosity:Diagnosticā build log if it helps. build_log.txt (239.9 KB)
Ah damn. what happened I sent you an too-early build because we had an (unrelated) regression yesterday that caused the build meant for you to fail, and I didnāt notice :(.
The build actually failed initially on a really subtle error. EBuild failed to pick up the error, but I noticed an odd message from aapt when I ran ebuild from the command line complaining about a $ character in the manifest.
After some investigation I found that that some android libraries (including all of the firebase libraries) use a placeholder ${applicationId} which gradle replaces with the package name at build time. Gradle allows configuring arbitrary variables that can be injected into the manifest but it looks like only ${applicationId} is assumed by default. So replacing the string literal ā${applicationId}ā with the appās package name, e.g., ācom.company.appnameā, would solve this issue.
I say āinitiallyā because I did find that I can manually add the manifest item to my app manifest and the build works, since the element is ignored on subsequent discoveries. The problematic item was:
Added āinvalidā to the range of trigger words, so this now gives a proper error:
E: aapt: Tag <provider> attribute authorities has invalid character '$'. [/Users/mh/Library/Application Support/RemObjects Software/EBuild/Obj/com.mattrobertson.WateryCrashTest-348420ADFB47D7518D7A89EA7ED986258A2A241C/Debug/Cooper-Android/AndroidManifest.xml (54)]
Iāve been running into an issue adding Firebase and finally traced the cause back to this. When I run my project that includes Firebase, the following runtime error shows up in Logcat:
Failed to retrieve Firebase Instance ID
I used Android Studioās APK Analyzer tool to compare the final merged manifests of my EBuild app and an equivalent app built in Android Studio (the ADS app is working as expected). The manifests are almost identical, with a couple key exceptions on ComponentDiscoveryService.
The ADS manifest adds the directBootAware attribute. This comes from the firebase-common package. My EBuild log shows this message:
W: Skipped adding Android service 'com.google.firebase.components.ComponentDiscoveryService' from reference 'firebase-common-19.3.0', because it already exists.
I canāt locate the GitHub directory where the firebase.iid.Registrar meta-data is coming from, but Iām sure this is whatās causing the āFailed to retrieve IDā error. My EBuild log also shows:
W: Skipped adding Android service 'com.google.firebase.components.ComponentDiscoveryService' from reference 'firebase-iid-20.1.5', because it already exists.
It looks like duplicates need to be merged, not skipped.