I use fabric crashlytics in my application and it works fine when com.android.tools.build:gradle is 3.2.1, until I update it to 3.3.0.
Now I meet the 'Crashlytics could not find the manifest', and find out that there is no AndroidManifest.xml created in build/intermediates/merged_manifest/.../merged. I've read this this and this, but did not solve my problem. How do I fix it? Thanks.
Here is the lib.gradle
apply plugin: 'com.android.library'
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
...
}
dependencies {
...
api('com.crashlytics.sdk.android:crashlytics:2.9.8@aar') {
transitive = true
}
}
And here is the project gradle
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
...
}
}
And this is the error:
I had the same issue and fixed it for me like following, using Ionic 5, Capacitor and the Cordova FirebaseX Plugin (which references to Crashlytics) , may you need to adjust some paths to fit your environment:
./gradlew assembleDebug
.AndroidManifest.xml
from your-app/src/main/AndroidManifest.xml
to your-app/build/intermediates/merged_manifests/debug/AndroidManifest.xml
.In my case with Ionic 5 and Capacitor the paths are:
android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml
android/capacitor-cordova-android-plugins/build/intermediates/merged_manifests/debug/AndroidManifest.xml
Hope it helps you.
Have you tried configuring everything exactly as required for a Crashlytics setup with a library module and a base project? It seems the new Gradle plugin doesn't work if the setup is different from the one recommended here.
For me removing "apply plugin: 'io.fabric'
" from the library's build.gradle file (but leaving it in the application build.gradle) solved this error.
I've got a fix for this while keeping Crashlytics dependencies out of the app module, but it's very hacky.
From what I can tell the io.fabric plugin primarily exists to generate a build ID for crashlytics, which is important to the Fabric platform but goes unused for Firebase. This, I assume, is vestigial functionality that will eventually be removed when Crashlytics completes its migration to Firebase, but in the meantime it's quite necessary simply because Crashlytics checks for it and crashes your app if it's not there.
So, I simply created a useless dummy build ID and removed all mention of the ui.fabric plugin from my modules, and it works! My code compiles and reports crashes to the firebase console as it did previously, and I can update to android gradle plugin v3.3.0+ with no issues.
The specific steps I took were:
Add this to the main/res/values.xml file in the module that uses crashlytics:
<string name="com.crashlytics.android.build_id" translatable="false">RANDOM_UUID</string>
And remove all usages of the io.fabric gradle plugin, as well as the classpath dependency on the gradle plugin (as you no longer use it).
Note that, as I said, this is very hacky. I'd suggest testing this thoroughly if you take this approach for your project. There might be some functionality that does still use the build ID and this would cause it to break.
EDIT: after further investigation I believe that doing this will prevent crashlytics from uploading your mapping file, which means you will have to manually deobfuscate stack traces. This is still an option at least, but does seem to have drawbacks. Also worth noting that you can also simply use:
<string name="com.crashlytics.RequireBuildId">false</string>
instead of providing a dummy build ID.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With