ngx-rocket / generator-ngx-rocket

:rocket: Extensible Angular 14+ enterprise-grade project generator
https://ngx-rocket.github.io/
MIT License
1.53k stars 217 forks source link

Can not build release for android. Error project name #513

Closed alhiro closed 4 years ago

alhiro commented 4 years ago

I'm submitting a...

Current behavior

I am using ngx new for generate new project. Next prepare step is release build for android.

ionic cordova platform add android

When this step run normal. Next

ionic cordova prepare android

Omg, show error like this:

> ng.cmd run app:ionic-cordova-build --platform=android
An unhandled exception occurred: Project 'app' could not be found in workspace.
See "C:\Users\hai\AppData\Local\Temp\ng-7OZiEA\angular-errors.log" for further details.
[ERROR] An error occurred while running subprocess ng.

The problem is when i am trying build ionic cordova for release. When i am rename the project > 'app', and rename back to original > 'prototype' still get the error.

Expected behavior

But if i am generate project from ionic start no problem at all.

Minimal reproduction of the problem with instructions

Angular.json file

{
  "$schema": "./node_modules/@angular-devkit/core/src/experimental/workspace/workspace-schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "prototype": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "prototype",
      "schematics": {
        "@schematics/angular:component": {
          "styleext": "scss"
        }
      },
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "tsconfig.app.json",
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/favicon.ico",
              "src/apple-touch-icon.png",
              "src/robots.txt",
              "src/manifest.json",
              {
                "glob": "**/*.svg",
                "input": "node_modules/ionicons/dist/ionicons/svg",
                "output": "./svg"
              },
              "src/assets"
            ],
            "styles": [
              "src/main.scss"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                }
              ],
              "serviceWorker": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            },
            "ci": {
              "progress": false
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "hmr": true,
            "hmrWarning": false,
            "browserTarget": "prototype:build"
          },
          "configurations": {
            "production": {
              "hmr": false,
              "browserTarget": "prototype:build:production"
            },
            "ci": {
              "progress": false
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "prototype:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",
            "scripts": [],
            "styles": [
              "src/main.scss"
            ],
            "assets": [
              "src/favicon.ico",
              "src/apple-touch-icon.png",
              "src/robots.txt",
              "src/manifest.json",
              {
                "glob": "**/*.svg",
                "input": "node_modules/ionicons/dist/ionicons/svg",
                "output": "./svg"
              },
              "src/assets"
            ]
          },
          "configurations": {
            "ci": {
              "progress": false,
              "watch": false
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "tsconfig.app.json",
              "tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "prototype-e2e": {
      "root": "e2e",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "prototype:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "prototype"
}
sinedied commented 4 years ago

You do not need ionic to build the project, as stated in the readme here are the task to build Cordova-based projects:

Task Description
npm run cordova:prepare Prepare for building mobile app (restore Cordova platforms and plugins)
npm run cordova:run <ios/android> [--device] Run app on target platform device or simulator
npm run cordova:build [-- --configuration=production] Build mobile app for production in dist/ folder
npm run cordova:clean Removes www/, platforms/ and plugins/ folders