Nativescript 6.5.2 Android apk“解析包时出现问题”

问题描述

我正在通过以下步骤在本地生成 apk 版本:

  1. 删除任何以前的输出:rm -rf platforms/
  2. 在本地生成一个密钥库并记录它的存储位置:
    keytool -genkeypair -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
    
  3. 使用上述密钥库/密钥密码/别名构建发布版本: tns build android --release --key-store-path [location-of-.keystore] --key-store-password [keystore-pass] --key-store-alias [alias-name] --key-store-alias-password [alias-pass]
  4. 尝试在 Android 设备上安装并收到“解析包时出现问题”。

这是我的 package.json 文件:

{
  "nativescript": {
    "id": "<ID>","tns-ios": {
      "version": "6.5.2"
    },"tns-android": {
      "version": "6.5.2"
    }
  },"description": "NativeScript Application","license": "SEE LICENSE IN <your-license-filename>","scripts": {
    "postinstall": "node postinstall.js","lint": "eslint -c .eslintrc.js \"src/**/*.ts\"","fix-lint": "eslint --fix --no-eslintrc -c .eslintrc.autofix.js \"src/**/*.ts\"","test:android": "tns test android","test:ios": "tns test ios"
  },"dependencies": {
    "@angular/animations": "~8.2.0","@angular/common": "~8.2.0","@angular/compiler": "~8.2.0","@angular/core": "~8.2.0","@angular/forms": "~8.2.0","@angular/http": "^7.2.16","@angular/platform-browser": "~8.2.0","@angular/platform-browser-dynamic": "~8.2.0","@angular/router": "~8.2.0","@nativescript/theme": "^2.3.3","@nstudio/nativescript-checkbox": "^1.0.0","@nstudio/nativescript-loading-indicator": "^3.0.3","@nstudio/nativescript-tracking-transparency": "^1.0.0","@types/node": "^13.9.1","email-validator": "^2.0.4","geolib": "^3.3.1","guid-typescript": "^1.0.9","moment": "^2.24.0","nativescript-angular": "^8.21.0","nativescript-appversion": "^1.4.4","nativescript-datetimepicker": "^1.2.2","nativescript-drop-down": "^5.0.6","nativescript-facebook": "^4.2.1","nativescript-fancyalert": "^3.0.9","nativescript-feedback": "^1.3.12","nativescript-geolocation": "^5.1.0","nativescript-gif": "^4.0.6","nativescript-google-maps-sdk": "^2.9.1","nativescript-google-places-autocomplete": "^1.0.3","nativescript-iqkeyboardmanager": "^1.5.1","nativescript-local-notifications": "^4.2.1","nativescript-masked-text-field": "^4.0.3","nativescript-mediafilepicker": "^3.0.1","nativescript-menu": "^1.1.3","nativescript-ngx-fonticon": "^5.0.2","nativescript-ngx-shadow": "^6.5.0","nativescript-plugin-appsflyer": "6.0.0","nativescript-plugin-firebase": "^10.5.0","nativescript-sentry": "^1.9.1","nativescript-ui-dataform": "^6.0.0","nativescript-ui-listview": "^8.0.1","nativescript-ui-sidedrawer": "~8.0.0","nativescript-unit-test-runner": "^0.7.0","ngx-moment": "^3.5.0","reflect-metadata": "~0.1.12","rxjs": "^6.4.0","tns-core-modules": "^6.4.2","zone.js": "^0.9.1"
  },"devDependencies": {
    "@angular-eslint/eslint-plugin": "0.0.1-alpha.32","@angular-eslint/eslint-plugin-template": "0.0.1-alpha.32","@angular/compiler-cli": "^8.2.14","@nativescript/schematics": "^1.0.0","@ngtools/webpack": "^8.2.2","@schematics/angular": "^8.3.25","@types/chai": "^4.2.11","@types/karma-chai": "0.1.2","@types/mocha": "7.0.2","@types/sinon": "^9.0.4","@typescript-eslint/eslint-plugin": "^3.6.1","@typescript-eslint/eslint-plugin-tslint": "^3.6.1","@typescript-eslint/parser": "^3.6.1","chai": "4.2.0","codelyzer": "^5.2.1","eslint": "^7.4.0","eslint-config-prettier": "^6.10.0","eslint-plugin-import": "^2.22.0","eslint-plugin-jsdoc": "^29.2.0","eslint-plugin-prefer-arrow": "^1.2.1","eslint-plugin-prettier": "^3.1.2","istanbul-instrumenter-loader": "^3.0.1","json": "^9.0.6","karma": "5.1.0","karma-chai": "0.1.0","karma-coverage": "^2.0.3","karma-coverage-istanbul-reporter": "^3.0.3","karma-mocha": "1.3.0","karma-nativescript-launcher": "0.4.0","karma-sinon": "^1.0.5","karma-sonarqube-unit-reporter": "0.0.21","karma-spec-reporter": "0.0.32","karma-webpack": "3.0.5","mocha": "7.1.0","nativescript-dev-webpack": "^1.5.1","node-sass": "^4.7.1","prettier": "^1.19.1","sinon": "^9.0.2","tns-android": "6.5.2","tns-ios": "6.5.2","tns-platform-declarations": "^6.4.2","tslint": "^6.1.0","tslint-config-prettier": "^1.18.0","tslint-plugin-prettier": "^2.2.0","typescript": "~3.5.3"
  },"readme": "NativeScript Application"
}

我尝试使用不同版本的 java 进行构建。最后一次尝试是

openjdk version "12.0.2" 2019-07-16
OpenJDK Runtime Environment AdoptOpenJDK (build 12.0.2+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 12.0.2+10,mixed mode)

这是我的 tns 版本:

tns --version 6.7.4

我已经使用完全相同的方法成功构建,所以不确定可能会发生什么变化。 Fwiw 我也尝试过这种确切的方法,但使用的是 .jks 密钥库文件类型而不是 .keystore,我已经看到了,这并没有改善我的情况。

另外,tns 医生看起来不错。这显然是 NS 的过时版本,但看起来一切正常:

✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods are installed.
✔ CocoaPods update is not required.
✔ CocoaPods are configured properly.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✔ Xcode version 12.5.1 satisfies minimum required version 10.
✔ Getting NativeScript components versions information...
⚠ Update available for component nativescript. Your current version is 6.7.4 and the latest available version is 8.0.2.
⚠ Update available for component tns-core-modules. Your current version is 6.5.0 and the latest available version is 6.5.27.
⚠ Update available for component tns-android. Your current version is 6.5.2 and the latest available version is 6.5.3.
⚠ Update available for component tns-ios. Your current version is 6.5.2 and the latest available version is 6.5.4.

其他需要注意的事项:代码在模拟器上的调试模式下运行良好,通过 USB 直接构建并运行到同一设备上,并且有问题的设备是 Galaxy S9/Android 10。

任何见解将不胜感激。提前致谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...