I am currently updating my mobile app project from nativescript 5.2.1 to version 6. however trying to run it will always trigger this problem, and i am not sure how to handle it
when i check the code, it seemed it tried to split global.process.version or process.version either in vendor.js or pbkdf2/lib/default-encoding.js
An uncaught Exception occurred on "main" thread.
Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function
TypeError: Cannot read property 'split' of undefined
File: (file:///data/data/com.ikredo.ikredolenderapp/files/app/vendor.js:142790:54)
StackTrace:
../node_modules/pbkdf2/lib/default-encoding.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/vendor.js:142790:55)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at ../node_modules/pbkdf2/lib/sync.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/vendor.js:142852:23)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at ../node_modules/pbkdf2/index.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/vendor.js:142658:24)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at ../node_modules/crypto-browserify/index.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/vendor.js:58549:9)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at ./global/functions.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/bundle.js:22025:64)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at ./global/init.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/bundle.js:22311:68)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at (file:///data/data/com.ikredo.ikredolenderapp/files/app/bundle.js:20643:70)
at ./app.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/bundle.js:20701:30)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at checkDeferredModules(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:44:23)
at webpackJsonpCallback(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:31:19)
at (file:///data/data/com.ikredo.ikredolenderapp/files/app/bundle.js:2:57)
at require(:1:266)
TypeError: Cannot read property 'split' of undefined
StackTrace:
java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function
TypeError: Cannot read property 'split' of undefined
File: (file:///data/data/com.ikredo.ikredolenderapp/files/app/vendor.js:142790:54)
StackTrace:
../node_modules/pbkdf2/lib/default-encoding.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/vendor.js:142790:55)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at ../node_modules/pbkdf2/lib/sync.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/vendor.js:142852:23)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at ../node_modules/pbkdf2/index.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/vendor.js:142658:24)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at ../node_modules/crypto-browserify/index.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/vendor.js:58549:9)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at ./global/functions.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/bundle.js:22025:64)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at ./global/init.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/bundle.js:22311:68)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at (file:///data/data/com.ikredo.ikredolenderapp/files/app/bundle.js:20643:70)
at ./app.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/bundle.js:20701:30)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at checkDeferredModules(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:44:23)
at webpackJsonpCallback(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:31:19)
at (file:///data/data/com.ikredo.ikredolenderapp/files/app/bundle.js:2:57)
at require(:1:266)
TypeError: Cannot read property 'split' of undefined
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6318)
at android.app.ActivityThread.access$1300(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1867)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:226)
at android.app.ActivityThread.main(ActivityThread.java:7212)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:956)
Caused by: com.tns.NativeScriptException: Error calling module function
TypeError: Cannot read property 'split' of undefined
File: (file:///data/data/com.ikredo.ikredolenderapp/files/app/vendor.js:142790:54)
StackTrace:
../node_modules/pbkdf2/lib/default-encoding.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/vendor.js:142790:55)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at ../node_modules/pbkdf2/lib/sync.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/vendor.js:142852:23)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at ../node_modules/pbkdf2/index.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/vendor.js:142658:24)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at ../node_modules/crypto-browserify/index.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/vendor.js:58549:9)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at ./global/functions.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/bundle.js:22025:64)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at ./global/init.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/bundle.js:22311:68)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at fn(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:121:20)
at (file:///data/data/com.ikredo.ikredolenderapp/files/app/bundle.js:20643:70)
at ./app.js(file:///data/data/com.ikredo.ikredolenderapp/files/app/bundle.js:20701:30)
at __webpack_require__(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:751:30)
at checkDeferredModules(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:44:23)
at webpackJsonpCallback(file:///data/data/com.ikredo.ikredolenderapp/files/app/runtime.js:31:19)
at (file:///data/data/com.ikredo.ikredolenderapp/files/app/bundle.js:2:57)
at require(:1:266)
TypeError: Cannot read property 'split' of undefined
at com.tns.Runtime.runModule(Native Method)
at com.tns.Runtime.runModule(Runtime.java:674)
at com.tns.Runtime.run(Runtime.java:666)
at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6313)
... 8 more
trying to get over the "please add some more details", sorry to look unprofessional but i cannot describe any more detail
Edit:
as requested here is my package.json
{
"nativescript": {
"id": "com.xxxx",
"tns-ios": {
"version": "6.0.1"
},
"tns-android": {
"version": "6.0.0"
}
},
"description": "Lender",
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"dependencies": {
"axios": "^0.18.0",
"lodash": "^4.17.11",
"moment": "^2.24.0",
"nativescript-background-http": "^3.4.0",
"nativescript-camera": "^4.5.0",
"nativescript-cardview": "^3.1.1",
"nativescript-carousel": "^4.1.0",
"nativescript-checkbox": "^3.0.3",
"nativescript-clipboard": "^1.2.0",
"nativescript-datetimepicker": "^1.0.2",
"nativescript-drop-down": "^5.0.0",
"nativescript-fingerprint-auth": "^6.2.0",
"nativescript-imagepicker": "^6.1.2",
"nativescript-iqkeyboardmanager": "^1.4.0",
"nativescript-loading-indicator": "^2.4.0",
"nativescript-lottie": "^3.0.2",
"nativescript-material-bottomsheet": "^2.2.5",
"nativescript-material-ripple": "^2.2.5",
"nativescript-material-textfield": "^2.2.3",
"nativescript-pager": "^9.4.0",
"nativescript-pdf-view": "^2.0.1",
"nativescript-plugin-firebase": "9.0.2",
"nativescript-pulltorefresh": "^2.3.0",
"nativescript-sqlite": "^2.3.3",
"nativescript-statusbar": "^5.0.0",
"nativescript-theme-core": "~1.0.4",
"nativescript-vue": "2.3.0",
"nativescript-web-image-cache": "^5.0.0",
"tns-core-modules": "6.0.1",
"typescript": "^3.7.3"
},
"devDependencies": {
"#babel/core": "~7.1.0",
"#babel/preset-env": "~7.1.0",
"babel-loader": "~8.0.0",
"nativescript-dev-webpack": "1.0.1",
"nativescript-vue-template-compiler": "2.3.0",
"node-sass": "4.12.0",
"vue-loader": "~15.4.0",
"tns-platform-declarations": "6.0.1"
},
"gitHead": "xxx",
"readme": "NativeScript Application",
"maxLogcatObjectSize": 1000000
}
Somewhere, "something" is attempting to perform a split on a string that either doesn't exist or has not been initialized. Off the top of my head, I can't say, "I've run into this exact thing and here is the solution." However, I've definitely run into some...interesting...issues when updating my project dependencies. My first guess is that your webpack.config.js needs to be updated to match the new dependencies. But that isn't much more than a gut feeling or a place to start.
With that, here are some things which may [or may not] be helpful. Anytime I update my dependencies now, I run through these triage points:
Run tns doctor and see if it has any opinions about any existing dependencies
As of NativeScript 6.3.0, there is no longer a need to use the older tns-core-modules/. Instead, use #nativescript/core/. If you are using the older, backward-compatible modules, make sure that their versions have also been updated (both tns-core-modules and tns-platform-declarations).
When I updated my dependencies, I also deleted my webpack.config.js file so that NativeScript would generate a new, current version. tns update does not appear to update the Webpack config. At most, a warning may go by in the hundreds of lines of console output while building. After I deleted my Webpack config, and thus allowing NativeScript to generate a new one, GitHub showed some significant differences between the old/new versions.
Thoroughly clean your project: Empty or delete the node_modules folder and run tns platform clean android and tns platform clean ios.
Hopefully, some part of this helps. Good luck!
Adding var process = require('process'); at the top of the default-encoding.js and _stream_writable.js fixed it for me.
Related
I'm building a Nativescript app that will handle both the iOS and Android platforms. It's an app that uses bluetooth permissions, firebase, and it's targetSDK is 30 (due to Google Play Policy)
My app is crashing on start up, but ONLY ON ANDROID. I have no idea why and tns debug android outputs no message. My application id is the same across all my files. I’m not sure what to do. I tested the same code on an older Android running Android 8 and that worked fine. It's only on newer devices.
I'm wondering if it's something wrong with Android specific code, but I'm not sure what.
This issue may be caused by:
* crash at startup (try `tns debug android --debug-brk` to check why it crashes)
* different application identifier in your package.json and in your gradle files (check your identifier in `package.json` and in all *.gradle files in your App_Resources directory)
* device is locked
* manual closing of the application
Unable to apply changes on device: R58M50KS8YL. Error is: Application com.xxxxllc.xxxx is not running.
Here is my app.gradle, with my applicationId the same as in the nativescript.config.ts file and package.json file.
android {
defaultConfig {
applicationId "com.xxxxllc.xxxx"
minSdkVersion 21
targetSdkVersion 30
generatedDensities = []
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
package.json
"nativescript": {
"id": "com.xxxxllc.xxxx"
},
...
nativescript.config.ts
export default {
id: 'com.xxxxllc.xxxx',
appPath: 'src',
appResourcesPath: 'App_Resources',
android: {
v8Flags: '--expose_gc',
markingMode: 'none'
}
} as NativeScriptConfig;
Full package.json
"dependencies": {
"#angular/animations": "~11.2.7",
"#angular/cdk": "~11.2.7",
"#angular/common": "~11.2.7",
"#angular/compiler": "~11.2.7",
"#angular/core": "~11.2.7",
"#angular/forms": "~11.2.7",
"#angular/platform-browser": "~11.2.7",
"#angular/router": "~11.2.7",
"#bradmartin/nativescript-urlhandler": "^2.0.1",
"#mhtghn/nativescript-highcharts": "^1.0.2",
"#nativescript-community/ble": "^3.0.25",
"#nativescript-community/insomnia": "^2.0.2",
"#nativescript-community/ui-drawer": "0.0.28",
"#nativescript/angular": "~11.8.0",
"#nativescript/core": "^8.0.8",
"#nativescript/firebase": "^11.1.3",
"#nativescript/theme": "~3.0.1",
"#proplugins/nativescript-purchase": "^6.0.0",
"#triniwiz/nativescript-toasty": "~4.1.3",
"bluebird": "3.5.5",
"crypto-es": "^1.2.7",
"nativescript-permissions": "^1.3.11",
"nativescript-sentry": "^2.0.1",
"npm-check-updates": "^11.8.3",
"reflect-metadata": "^0.1.13",
"rxjs": "~6.6.7",
"zone.js": "~0.11.4"
},
"devDependencies": {
"#angular/compiler-cli": "~11.2.7",
"#nativescript/android": "8.0.0",
"#nativescript/ios": "8.0.0",
"#nativescript/types": "~8.0.0",
"#nativescript/webpack": "5.0.0-dev.5",
"#ngtools/webpack": "^11.2.14",
"webpack": "5.48.0",
"sass": "~1.35.1",
"ts-node": "~10.0.0",
"typescript": "~4.0.0"
},
The following fixed the crashing error on Android 11 phones:
Reducing targetSDKVersion to 29.
Changing #nativescript/wepback to "5.0.0-rc.4".
Getting rid of "webpack".
I had same issue before removing nativescript-sentry
I have an error since yesterday I try to fix. I successfully built an android apk using:
ionic cordova build android --prod --release
But the app stuck on white screen on device and emulator (GenyMotion). I inspected the logcat of GenyMotion. I figured out these:
> I/chromium( 5497): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token )", source: http://localhost/runtime.fcad956485f9614ff8b1.js (1)
> D/SystemWebChromeClient( 5497): http://localhost/polyfills.49d987a1d15d60566c3f.js: Line 1 : Uncaught SyntaxError: Unexpected token =>
> I/chromium( 5497): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token =>", source: http://localhost/polyfills.49d987a1d15d60566c3f.js (1)
> D/SystemWebChromeClient( 5497): http://localhost/main.2be168d95557cbdc0a3f.js: Line 1 : Uncaught SyntaxError: Unexpected token =>
> I/chromium( 5497): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token =>", source: http://localhost/main.2be168d95557cbdc0a3f.js (1)
I don't know why. They are no errors when building.
My package.json
...
"#angular/common": "~12.0.1",
"#angular/core": "~12.0.1",
"#angular/forms": "~12.0.1",
"#angular/platform-browser": "~12.0.1",
"#angular/platform-browser-dynamic": "~12.0.1",
"#ionic/angular": "^5.5.2",
"ionic": "^5.4.16",
"cordova-android": "^9.0.0",
"cordova-browser": "^6.0.0",
"cordova-ios": "^5.1.1",
"cordova-plugin-ionic-webview": "^5.0.0",
...
"#typescript-eslint/eslint-plugin": "4.16.1",
"#typescript-eslint/parser": "4.16.1",
"typescript": "~4.2.4"
My tsconfig.json.
...
"target": "es2015",
"module": "es2020",
"lib": ["es2018", "dom"]
...
After a real battle in order to fix the issue since 3 days,
i solved the problem.
Ionic 5 angular 12 use es2015 as a target when building.
I set "target" to es5 in tsconfig.json and errors in runtime.**.js, polyfills.**.json disappeared
es5 transform ES6 function to standard functions.
More info at
https://www.typescriptlang.org/tsconfig
Here is pretty clear. You have a syntax error. I suppose you can check logs for ionic cordova build android --prod. Probably It will show which files and lines generate these problems.
If you use linter you can try to run npm run lint to check any problems with your code.
ionic + angular has update the type script compiler in the recent update as
Root folder > tcconfig.json > compilerOptions > target > es2020 - This is causing the issue in android version 29
Chang the target as es2015 to resolve the issue
After upgrading the following line in the build.gradle file
classpath 'com.android.tools.build:gradle:3.2.1'
and below line in gradle-wrapper.properties file
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
the signed release apk of my app is not working at all. Though when I am running the app in development mode everything is working fine.
Below is the error i am getting in the android studio logcat -
2018-11-23 17:49:24.552 3506-3570/? E/AndroidRuntime: FATAL EXCEPTION:
Thread-2
Process: com.simplydatanow.driverapp, PID: 3506
java.lang.RuntimeException: Unable to load script from assets 'index.android.bundle'. Make sure your bundle is packaged correctly or
you're running a packager server.
at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native
Method)
at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:216)
at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:33)
at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:234)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1137)
at com.facebook.react.ReactInstanceManager.access$900(ReactInstanceManager.java:113)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:944)
at java.lang.Thread.run(Thread.java:764)
This is the signed release apk, so index.android.bundle should be already present inside the apk. But somehow it is not able to find that. Any help is appreciated.
All dependecies in package.json -
"dependencies": {
"moment": "^2.22.2",
"polished": "^1.9.2",
"react": "16.2.0",
"react-native": "0.52.0",
"react-native-auth0": "^1.2.2",
"react-native-background-fetch": "^2.4.3",
"react-native-background-task": "^0.2.1",
"react-native-compress-image": "^2.0.1",
"react-native-datepicker": "^1.7.2",
"react-native-document-picker": "^2.1.0",
"react-native-elements": "^0.19.0",
"react-native-fab": "^1.0.8",
"react-native-fetch-blob": "^0.10.8",
"react-native-floating-action": "^1.13.0",
"react-native-fs": "^2.10.14",
"react-native-image-cache-hoc": "^2.0.0",
"react-native-image-picker": "^0.26.10",
"react-native-image-progress": "^1.1.0",
"react-native-image-to-pdf": "^1.0.0",
"react-native-image-zoom-viewer": "^2.2.24",
"react-native-keyboard-aware-scroll-view": "^0.5.0",
"react-native-keyboard-aware-view": "^0.0.14",
"react-native-pdf": "^5.0.9",
"react-native-progress": "^3.4.0",
"react-native-scrollable-tab-view": "^0.8.0",
"react-native-simple-dialogs": "^0.4.1",
"react-native-star-rating": "^1.0.8",
"react-native-timer-component": "^1.0.2",
"react-native-uuid-generator": "^4.0.1",
"react-native-vector-icons": "^4.6.0",
"react-navigation": "^2.14.2",
"react-redux": "^5.0.7",
"redux": "^3.7.2"
},
change version code and version name in build.gradle(Module:app)
Go to Build-->Generate Signed Bundle or Apk--> choose APK--> click on 'Next'--> Enter keystore credentials or if you don't have create it--> check both V1 and V2 in signature versions--> click on finish to generate signed APK.
Upload this APK to playstore
Recently I have started facing a strange issue with Nativescript. When I try to run the android application using tns run android I get following error message
Unable to apply changes on device: HQ64MZ576132. Error is: Socket connection timeouted..
I dont know how to identify the actual issue. To fix this issue, I need to copy app folder from another working nativescript application and then replace all the file from repository and eventually I am back to normal running application.
Following is what I am trying to figure out:
How to identify what is causing Socket connection timeouted?
Why replacing the whole app solves the issue even when the files are exactly
same which doesnt make sense to me?
Following is my package.json
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "com.travel",
"tns-android": {
"version": "5.0.0"
}
},
"scripts": {
"lint": "tslint \"app/**/*.ts\""
},
"dependencies": {
"nativescript-admob": "^1.4.2",
"nativescript-appversion": "^1.4.1",
"nativescript-exit": "^1.0.1",
"nativescript-grid-view": "^3.4.0",
"nativescript-purchase": "^2.0.5",
"nativescript-social-share": "^1.5.0",
"nativescript-theme-core": "1.0.4",
"nativescript-toast": "^1.4.6",
"nativescript-ui-chart": "^3.8.0",
"nativescript-ui-sidedrawer": "^3.5.1",
"rxjs": "5.5.2",
"tns-core-modules": "^5.0.0"
},
"devDependencies": {
"awesome-typescript-loader": "~3.1.3",
"babel-traverse": "6.4.5",
"babel-types": "6.4.5",
"babylon": "6.4.5",
"copy-webpack-plugin": "~4.3.0",
"css-loader": "^0.28.11",
"extract-text-webpack-plugin": "~3.0.2",
"lazy": "1.0.11",
"nativescript-dev-sass": "1.3.5",
"nativescript-dev-typescript": "0.5.1",
"nativescript-dev-webpack": "^0.16.2",
"nativescript-worker-loader": "~0.8.1",
"raw-loader": "~0.5.1",
"resolve-url-loader": "~2.2.1",
"sass-loader": "^6.0.7",
"tns-platform-declarations": "^4.2.0",
"tslint": "5.8.0",
"typescript": "2.8.4",
"uglifyjs-webpack-plugin": "~1.1.6",
"webpack": "^3.12.0",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-sources": "~1.1.0"
}
}
Thanks
This has been a nasty issue which ate most of my days. It was nativescript-admob plugin which was causing application to break. Version 17.0.0 of Google Mobile Ads SDK requires tag in AndroidManifest.xml. You can find more info here https://developers.google.com/admob/android/quick-start#update_your_androidmanifestxml. There is open issue https://github.com/EddyVerbruggen/nativescript-admob/issues/45 which has a temp.
You will have to add following line to AndroidManifest.xml
<application>
<!-- this line needs to be added (replace the value!) -->
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3940256099942544~3347511713" />
<activity></activity>
</application>
I create Angular 2 nativescript project and after adding android platform, i run the project in a connected nexus 6p with android version 7.1.1 and when app deployed to the device i got this error:
An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Application entry point file not found. Please specify the file in package.json otherwise make sure the file index.js or bootstrap.js exists.\nIf using typescript make sure your entry point file is transpiled to javascript.
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5406)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: com.tns.NativeScriptException: Application entry point file not found. Please specify the file in package.json otherwise make sure the file index.js or bootstrap.js exists.\nIf using typescript make sure your entry point file is transpiled to javascript.
at com.tns.Module.bootstrapApp(Module.java:337)
at com.tns.Runtime.run(Runtime.java:508)
at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5403)
... 8 more
Caused by: com.tns.NativeScriptException: Failed to find module: "./", relative to: app//
at com.tns.Module.resolvePathHelper(Module.java:159)
at com.tns.Module.bootstrapApp(Module.java:335)
... 12 more
any idea how can i solve this error?
Update:
i create the project with tns create name --ng and i just run it with tns run android command.
the package.js file:
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.Bazim",
"tns-android": {
"version": "2.4.1"
}
},
"dependencies": {
"#angular/common": "2.2.1",
"#angular/compiler": "2.2.1",
"#angular/core": "2.2.1",
"#angular/forms": "2.2.1",
"#angular/http": "2.2.1",
"#angular/platform-browser": "2.2.1",
"#angular/platform-browser-dynamic": "2.2.1",
"#angular/router": "3.2.1",
"nativescript-angular": "1.2.0",
"nativescript-theme-core": "^0.2.1",
"reflect-metadata": "~0.1.8",
"rxjs": "5.0.0-beta.12",
"tns-core-modules": "2.4.3",
"typescript": "~2.0.10",
},
"devDependencies": {
"babel-traverse": "6.21.0",
"babel-types": "6.21.0",
"babylon": "6.14.1",
"lazy": "1.0.11",
"nativescript-dev-android-snapshot": "^0.*.*",
"nativescript-dev-typescript": "^0.3.2",
"typescript": "~2.0.10",
"zone.js": "~0.6.21"
}
}
The problem was from node version, i updated the node and the problem solved!
The package.json file you posted is the wrong one.
There should be another one inside the app folder.
It should look something likes this :
{
"name": "name",
"main": "app.js", //THIS IT THE ENTRYPOINT
"version": "X.X.X",
"author": {
"name": "Name",
"email": "some#email.com"
},
"description": "some desc!",
"repository": {
"url": "https://github.com/yourrepo"
}
}
Verify that the entry point file exists (it has to be a .js file and not a a typescript file) and you should be good to go.
the entry point is defined in angular.json
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/output",
"index": "src/index.html",
"main": "src/main.ts",
but error like this can happen if we have any compile errors, I had it with tests and sub application, I excluded it in tsconfig and now it works
In my case it was related to my NativeScript CLI version. Updated the version and the issue was solved. Just for reference I was at angular-cli 7.3.6 and NativeScript-cli 5.4.0 (got the issue) updated to NativeScript-cli 5.4.2 to solve the issue. Anyone facing the similar issue, try updating your NativeScript CLI version.