This repository was archived by the owner on Aug 7, 2021. It is now read-only.
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
Description
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
- Create a simple NativeScript app
- Add a custom Android application
- Import InjectionToken from @angular/core
- Run with tns run android --bundle
Environment
Provide version numbers for the following components:
- CLI: 4.2.3
- Cross-platform modules: tns-core-modules@4.2.1
- 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