[英]Android Nativescript app crashing on start up
我正在構建一個可以同時處理 iOS 和 Android 平台的 Nativescript 應用程序。 這是一個使用藍牙權限、firebase 的應用程序,它的 targetSDK 是 30(由於 Google Play 政策)
我的應用程序在啟動時崩潰,但僅在 ANDROID 上。 我不知道為什么 tns debug android 不輸出任何消息。 我的所有文件中的應用程序 ID 都相同。 我不知道該怎么做。 我在運行 Android 8 的舊 Android 上測試了相同的代碼,並且運行良好。 它僅適用於較新的設備。
我想知道 Android 特定代碼是否有問題,但我不確定是什么。
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.
這是我的 app.gradle,我的 applicationId 與 nativescript.config.ts 文件和 package.json 文件中的相同。
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;
完整的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"
},
以下修復了 Android 11 手機上的崩潰錯誤:
將targetSDKVersion
減少到 29。
將@nativescript/wepback
更改為"5.0.0-rc.4"
。
擺脫"webpack"
。
在刪除 nativescript-sentry 之前我遇到了同樣的問題
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.