Job checkupdates fails (proposing a new app) but can't understand reason

Hi all,
I’m trying to propose a new app for F-Droid following this blog post: https://f-droid.org/it/2020/10/14/adding-react-native-app-to-f-droid.html since I’m completely new to app development and I’m using React Native through Expo for creating it.

I think my metadata is fine, but still can’t understand why the checkupdates (and also the build, but one step at a time) fails: https://gitlab.com/marcoXbresciani/fdroiddata/-/pipelines/438594713

Hints?

Could you link to the failing build? It’s much easier to understand what is going wrong when you have the exact error message and logs.

Gosh, sorry. I thought I had, but copy-posted the same URL twice, instead. Corrected.
It’s here: https://gitlab.com/marcoXbresciani/fdroiddata/-/pipelines/438594713

Thanks.

checkupdates I’m not quite sure about. If you make a MR I’m sure someone else on the time who understands that code better can help.

Why the build is failing I can tell you though:

2021-12-29 15:42:36,423 ERROR: Could not build app name.bresciani.marco.tkcompanionapp: Missing subdir build/name.bresciani.marco.tkcompanionapp/android/app

It tries to enter the directory android/app in your repository because your YAML contains:

    subdir: android/app

However, if I look at https://github.com/marcoXbresciani/TKCompanionApp there is no android directory there.

You may still run into other issues with the build, but we’ll see when we get a new error message after removing subdir :slight_smile:

1 Like

I’m getting old… I’ve read those logs a gazillion times and didn’t see it. Sorry. :roll_eyes:

Thanks for the help. It seems I’ve missed to commit some pieces, or maybe I was drunk when writing the metadata.
Or both.

No worries, it happens. Pretty recently I wasted a whole day on a typo I just read over again and again and again :slight_smile:

There is no version info. The checkupdates only looks for the version name and version code in build.gradle and AndroidManifest.xml and there is no such thing. There is version name in https://github.com/marcoXbresciani/TKCompanionApp/blob/master/app.json but I can’t find the version code. You need to put it somewhere.

Thanks again.
Monday I’ll read again the Etesync repo linked in the article to check the differences with mine: haven’t seen the version code there as well.

Happy new year,

Marco

Thanks. Now I’ve used expo run:android to create the android folder.
Inside such folder, the app\build.gradle file contains the versionCode and the versionName. Wondering how the versionCode is managed… Trying to update my medata to those values right now.

Still the same issue, but this time the android/app/build.gradle does contain the version name and code. :pensive:

2022-01-05 14:54:18,286 ERROR: ...checkupdate failed for name.bresciani.marco.tkcompanionapp : Couldn't find any version information
2022-01-05 14:54:18,287 DEBUG: Traceback (most recent call last):
  File "/builds/marcoXbresciani/fdroidserver/fdroidserver/checkupdates.py", line 644, in main
    checkupdates_app(app)
  File "/builds/marcoXbresciani/fdroidserver/fdroidserver/checkupdates.py", line 432, in checkupdates_app
    (version, vercode, tag) = check_tags(app, pattern)
  File "/builds/marcoXbresciani/fdroidserver/fdroidserver/checkupdates.py", line 218, in check_tags
    raise FDroidException(_("Couldn't find any version information"))
fdroidserver.exception.FDroidException: Couldn't find any version information

show build.gradle?

show metadata .yml?

Sure. This is the metadata

Categories:
  - Science & Education
  - Reading
  - Writing
License: GPL-3.0-or-later
AuthorName: Marco Bresciani
AuthorEmail: marco.530@outlook.it
AuthorWebSite: https://github.com/marcoXbresciani/
WebSite: https://github.com/marcoXbresciani/TKCompanionApp
SourceCode: https://github.com/marcoXbresciani/TKCompanionApp
IssueTracker: https://github.com/marcoXbresciani/TKCompanionApp/issues
Changelog: https://github.com/marcoXbresciani/TKCompanionApp/blob/HEAD/CHANGELOG.md

Name: TKCompanionApp
AutoName: TKCompanionApp
Summary: This app wants to be a short and small helper for Toyota Kata practitioners
Description: This app wants to be a short and small helper for Toyota Kata practitioners.
    It will contain the Coaching Kata 5Q card, plus (possibly) more things and information.
    This is my very first experiment with React Native. If it'll ever work.

RepoType: git
Repo: https://github.com/marcoXbresciani/TKCompanionApp

Builds:
  - versionName: 0.1.3
    versionCode: 4
    commit: 0.1.3
    subdir: android/app
    sudo:
      - sysctl fs.inotify.max_user_watches=524288
      - curl -Lo node.tar.xz https://nodejs.org/dist/v17.3.0/node-v17.3.0-linux-x64.tar.xz
      - echo "b54b4b7d0732f2dbad9c13f5b909411cde3cc9989bfdeb7557c400e4c93fe6ee node.tar.xz"
        | sha256sum -c -
      - tar xJf node.tar.xz
      - cp -a node-v17.3.0-linux-x64/. /usr/local/
      - npm -g install yarn
    init: yarn install
    gradle:
      - yes
    scanignore:
      - android/build.gradle
      - node_modules/jsc-android
      - node_modules/react-native/android/com/facebook/react/react-native/*/
      - node_modules/react-native-safe-area-context/android/build.gradle
      - node_modules/react-native-screens/android/build.gradle
      - node_modules/react-native-vector-icons/android/build.gradle
      - node_modules/@react-native-community/masked-view/android/build.gradle
    scandelete:
      - node_modules/
    ndk: r21d

MaintainerNotes: scanignore is used to allow the "node_modules/react-native/android"
    local Maven repository.

AutoUpdateMode: Version %v
UpdateCheckMode: Tags
CurrentVersion: 0.1.3
CurrentVersionCode: 4

And the build.gradle automagically generated by expo run:android

apply plugin: "com.android.application"

import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation. If none specified and
 *   // "index.android.js" exists, it will be used. Otherwise "index.js" is
 *   // default. Can be overridden with ENTRY_FILE environment variable.
 *   entryFile: "index.android.js",
 *
 *   // https://reactnative.dev/docs/performance#enable-the-ram-format
 *   bundleCommand: "ram-bundle",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

project.ext.react = [
    enableHermes: (findProperty('expo.jsEngine') ?: "jsc") == "hermes",
    cliPath: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/cli.js",
    hermesCommand: new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/%OS-BIN%/hermesc",
    composeSourceMapsPath: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/scripts/compose-source-maps.js",
]

apply from: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../react.gradle")

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

/**
 * The preferred build flavor of JavaScriptCore.
 *
 * For example, to use the international variant, you can use:
 * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
 *
 * The international variant includes ICU i18n library and necessary data
 * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
 * give correct results when using with locales other than en-US.  Note that
 * this variant is about 6MiB larger per architecture than default.
 */
def jscFlavor = 'org.webkit:android-jsc:+'

/**
 * Whether to enable the Hermes VM.
 *
 * This should be set on project.ext.react and mirrored here.  If it is not set
 * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
 * and the benefits of using Hermes will therefore be sharply reduced.
 */
def enableHermes = project.ext.react.get("enableHermes", false);

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId 'name.bresciani.marco.tkcompanionapp'
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "0.1.2"
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.debug
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // https://developer.android.com/studio/build/configure-apk-splits.html
            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }

        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules

    def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
    def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
    def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";

    // If your app supports Android versions before Ice Cream Sandwich (API level 14)
    // All fresco packages should use the same version
    if (isGifEnabled || isWebpEnabled) {
        implementation 'com.facebook.fresco:fresco:2.0.0'
        implementation 'com.facebook.fresco:imagepipeline-okhttp3:2.0.0'
    }

    if (isGifEnabled) {
        // For animated gif support
        implementation 'com.facebook.fresco:animated-gif:2.0.0'
    }

    if (isWebpEnabled) {
        // For webp support
        implementation 'com.facebook.fresco:webpsupport:2.0.0'
        if (isWebpAnimatedEnabled) {
            // Animated webp support
            implementation 'com.facebook.fresco:animated-webp:2.0.0'
        }
    }
    
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
      exclude group:'com.facebook.fbjni'
    }
    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }
    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    if (enableHermes) {
        debugImplementation files(new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim(), "../android/hermes-debug.aar"))
        releaseImplementation files(new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim(), "../android/hermes-release.aar"))
    } else {
        implementation jscFlavor
    }
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
applyNativeModulesAppBuildGradle(project)
apply from: "./eas-build.gradle"

Not sure why it’s not updating the build.gradle again. :frowning: https://gitlab.com/marcoXbresciani/fdroiddata/-/jobs/1944366819

2022-01-05 15:35:20,582 ERROR: ...checkupdate failed for name.bresciani.marco.tkcompanionapp : current version is newer: old vercode=4, new vercode=1
2022-01-05 15:35:20,583 DEBUG: Traceback (most recent call last):
  File "/builds/marcoXbresciani/fdroidserver/fdroidserver/checkupdates.py", line 644, in main
    checkupdates_app(app)
  File "/builds/marcoXbresciani/fdroidserver/fdroidserver/checkupdates.py", line 477, in checkupdates_app
    old=app.CurrentVersionCode, new=vercode
fdroidserver.exception.FDroidException: current version is newer: old vercode=4, new vercode=1

Not sure what part of current version is newer: old vercode=4, new vercode=1 is unclear? :slight_smile:

Ok, now I’ve been able to re-re-re-re-run expo run:android and the android/app/build.gradle seems to have a properly updated versionCode and versionName pair.
Pipelines running…

Well, I’m absolutely no expert, and trying to learn and understand.

Now the versionCode field in android/app/build.gradle file is versionCode 4.
Also versionName is correctly committed as versionName "0.1.3".
The metadata file contains

  - versionName: 0.1.3
    versionCode: 4
    commit: 0.1.3

and also

AutoUpdateMode: Version %v
UpdateCheckMode: Tags
CurrentVersion: 0.1.3
CurrentVersionCode: 4

So, what am I missing, this time? (For the checkupdates job, at least; for frdoid build I probably have to work on the scanignore part, but that’s another story)

You need to manage that versionCode value yourself. It must be incremented every time you tag a release. How you manage the release process is really up to you - personally, I increment it manually in a branch where I compose the release notes (tagging the merge-commit as the release).

When checkupdates runs it detects the new tag and compares the versionCode against the CurrentVersionCode. So the old versionCode is 4, and the new version is what? also 4 (or 1 like the first run)? An update won’t be detected until that value becomes 5+. When an update is detected a new entry will be written to the metadata, and the CurrentVersionCode updated. When this works right its very convenient - you won’t need to mess with the metadata ever again. Otherwise somebody needs to create those entries after each release.

You can open an MR so that we can help you fix it.

So it updated the .YML after you’ve updated the build.gradle and run checkupdate? Then…it’s ok… right? Checkupdate works…

I’m feeling stupider every moment. Sorry for this mess.
Now I have updated the app.json in the code, adding "versionCode": 5 and "version": "0.1.4".
Then committed, tagged, pushed (see https://gitlab.com/marcoXbresciani/TKCompanionApp/-/commit/202829a025ef56cd77ee229f981b8072aa0b06ad).
Then, I’ve updated, again, the metadata (see https://gitlab.com/marcoXbresciani/fdroiddata/-/blob/name.bresciani.marco.tkcompanionapp/metadata/name.bresciani.marco.tkcompanionapp.yml) reflecting the new versionCode and tag.
And ran the pipelines.

And the same message: why 5 should be the old one and 4 the new one? This I cannot understand. Then new is 5! Just added it! Why my two neural cells can’t connect and understand what I’m missing here? :pensive: :tired_face:

2022-01-10 16:58:07,878 ERROR: ...checkupdate failed for name.bresciani.marco.tkcompanionapp : current version is newer: old vercode=5, new vercode=4
2022-01-10 16:58:07,880 DEBUG: Traceback (most recent call last):
  File "/builds/marcoXbresciani/fdroidserver/fdroidserver/checkupdates.py", line 644, in main
    checkupdates_app(app)
  File "/builds/marcoXbresciani/fdroidserver/fdroidserver/checkupdates.py", line 477, in checkupdates_app
    old=app.CurrentVersionCode, new=vercode
fdroidserver.exception.FDroidException: current version is newer: old vercode=5, new vercode=4

Thanks, I’ll do that as soon as I can.