Skip to content

Conversation

@HASH-0021
Copy link

The changes made in this PR are according to the solution provided in the issue #8040. (This PR closes this issue)

The changes are made to parseApkNameFromFlavor function definition present in cli/src/common.ts file. And also in locations where this function is called (like in cli/src/config.ts and cli/src/android/run.ts files) to change the function call structure. I tried to use only the existing library methods.

The new changes work only in the following scenarios. If any of the following scenarios fail, then the code falls back to previous version of parseApkNameFromFlavor function definition.

  1. No flavor option is present. (I don't want to change the code when flavor is present, as I don't completely understand how that specific use case differs)
  2. When output-metadata.json file is present in the intended location. (This fails when we scaffolded a new project which doesn't contain the file or if the filename gets changed in some way)
  3. When file's json structure is similar to following json structure. (I don't know if this can be different in other projects but to ensure my code only works for this structure)
{
  "version": 3,
  "artifactType": {
    "type": "APK",
    "kind": "Directory"
  },
  "applicationId": "com.example.app",
  "variantName": "debug",
  "elements": [
    {
      "type": "SINGLE",
      "filters": [],
      "attributes": [],
      "versionCode": 1,
      "versionName": "1.0",
      "outputFile": "new-app-name-debug.apk"
    }
  ],
  "elementType": "File",
  "minSdkVersionForDexing": 24
}

I have tested this changed version on a scaffolded new project. My tests are:

  1. I don't change output filename in build.gradle file and the output-metadata.json file is not present. (apk name stays as "app-debug.apk" and is deployed to android emulator)
  2. After changing output filename in build.gradle file. (apk name changes to new name and is deployed to android emulator without any error)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant