NativeScript +角度应用程序在启动时崩溃(android 11 - API 30)
我有一个 NativeScript + Angular 的应用程序,当我在 App_Resources\Android\app.gradle 上将 targetSdkVersion 从 29 到 30(根据 Google 的需要)时,应用程序在启动时崩溃并没有显示任何内容,只是自行关闭。我尝试了很多方法来修复,但没有任何效果。当我将 targetSdkVersion 恢复到 29 时,该应用程序运行良好。
app.gradle
android {
compileSdkVersion 30
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
generatedDensities = []
multiDexEnabled true
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
dependencies {
implementation "androidx.multidex:multidex:2.0.1"
}
package.json 依赖项
"dependencies": {
"@angular/animation": "^4.0.0-beta.8",
"@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/angular": "~11.0.0",
"@nativescript/appversion": "^2.0.0",
"@nativescript/core": "~7.0.0",
"@nativescript/datetimepicker": "~2.0.0",
"@nativescript/iqkeyboardmanager": "~2.0.0",
"@nativescript/picker": "^3.0.1",
"@nativescript/theme": "~2.3.3",
"@nativescript/webpack": "^3.0.0",
"@nstudio/nativescript-exoplayer": "^5.0.6",
"@nstudio/nativescript-snackbar": "^2.1.0",
"@ticnat/nativescript-searchable-select": "^1.0.7",
"credit-card-type": "^9.1.0",
"moment": "^2.29.1",
"nativescript-audio": "^6.2.0",
"nativescript-dna-netservices": "^1.1.0",
"nativescript-fontawesome": "^1.0.0",
"nativescript-iap": "^8.0.3",
"nativescript-screen-orientation": "^2.0.0",
"nativescript-sentry": "^2.0.0",
"nativescript-sqlite": "^2.6.4",
"nativescript-ui-dataform": "^7.0.4",
"nativescript-ui-sidedrawer": "~9.0.0",
"nativescript-zip": "^4.0.2",
"reflect-metadata": "~0.1.12",
"rxjs": "^6.6.0",
"xcode": "^3.0.1",
"zone.js": "~0.11.1"
},
"devDependencies": {
"@angular/cli": "^11.0.2",
"@angular/compiler-cli": "~11.0.0",
"@nativescript/android": "7.0.1",
"@nativescript/ios": "7.1.1",
"@nativescript/schematics": "^10.1.0",
"@nativescript/types": "7.0.0",
"@ngtools/webpack": "~11.0.0",
"@types/jest": "^26.0.15",
"codelyzer": "~6.0.0",
"node-sass": "^4.14.1",
"ts-patch": "^1.3.2",
"tslint": "~6.1.3",
"typescript": "~4.0.0"
}
I have an app in NativeScript + Angular, when i put targetSdkVersion from 29 to 30 (as google needs) on App_Resources\Android\app.gradle, the app crashes on start and show nothing, just closes itself. I tryed so many things to fix, and nothing works. When i back targetSdkVersion to 29, the app works perfectly.
app.gradle
android {
compileSdkVersion 30
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
generatedDensities = []
multiDexEnabled true
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
dependencies {
implementation "androidx.multidex:multidex:2.0.1"
}
package.json dependencies
"dependencies": {
"@angular/animation": "^4.0.0-beta.8",
"@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/angular": "~11.0.0",
"@nativescript/appversion": "^2.0.0",
"@nativescript/core": "~7.0.0",
"@nativescript/datetimepicker": "~2.0.0",
"@nativescript/iqkeyboardmanager": "~2.0.0",
"@nativescript/picker": "^3.0.1",
"@nativescript/theme": "~2.3.3",
"@nativescript/webpack": "^3.0.0",
"@nstudio/nativescript-exoplayer": "^5.0.6",
"@nstudio/nativescript-snackbar": "^2.1.0",
"@ticnat/nativescript-searchable-select": "^1.0.7",
"credit-card-type": "^9.1.0",
"moment": "^2.29.1",
"nativescript-audio": "^6.2.0",
"nativescript-dna-netservices": "^1.1.0",
"nativescript-fontawesome": "^1.0.0",
"nativescript-iap": "^8.0.3",
"nativescript-screen-orientation": "^2.0.0",
"nativescript-sentry": "^2.0.0",
"nativescript-sqlite": "^2.6.4",
"nativescript-ui-dataform": "^7.0.4",
"nativescript-ui-sidedrawer": "~9.0.0",
"nativescript-zip": "^4.0.2",
"reflect-metadata": "~0.1.12",
"rxjs": "^6.6.0",
"xcode": "^3.0.1",
"zone.js": "~0.11.1"
},
"devDependencies": {
"@angular/cli": "^11.0.2",
"@angular/compiler-cli": "~11.0.0",
"@nativescript/android": "7.0.1",
"@nativescript/ios": "7.1.1",
"@nativescript/schematics": "^10.1.0",
"@nativescript/types": "7.0.0",
"@ngtools/webpack": "~11.0.0",
"@types/jest": "^26.0.15",
"codelyzer": "~6.0.0",
"node-sass": "^4.14.1",
"ts-patch": "^1.3.2",
"tslint": "~6.1.3",
"typescript": "~4.0.0"
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
谢谢MishaMashina!将 android:allowNativeHeapPointerTagging="false" 放入我的 AndroidManifest.xml 解决了我的问题。
另外,在解决第一个问题后,我还遇到了 API 30 的另一个问题。当我尝试在 webView 中加载内容时,出现了 ERR_ACCESS_DENIED 错误。我解决了这个问题,在加载 webView 时在代码上设置此属性:
Thanks MishaMashina! Putting android:allowNativeHeapPointerTagging="false" in my AndroidManifest.xml solved my problem.
In aditional, i had another problem with API 30 after solved the first one. i was taking the ERR_ACCESS_DENIED error when i tryed load content in a webView. And i solved it setting this properties on the code when loading the webView: