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
Related
I am building a project in Nativescript + Angular on macOS Big Sur. I am unable to run or build the android version of the project. I keep getting this error:
Error while reporting exception: Error: Unable to start Cleanup process.
Is anyone familiar with this error? I ran tns clean successfully as well as tns platform remove android, tns platform add android, tns prepare android, but if I run tns build android or tns run android I get the error above.
Here is my package.json. Let me know if there are any files that would be useful to see.
{
"name": "#nativescript/template-hello-world-ng",
"main": "main.js",
"version": "7.0.8",
"author": "NativeScript Team <oss#nativescript.org>",
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"publishConfig": {
"access": "public"
},
"keywords": [
"nativescript",
"mobile",
"angular",
"{N}",
"template"
],
"repository": "<fill-your-repository-here>",
"bugs": {
"url": "https://github.com/NativeScript/NativeScript/issues"
},
"dependencies": {
"#angular/animations": "~11.0.0",
"#angular/common": "~11.0.0",
"#angular/compiler": "~11.0.0",
"#angular/core": "~11.0.0",
"#angular/forms": "~11.0.0",
"#angular/platform-browser": "~11.0.0",
"#angular/platform-browser-dynamic": "~11.0.0",
"#angular/router": "~11.0.0",
"#nativescript-community/ui-chart": "^1.1.29",
"#nativescript/angular": "~11.0.0",
"#nativescript/core": "^7.3.0",
"#nativescript/firebase": "^11.1.3",
"#nativescript/theme": "~3.0.0",
"nativescript": "^7.2.0",
"nativescript-carousel": "^7.0.1",
"nativescript-custom-bottomsheet": "^1.0.6",
"nativescript-fontawesome": "^1.0.0",
"nativescript-ngx-fonticon": "^7.0.0",
"nativescript-ui-chart": "^8.0.2",
"nativescript-ui-dataform": "^7.0.4",
"reflect-metadata": "~0.1.12",
"rxjs": "^6.6.0",
"sass": "^1.32.7",
"zone.js": "~0.11.1"
},
"devDependencies": {
"#angular/compiler-cli": "~11.0.0",
"#nativescript/android": "7.0.1",
"#nativescript/ios": "8.0.0",
"#nativescript/types": "~7.0.0",
"#nativescript/webpack": "~3.0.0",
"#ngtools/webpack": "~11.0.0",
"typescript": "^4.0.2"
},
"gitHead": "41a7254d3bc134fd3c258761f3c6e1c3d54e6d41",
"private": "true",
"readme": "NativeScript Application"
}
Finally got a helpful error message:
/Users/***/Documents/GitHub/RexChange_private/platforms/android/app/src/main/res/drawable-xhdpi/facebookLogo.png: Error: 'L' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore
renaming my image resources solved the issue. I guess the error is a catch all.
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'm struggling with my React Native app... It used to be deployed correctly with no errors before I updated many of the librairies I used in react-native, but now I have errors on Android & iOS.
It works fine with react-native run-android or with Android Studio, but my release APK does not pass Google Play tests.
Here is the Google Play logcat of the errors (partially) :
12-12 01:26:15.554: E/ReactNativeJS(13327): undefined is not an object (evaluating 'e.length')
12-12 01:26:15.556: I/Dpps(892): int DppsFeatureAd3::AdCalcCalibParams(struct DppsAdCfgParam &)():445 calib_a 14, calib_c 0, calib_d 0
12-12 01:26:15.558: E/ReactNativeJS(13327): Module AppRegistry is not a registered callable module (calling runApplication)
12-12 01:26:15.563: E/NetworkScheduler(11214): ignoring stale queue check message
12-12 01:26:15.563: E/NetworkScheduler(11214): --------- beginning of crash
12-12 01:26:15.564: E/AndroidRuntime(13327): FATAL EXCEPTION: mqt_native_modules
12-12 01:26:15.564: E/AndroidRuntime(13327): Process: com.mdef.mymatchup, PID: 13327
And here is my package.json :
{
"name": "my-app",
"version": "1.1.0",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"release": "cd android && ./gradlew assembleRelease",
"installRelease": "cd android && ./gradlew installRelease",
"test": "jest"
},
"dependencies": {
"babel-plugin-module-resolver": "3.0.0",
"babel-plugin-transform-remove-console": "6.8.5",
"d3-interpolate": "1.1.5",
"es6-symbol": "3.1.1",
"lodash": "~4.11.2",
"lodash.range": "3.2.0",
"module-resolver": "1.0.0",
"native-base": "2.3.5",
"native-base-shoutem-theme": "0.1.0",
"prop-types": "15.5.10",
"react": "16.0.0",
"react-native": "0.51.0",
"react-native-communications": "2.2.1",
"react-native-datepicker": "1.6.0",
"react-native-fetch-blob": "0.10.8",
"react-native-firebase-analytics": "4.0.1",
"react-native-image-crop-picker": "0.18.1",
"react-native-sentry": "0.30.2",
"react-native-splash-screen": "3.0.6",
"react-native-svg": "6.0.0",
"react-native-vector-icons": "4.4.2",
"react-navigation": "1.0.0-beta.10",
"react-redux": "5.0.5",
"redux": "3.7.2",
"redux-persist": "5.2.2",
"redux-thunk": " 2.2.0",
"striptags": "file:patch/striptags",
"react-native-fcm-opsone": "file:patch/react-native-fcm"
},
"devDependencies": {
"babel-jest": "19.0.0",
"babel-preset-react-native": "1.9.1",
"jest": "19.0.2",
"react-test-renderer": "~15.4.2"
},
"jest": {
"preset": "react-native"
},
"resolutions": {
"metro-bundler": "0.20.2",
"color-convert": "1.9.1",
"uglify-js": "github:alexlamsl/UglifyJS2#issue-2449"
}
}
I tried the answers of this issue but it did nothing.
React-Native: Module AppRegistry is not a registered callable module
Did somebody already had the same problem ? It's been 3 days now and I don't know what to do anymore... I need help please !
Issue solved ! I have fixed my problem by downgrading React-Native from 0.51.0 to 0.49.5, and I have no more crash.
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.
I followed angular2-meteor tutorial. I tried to debug the app in the simulator and in a smartphone (meteor run android/android-device --verbose). In both cases, the app loads the meteor splash screen. But, after that, only an empty white screen appears.
The only hint I see is within the meteor sun android/android-device logs which state in both cases the following:
I20160603-12:17:11.092(2)? D/MeteorWebApp( 2249): Downloaded asset manifest for version: 64e637af5e28546f390d6025d2c3e5661c275905
I20160603-12:17:11.157(2)? I/MeteorWebApp( 2249): Serving asset bundle with version: 64e637af5e28546f390d6025d2c3e5661c275905
I20160603-12:17:13.070(2) (android:http://localhost:12264/packages/ecmascript-runtime.js:279) Uncaught TypeError: Cannot redefine property: onreadystatechange
I do not know how to continue, how to obtain more information about the error or where is the point where the app failed.
Please, ask me for anything to show. There are so many things that I prefer to post more info as requested to not flooding the post.
Thank you in advance,
Miguel
Edit:
These are my dependencies:
{
"name": "health",
"private": true,
"scripts": {
"start": "meteor run"
},
"dependencies": {
"#angular/common": "^2.0.0-rc.1",
"#angular/compiler": "^2.0.0-rc.1",
"#angular/core": "^2.0.0-rc.1",
"#angular/platform-browser": "^2.0.0-rc.1",
"#angular/platform-browser-dynamic": "^2.0.0-rc.1",
"#angular/router": "^2.0.0-rc.1",
"#angular/router-deprecated": "^2.0.0-rc.1",
"angular2-meteor": "^0.5.5",
"angular2-meteor-accounts-ui": "^0.4.3",
"angular2-meteor-auto-bootstrap": "^0.5.5",
"es6-shim": "^0.35.1",
"meteor-node-stubs": "~0.2.0",
"reflect-metadata": "^0.1.2",
"rxjs": "^5.0.0-beta.6",
"zone.js": "^0.6.12"
}
}