How to build a particular app flavor on FDroid


#1

I have two flavors in the app, one is for playStore which includes the youtubeAPI library from google and other is the fdroid flavor which does not contain any proprietary software.

So whenever I build the app through fdroid this is what I get :

1 actionable task: 1 executed
INFO: Scanning source for common problems...
ERROR: Found usual suspect 'youtube.*android.*player.*api' at app/libs/YouTubeAndroidPlayerApi.jar
WARNING: Found JAR file at app/libs/YouTubeAndroidPlayerApi.jar
WARNING: Found possible binary at app/src/main/assets/snowboy/alexa_02092017.umdl
WARNING: Found possible binary at app/src/main/assets/snowboy/common.res
ERROR: Found shared library at app/src/main/jniLibs/arm64-v8a/libsnowboy-detect-android.so
ERROR: Found shared library at app/src/main/jniLibs/armeabi-v7a/libsnowboy-detect-android.so
INFO: Removing gradle-wrapper.jar at gradle/wrapper/gradle-wrapper.jar
ERROR: Could not build app ai.susi: Can't build due to 3 errors while scanning
INFO: Finished
INFO: 1 build failed

So I want to know how to build only the flavor that I made for FDroid, and also how to exclude Pre-Build files on FDroid.

here is the project link : https://github.com/fossasia/susi_android


#2

I want to know how to build only the flavor that I made for FDroid

gradle=flavor

also how to exclude Pre-Build files on FDroid

Not sure what you mean by excluding, but prebuilts are not allowed.


#3

I have to add this in the metadata reference?


#4

Yes (adapt to your yml or txt):

Build
...
gradle=flavour
rm=<files to be deleted>
...

See here: https://f-droid.org/en/docs/Build_Metadata_Reference/


#5

I am facing this issue while removing the files :
INFO: Removing specified files
ERROR: Could not build app ai.susi: glob path ‘src/main/jniLibs/arm64-v8a/libsnowboy-detect-android.so, src/main/jniLibs/armeabi-v7a/libsnowboy-detect-android.so’ did not match any files/dirs
INFO: Finished
INFO: 1 build failed


#6
subdir=app

helps?


#7
    subdir: app
gradle:
  - fdroid
rm:
  - src/main/jniLibs/arm64-v8a/libsnowboy-detect-android.so, src/main/jniLibs/armeabi-v7a/libsnowboy-detect-android.so

this is my .yml file ,still the same result


#8
rm
  - app/src/...

Maybe?


#9

Even tried that :slightly_frowning_face: , I do not know why the path is not matched,
In the first error message it shows that error path is
app/src/main/jniLibs/arm64-v8a/libsnowboy-detect-android.so
app/src/main/jniLibs/armeabi-v7a/libsnowboy-detect-android.so

now on adding this path too, to remove the files the error message still shows the same thing as

ERROR: Could not build app ai.susi: glob path ‘app/src/main/jniLibs/arm64-v8a/libsnowboy-detect-android.so, app/src/main/jniLibs/armeabi-v7a/libsnowboy-detect-android.so’ did not match any files/dirs


#10

You might need to separate them on lines not with comma (comma is for TXT files afaics)

  rm:
     - app/src/...
     - app/src/...

#11

Thanks this worked, but right after this, I am getting again an error :
INFO: Removing gradle-wrapper.jar at gradle/wrapper/gradle-wrapper.jar
INFO: Creating source tarball…
ERROR: Could not build app ai.susi due to unknown error: Traceback (most recent call last):
File “/usr/local/Cellar/fdroidserver/1.0.9/libexec/lib/python3.7/site-packages/fdroidserver/build.py”, line 1120, in main
options.onserver, options.refresh):
File “/usr/local/Cellar/fdroidserver/1.0.9/libexec/lib/python3.7/site-packages/fdroidserver/build.py”, line 896, in trybuild
build_local(app, build, vcs, build_dir, output_dir, log_dir, srclib_dir, extlib_dir, tmp_dir, force, onserver, refresh)
File “/usr/local/Cellar/fdroidserver/1.0.9/libexec/lib/python3.7/site-packages/fdroidserver/build.py”, line 562, in build_local
tarball.add(build_dir, tarname, exclude=tarexc)
TypeError: add() got an unexpected keyword argument ‘exclude’

INFO: Finished
INFO: 1 build failed

#12

do attach the full metadata


#14

So is this? https://gitlab.com/fdroid/fdroidserver/issues/531


#15

yes this is the issue


#16

also even after downgrading to version 3.6.5 I get the following error :

dyld: Library not loaded: @executable_path/../.Python
  Referenced from: /usr/local/Cellar/fdroidserver/1.0.9/libexec/bin/python3.7
  Reason: image not found
Abort trap: 6

#17
Categories:
  - Internet
License: Apache-2.0
SourceCode: https://github.com/fossasia/susi_android
IssueTracker: https://github.com/fossasia/susi_android/issues

Summary: Susi AI **not relevant for the post**
Description: Susi AI **not relevant for the post**

RepoType: git
Repo: https://github.com/fossasia/susi_android

Builds:
  - versionName: 1.0.10-Fdroid
    versionCode: 11
    commit: 1ad2fd0e858b1256617e652c6c8ce1b8372473e6
    subdir: app
    gradle:
      - fdroid
    rm:
      - app/src/main/jniLibs/arm64-v8a/libsnowboy-detect-android.so 
      - app/src/main/jniLibs/armeabi-v7a/libsnowboy-detect-android.so
      - app/libs/YouTubeAndroidPlayerApi.jar

AutoUpdateMode: None
UpdateCheckMode: Tags

This is the metadata reference


#18
CurrentVersion: ?
CurrentVersionCode: ?

#19

It works (almost) fine with Python 3.6, what distro are you running?

Try to fix all those translations errors too:

  • is translated here but not found in default locale [ExtraTranslation]
  • Error: Non-translatable resources should only be defined in the base values/ folder [ExtraTranslation]
  • and another one

Ignoring that, now it fails right at the end with ERROR: Could not build app ai.susi: Wrong package ID - build ai.susi.fdroid but expected ai.susi which you might know how to fix.


#20
Found distributionUrl=https://services.gradle.org/distributions/gradle-4.7-all.zip via distributionUrl
/Users/mohitkumar/Documents/fdroidserver/gradlew-fdroid: line 59: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/Users/mohitkumar/Documents/fdroidserver/gradlew-fdroid: line 109: 1.4: syntax error: invalid arithmetic operator (error token is ".4")
No hash for gradle version distributionUrl=https://services.gradle.org/distributions/gradle-4.7-all.zip! Exiting...
ERROR: Could not build app ai.susi: Error cleaning ai.susi:1.0.10
==== detail begin ====
Found distributionUrl=https://services.gradle.org/distributions/gradle-4.7-all.zip via distributionUrl
/Users/mohitkumar/Documents/fdroidserver/gradlew-fdroid: line 59: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/Users/mohitkumar/Documents/fdroidserver/gradlew-fdroid: line 109: 1.4: syntax error: invalid arithmetic operator (error token is ".4")
No hash for gradle version distributionUrl=https://services.gradle.org/distributions/gradle-4.7-all.zip! Exiting...
==== detail end ====
INFO: Finished
INFO: 1 build failed

at last finally I get this error , is this is a problem with the gradle version ?


#21

Why do you run this?

I enter the data folder and run: $:~/fdroiddata-0729/ > ../fdroidserver-0729/fdroid build -v ai.susi:11

(I cloned the repos hence their names)

Tested with 4.7 too just in case, builds ok (except that Wrong package ID - build ai.susi.fdroid but expected ai.susi thing)