Skip to main content
Skip table of contents

Android TV release build

For customization of builds, the same command is used but with additional parameters. 

Introduction

This page covers:

  • Building release build for Android TV
  • Checking lint and typescript errors and generating the _build folder
  • Copying client-specific configuration files
  • Copying localization
  • Generating the APK

Build commands

To generate an app for Android TV, use these commands:


This command will generate the APK.

TEXT
yarn builds --buildType=release


For customization of builds, the same command is used but with additional parameters. 

TEXT
yarn builds --client=sales --platform=androidTv --buildType=release

Build command parameters

Parameter

Details

Required

Default value

--clientThis parameter accepts the valid client name, based on the client name configuration files to be copiedOptionalsales
--platformThis parameter accepts the platform nameOptionalandmob
--buildTypeThis parameter accepts build type value. For a release build, set value to Release otherwise it will use the default value.Mandatorydebug


For a list of valid values for each parameter, refer to the table - build props and values.


Build process

Step 1: Lint validation in the source code

This step checks for common errors in the source code. If any errors are found, they are listed in the console and the process will stop to wait for developer confirmation. If there are lint errors, they must be fixed before continuing otherwise the build will fail.

TEXT
 ERROR:"lint" exited with 2.
 ERROR: Command failed with exit code 1.
 INFO:info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
 
The process raised an error,Would you like to continue?(y/n) 

Common lint errors

TEXT
ERROR: ocb/src/ui/screens/explore/search.tsx[527, 50]: file should end with a newline
ERROR: ocb/src/ui/screens/explore/search.tsx[524, 1]: Consecutive blank lines are forbidden
ERROR: ocb/src/ui/screens/explore/search.tsx[297, 3]: Calls to 'console.log' are not allowed.
ERROR: ocb/src/ui/screens/explore/search.tsx[230, 52]: trailing whitespace
ERROR: ocb/src/ui/screens/explore/search.tsx[298, 1]: trailing whitespace
ERROR: ocb/src/ui/screens/explore/search.tsx[234, 19]: ' should be "
ERROR: ocb/src/ui/screens/explore/search.tsx[48, 28]: Missing semicolon
ERROR: ocb/src/ui/screens/explore/search.tsx[36, 1]: 'equals' is declared but its value is never read.

Step 2: Validate typescript functionality in the source code by tslint

Once the lint is successfully completed, the next step is to validate the typescript functionality errors.

If no typescript functionality errors are found, then the build will generate the _build folder and continue to the next step.

If there are any functionality errors in the source code, then it lists the errors in the console and the process will stop to wait for developer confirmation.

Functionality errors are mandatory to fix.

Common functionality errors

TEXT
INFO:$ tslint --project tslint.json
ERROR: ocb/src/ui/screens/explore/search.tsx[69, 10]: variable name must be in lowerCamelCase, PascalCase or UPPER_CASE
ERROR: ocb/src/ui/screens/explore/search.tsx[38, 1]: 'isNumber' is declared but its value is never read.
ERROR: ocb/src/ui/screens/explore/search.tsx[69, 10]: '__isTV' is declared but its value is never read.

Step 3: Set client-specific configuration

Once the _build folder is successfully created, the next step is to set the client-specific configuration. For each client, there will be a different configuration such as API endpoint, features, UI theme, terms & conditions, etc.

These files will be copied to the android folder based on the client and platform.

This command is for copying platform configuration for client.

TEXT
yarn copy-config-files demo tv

Step 4: Copy localization file

This command is for copying the localization file. It is common for all the clients.

TEXT
yarn copy-localization

Step 5: APK generation

This command is for generating the APK once all previous steps are completed without errors.

TEXT
./gradlew assembleProductRelease


Once the app generation is complete, the app will be located at android/app/build/outputs/apk.

The apk folder location is generated based on the variant values for client, platform, and buildType.

Example

For these build parameters:

--client=sales

--platform=androidTv

--buildType=release

The apk location would be: android/app/build/outputs/apk/productAndroidTv/release/ocb-AndroidTv-{version}.apk


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.