miércoles, 11 de enero de 2023

Azure DevOps: Sample Android AAB build and Play Store publish

 # Expected configurations

# Variables:
# - KEYSTORE_PASSWORD
# - KEYSTORE_KEY_ALIAS
# - KEYSTORE_KEY_PASSWORD
# - APPCENTER_SECRET_JSON
# Secure file: my-upload-keystore.keystore

parameters:
- name: nodeVersion
type: string
- name: workingDirectory
type: string

# https://learn.microsoft.com/azure/devops/pipelines/ecosystems/android
steps:
# For analytics and crash reports
- script: |
echo $(APPCENTER_SECRET_JSON) > android/app/src/main/assets/appcenter-config.json
displayName: "AppCenter: Copy appcenter-config.json to Android folder"
workingDirectory: ${{parameters.workingDirectory}}

- task: NodeTool@0
displayName: "Install Node.js version ${{parameters.nodeVersion}}"
inputs:
versionSpec: ${{parameters.nodeVersion}}

- script: |
npm install
displayName: "Install NPM dependencies"
workingDirectory: ${{parameters.workingDirectory}}

- task: Gradle@3
displayName: "Android: Build AAB (gradle)"
inputs:
workingDirectory: ${{parameters.workingDirectory}}/android
gradleWrapperFile: ${{parameters.workingDirectory}}/android/gradlew
gradleOptions: |
-Xmx3072m
-DAZURE_DEVOPS_BUILD_ID=$(Build.BuildId)
publishJUnitResults: false
testResultsFiles: "**/TEST-*.xml"
tasks: "bundleRelease"

- task: AndroidSigning@2
displayName: "Android: Sign and align AAB"
inputs:
apkFiles: ${{parameters.workingDirectory}}/android/app/build/outputs/bundle/release/app-release.aab
jarsign: true
jarsignerKeystoreFile: "my-upload-keystore.keystore"
jarsignerKeystorePassword: $(KEYSTORE_PASSWORD)
jarsignerKeystoreAlias: $(KEYSTORE_KEY_ALIAS)
jarsignerKeyPassword: $(KEYSTORE_KEY_PASSWORD)
jarsignerArguments: "-sigalg SHA256withRSA -digestalg SHA-256"
zipalign: true

- task: GooglePlayRelease@4
displayName: "Google Play release"
inputs:
serviceEndpoint: "Google Play Service Connection"
applicationId: "com.acme.app"
action: "SingleBundle"
bundleFile: ${{parameters.workingDirectory}}/android/app/build/outputs/bundle/release/app-release.aab
track: "internal"

jueves, 17 de noviembre de 2022

React Native run-android notes

 

  • runAndroid:
    • ...logger.info('JS server already running.')...
    • buildAndRun
      • cmd = process.platform.startsWith('win') ? 'gradlew.bat' : './gradlew';
      • runOnAllDevices
        • ...logger.info('Installing the app...');...
        • tryLaunchAppOnDevice
          • ...const {appId, appIdSuffix} = args;...
          • ...shell am start -n...

viernes, 4 de noviembre de 2022

capacitor-community / text-to-speech: "Not yet initialized or not available on this device"

Sending plugin error: {"save":false,"callbackId":"...","pluginId":"TextToSpeech",
"methodName":"speak","success":false,"error":{"message":"Not yet initialized or
not available on this device.","code":"UNAVAILABLE"}}

It happened to me only on the emulator. On a real device, it worked.


miércoles, 1 de junio de 2022

Re: How to bundle and use custom web fonts in SPFx projects (Prod mode)

SPFx: 1.14/1.15.0-rc.0 

I followed How to bundle and use custom web fonts in SPFx projects but didn't work for me in "Prod mode" (gulp bundle --ship && gulp package-solution --ship). It worked for me at "Dev time" (gulp serve in Workbench or in a Sharepoint page in "full trust client-side solution" mode, no --ship).

To make it work I had to change the outputPath value (in fontLoaderConfig) from 'fonts/' to '/'.


const fontLoaderConfig = {
test: /\.(woff(2)?)(\?v=\d+\.\d+\.\d+)?$/, // I'm only checking for woff2
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: '/'
}
}]
};


I noticed that the runtime font references were like: https://[mySite].sharepoint.com/sites/appcatalog/ClientSideAssets/[GUID]/fonts/[myFont].woff2 but visiting https://[mySite].sharepoint.com/sites/appcatalog/ClientSideAssets/[GUID], all the assets were at the same level, like https://[mySite].sharepoint.com/sites/appcatalog/ClientSideAssets/[GUID]/[myFont].woff2.


jueves, 17 de febrero de 2022

AWS SES MessageRejected 400 Bad Request

 Are you on the SES sandbox and trying to send messages to an email address different than the verified one? Or to a domain different than the verified one? 😛



martes, 5 de octubre de 2021

MODULE_NOT_FOUND using New Relic with Nest (NestJS) 8

When adding the newrelic.js file in the root of the NestJS project, and then building it and running it in prod mode:

> node dist/main

node:internal/modules/cjs/loader:936

  throw err;

  ^

Error: Cannot find module '/.../apps/backend/dist/main'

    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)

    at Function.Module._load (node:internal/modules/cjs/loader:778:27)

    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)

    at node:internal/main/run_main_module:17:47 {

  code: 'MODULE_NOT_FOUND',

  requireStack: []

}

In this case, tsc compiles just the newrelic.js file in your dist folder.


Move the newrelic.js to the same directory as your main.ts file (normally src/).

Complete installation instructions: https://discuss.newrelic.com/t/new-relic-for-nestjs/91812. I didn't follow all those for Nest 8 though. In my case:

  1. Same.
  2. Same.
  3. Same.
  4. Same. It didn't work with import _ from 'newrelic';. In that way, it got stripped from the compiled JS.
  5. 6. 7. I didn't need to. The newrelic.js automatically ended up in the dist/ folder.