Fabric bad detection

Hi everyone,

I recently created an open source application. Shortly after launching it, some users asked me to provide it on F-Droid. The main problem was that my app was using unallowed libraries (Fabric / Firebase) for Crash reporting, analytics and remote config. Since it was very basic and optional features, I decided to create a product flavor excluding Fabric and Firebase from my app, you can find the process here : https://github.com/Anthony-Reboul/AndroidDeepL/issues/25

After these modifications, the app is able to build without including either Fabric or Firebase library by using the product flavor “withoutPlayServices”. The main problem I encounter is after creating the F-Droid metadata for the app, I runned the “fdroid build” command to test the configuration and the build failed because Fabric maven repository is still present in the build.gradle (on the project level, not app level).

So even if the build config defined in the F-Droid metadata exclude Fabric from the build, it’s still detected as present in the project. Does someone know it I can do something about it ? I don’t think I can get rid of the Fabric’s Maven repository since it’s still used in other build configs.

Here is the complete end of the fdroid build command :
1 actionable task: 1 up-to-date
INFO: Scanning source for common problems…
ERROR: Found unknown maven repo ‘https://maven.fabric.io/public’ at build.gradle
INFO: Removing gradle-wrapper.jar at gradle/wrapper/gradle-wrapper.jar
ERROR: Could not build app com.anthony.deepl.openl: Can’t build due to 1 error while scanning
INFO: Finished
INFO: 1 build failed

Thanks for your time and help

That’s the ususal case when build.gradle contains proprietary flavors.

Just add something like this into F-Droid metadata:

prebuild=sed -i -e '/fabric/d' ../build.gradle

Hi relan,

Thanks for your help ! Unfortunatty when I add this line, the build fail because all the dependencies from the classpath cannot be resolved :

  • What went wrong:
    A problem occurred configuring root project ‘com.anthony.deepl.openl’.

Could not resolve all dependencies for configuration ‘:classpath’.
You must specify a URL for a Maven repository.

You can find the complete file here : https://github.com/Anthony-Reboul/AndroidDeepL/blob/master/build.gradle

Thanks again for your help !

Those lines should be removed too (using sed):

classpath 'com.google.gms:google-services:3.1.2'
classpath 'io.fabric.tools:gradle:1.24.4'

If you still have issues, please post your F-Droid metadata, I’ll be more specific. :slight_smile:

Hi Relan,

I finaly solved the problem :slight_smile:
The main problem was the fact that the “maven { … }” part is empty when sed remove the line “url ‘https://maven.fabric.io/public’”. I also needed we needed to remove the two lines you said and also those two lines on the app build.gradle :
apply plugin: ‘io.fabric’
apply plugin: ‘com.google.gms.google-services’

Here is the final command chain I use in the pre-build instructions :
sed -n -i -e ‘/maven.fabric/{s/.*//;x;N;d;};x;p;${x;p;}’ …/build.gradle | sed ‘/^$/d’
sed -i -e ‘/io.fabric/d’ …/build.gradle
sed -i -e ‘/google-services/d’ …/build.gradle
sed -i -e ‘/io.fabric/d’ ./build.gradle
sed -i -e ‘/com.google.gms.google-services/d’ ./build.gradle

The build is now working, thanks a lot for your help !

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.