firebase / firebase-android-sdk

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

[firebase-crashlytics-gradle-plugin]-optimize uploadCrashlyticsMappingFile Task execution time. #6505

Open pidanxiangjiao opened 1 week ago

pidanxiangjiao commented 1 week ago

What feature would you like to see?

Current we use 'com.google.firebase:firebase-crashlytics-gradle:2.9.1' to auto upload mapping file, the mapping file is almost 400Mb and the uploadCrashlyticsMappingFile task took almost 1 min to finish uploading

we want to make the uploadCrashlyticsMappingFile task faster, and decrease the total gradle build time

I also look at the upload request code in 'com.google.firebase:firebase-crashlytics-buildtools:2.9.1' and i would like to ask is the below network request method run in main thread?

    public void uploadMappingFile(File mappingFile, String mappingFileId, AppBuildInfo appBuildInfo, Obfuscator obfuscator) throws IOException {
        logD(String.format("Uploading Mapping File [mappingFile: %1$s; mappingFileId: %2$s;packageName: %3$s; googleAppId: %4$s]", mappingFile.getAbsolutePath(), mappingFileId, appBuildInfo.getPackageName(), appBuildInfo.getGoogleAppId()));
        MappingFileService mappingService = new FirebaseMappingFileService(getWebApi());
        mappingService.uploadMappingFile(mappingFile, mappingFileId, appBuildInfo, obfuscator);
        logI(String.format("Mapping file uploaded: %1$s", mappingFile.toString()));
    }

or is there any way to set the uploadCrashlyticsMappingFile gradle task run in parallel, so it does not block other gradle tasks

google-oss-bot commented 1 week ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

mrober commented 1 week ago

You are on an old version of the plugin, but even version 3 would not do this in the background. You could disable the automatic mapping file upload, see https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=android#keep-obfuscated-build-variants. And then call the upload task yourself. Another option might be to use the Firebase CLI tool instead, see https://firebase.google.com/docs/cli#crashlytics-commands. This would let you do many local builds quickly, then when you want to upload your large mapping file, you can do it.

pidanxiangjiao commented 1 week ago

Thx, let me take a look.

pidanxiangjiao commented 1 week ago

You are on an old version of the plugin, but even version 3 would not do this in the background. You could disable the automatic mapping file upload, see https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=android#keep-obfuscated-build-variants. And then call the upload task yourself. Another option might be to use the Firebase CLI tool instead, see https://firebase.google.com/docs/cli#crashlytics-commands. This would let you do many local builds quickly, then when you want to upload your large mapping file, you can do it.

Hello, may i ask , how the firebase platform to deal with the match for a aab to a mapping file through the log, i can find that , the task generate a mapping id, and upload this file to my project in firebase by appId so if i upload the file by myself, i can generate a random mapping file id then upload it , i'm not sure how to make this file to match the app version to publish(aab file).