Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Custom Android application with Angular import crashes at startup #699

Closed
dennis-montana opened this issue Oct 22, 2018 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@dennis-montana
Copy link

Describe the bug
We have an app that uses a custom Android application which imports a file that imports InjectionToken from @angular/core. When we run the app normally all goes well, when we run it with Webpack it crashes on startup.
The runtime error we get:

An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to create application com.tns.MyCustomApplication: com.tns.NativeScriptException: JavaScript object for Java ID 0 not found.
Attempting to call method onCreate

Sample project
I've created a sample project:
https://github.com/dennis-montana/webpack-custom-application-issue

If you remove line 1 and 3 with the InjectionToken from my-config.ts the app runs as expected with Webpack.

To Reproduce

  1. Create a simple NativeScript app
  2. Add a custom Android application
  3. Import InjectionToken from @angular/core
  4. Run with tns run android --bundle

Environment
Provide version numbers for the following components:

  • CLI: 4.2.3
  • Cross-platform modules: [email protected]
  • Android Runtime: 4.2.0
  • iOS Runtime: 4.2.0
  • Plugin(s):
    "@angular/cli": "6.2.3",
    "@angular/common": "6.1.8",
    "@angular/compiler": "6.1.8",
    "@angular/core": "6.1.8",
    "@angular/forms": "6.1.8",
    "@angular/http": "6.1.8",
    "@angular/platform-browser": "6.1.8",
    "@angular/platform-browser-dynamic": "6.1.8",
    "@angular/router": "6.1.8",
    "nativescript-angular": "6.1.0",
    "nativescript-theme-core": "~1.0.4",
    "tns-core-modules": "~4.2.0",
    "tns-platform-declarations": "^4.2.1",
    "rxjs": "6.3.2"
  • Node.js: 6.10.2
@bagnos
Copy link

bagnos commented Dec 4, 2018

I have the same issue, Did you resolve?

@dennis-montana
Copy link
Author

We did not find a solution. For now we created a workaround by not using InjectionToken in our custom application.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants