我正在用Ionic Angular和Capacitor构建一个应用程序。根据Capacitor的文档,他们支持Android 5.0版本:
Android版本对电容器的支持比iOS更复杂。目前,我们的目标是API级别21或更高,即Android 5.0(棒棒糖)或更高。这占Android市场的90%以上。
但是,当我尝试在真实设备上启动Android 6.0.1棉花糖应用程序时,而不是我知道使用非常旧的WebViews的模拟器,我从Logcat收到了以下错误:
2023-02-07 20:17:30.316 1291-1291/com.my.app E/ApkAssets:加载资产资产/natives_lob_64.bin:java.io.FileNotFoundException:assets/natives_blob_64.bin时出错
2023-02-07 20:17:30.316 1291-1291/com.my.app E/ApkAssets:加载资产资产/snapshot_blob_64.bin:java.io.FileNotFoundException:assets/snapshot_blob_64.bin时出错
2023-02-07 20:17:33.179 1291-1291/com.my.app E/Capacitor:不支持SystemWebView
2023-02-07 20:17:33.300 1291-1381/com.my.app E/libEGL:validate_display:255错误3008(EGL_BAD_display)
2023-02-07 20:17:33.546 1291-1291/com.my.app E/电容器/控制台:文件:http://localhost/-第80行-消息:未捕获语法错误:意外标记(
我已经尝试了几个browserlistrc配置,并将tsconfig.ts中的目标设置为es2015,但没有任何效果。
这是我的package.json:
{
  "name": "my-app",
  "version": "0.0.3",
  "author": "John Smith",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "android": "ionic capacitor sync && ionic capacitor open android",
    "ios": "ionic capacitor sync && ionic capacitor open ios",
    "androidProd": "ionic capacitor sync && ionic capacitor build android --prod",
    "iosProd": "ionic capacitor sync && ionic capacitor build ios --prod",
    "buildProd": "ionic capacitor sync && ionic build --prod"
  },
  "browserslist": [
    "defaults and supports es6-module",
    "maintained node versions"
  ],
  "private": true,
  "dependencies": {
    "@angular/common": "^15.0.2",
    "@angular/core": "^15.0.2",
    "@angular/forms": "^15.0.2",
    "@angular/material": "^15.0.1",
    "@angular/platform-browser": "^15.0.2",
    "@angular/platform-browser-dynamic": "^15.0.2",
    "@angular/router": "^15.0.2",
    "@auth0/angular-jwt": "^5.1.0",
    "@awesome-cordova-plugins/camera": "^6.3.0",
    "@awesome-cordova-plugins/core": "^6.3.0",
    "@awesome-cordova-plugins/device": "^6.3.0",
    "@awesome-cordova-plugins/diagnostic": "^6.3.0",
    "@awesome-cordova-plugins/geolocation": "^6.3.0",
    "@awesome-cordova-plugins/local-notifications": "^6.3.0",
    "@awesome-cordova-plugins/power-optimization": "^6.3.0",
    "@awesome-cordova-plugins/screen-orientation": "^6.3.0",
    "@awesome-cordova-plugins/social-sharing": "^6.3.0",
    "@capacitor-community/facebook-login": "^4.0.0",
    "@capacitor/android": "^4.6.1",
    "@capacitor/app": "^4.1.1",
    "@capacitor/browser": "^4.1.0",
    "@capacitor/core": "^4.6.1",
    "@capacitor/ios": "4.6.1",
    "@capacitor/keyboard": "^4.1.0",
    "@capacitor/push-notifications": "^4.1.2",
    "@capacitor/status-bar": "^4.1.1",
    "@ionic/angular": "^6.3.9",
    "@ionic/pwa-elements": "^3.1.1",
    "@ngx-translate/core": "^14.0.0",
    "@ngx-translate/http-loader": "^7.0.0",
    "cordova-plugin-badge": "^0.8.8",
    "cordova-plugin-camera": "^6.0.0",
    "cordova-plugin-device": "^2.1.0",
    "cordova-plugin-geolocation": "^4.1.0",
    "cordova-plugin-local-notification": "^0.9.0-beta.2",
    "cordova-plugin-power-optimization": "^0.0.4",
    "cordova-plugin-screen-orientation": "^3.0.2",
    "cordova-plugin-x-socialsharing": "^6.0.4",
    "cordova-support-android-plugin": "^2.0.4",
    "cordova.plugins.diagnostic": "^7.1.1",
    "crypto-js": "^4.1.1",
    "es6-promise-plugin": "^4.2.2",
    "jetifier": "^2.0.0",
    "luxon": "^3.1.1",
    "net": "^1.0.2",
    "rxjs": "~7.6.0",
    "sockjs-client": "^1.6.1",
    "stompjs": "^2.3.3",
    "swiper": "^8.4.5",
    "tslib": "^2.4.1",
    "uuid": "^9.0.0",
    "zone.js": "~0.12.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^15.0.2",
    "@angular-eslint/builder": "~15.1.0",
    "@angular-eslint/eslint-plugin": "~15.1.0",
    "@angular-eslint/eslint-plugin-template": "~15.1.0",
    "@angular-eslint/template-parser": "~15.1.0",
    "@angular/cli": "^15.0.2",
    "@angular/compiler": "^15.0.2",
    "@angular/compiler-cli": "^15.0.2",
    "@angular/language-service": "^15.0.2",
    "@capacitor/cli": "^4.6.1",
    "@ionic/angular-toolkit": "^7.0.0",
    "@types/jasmine": "~4.3.1",
    "@types/jasminewd2": "~2.0.10",
    "@types/node": "^18.11.11",
    "@typescript-eslint/eslint-plugin": "5.45.1",
    "@typescript-eslint/parser": "5.45.1",
    "eslint": "^8.29.0",
    "eslint-plugin-import": "2.26.0",
    "eslint-plugin-jsdoc": "39.6.4",
    "eslint-plugin-prefer-arrow": "1.2.3",
    "jasmine-core": "~4.5.0",
    "jasmine-spec-reporter": "~7.0.0",
    "karma": "~6.4.1",
    "karma-chrome-launcher": "~3.1.1",
    "karma-coverage": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~3.0.3",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "^2.0.0",
    "protractor": "~7.0.0",
    "ts-node": "~10.9.1",
    "typescript": "~4.8.2"
  },
  "description": "An absolute awesome app"
}
这是我的tsconfig.ts:
{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "module": "es2020",
    "lib": [
      "es2018",
      "dom"
    ],
    "useDefineForClassFields": false,
    "allowSyntheticDefaultImports": true
  },
  "angularCompilerOptions": {
    "enableI18nLegacyMessageIdFormat": false,
    "strictInjectionParameters": true,
    "strictInputAccessModifiers": true,
    "strictTemplates": true,
    "allowSyntheticDefaultImports": true
  }
}
我真的需要在Android 6上运行这个应用程序,因为这个应用程序需要经过Meta的审核过程才能使用一些Facebook/InInstagram数据,他们正在Android 6棉花糖设备上进行测试,但只要出现这个错误,应用程序就会显示启动屏幕,然后只显示一个白色屏幕。