简体   繁体   English

尝试安装 Cordova Android 平台 9 和目标 Android ZDB97444291083CA814DZ 时出现错误“无法从平台加载 PlatformApi”

[英]Error 'Unable to load PlatformApi from the platform' when trying to install Cordova Android Platform 9 and target Android API 29

I have and app that run fine with Cordova 8.1.1 and Cordova Android Platform 8.1.2.我的应用程序在 Cordova 8.1.1 和 Cordova Android Platform 8.1.2 上运行良好。 Now, Google requires that all apps must be summitted using at least Android API 29. I already setup in the config.xml the following elements:现在,Google 要求所有应用程序必须至少使用 Android API 29。我已经在 config.xml 中设置了以下元素:

<platorm name="android">
        <preference name="android-minSdkVersion" value="22" />
        <preference name="android-targetSdkVersion" value="29" />
</platorm>

But cordova android 8.1.2 seems to ignore this requirement in the build steps.但是 cordova android 8.1.2 似乎在构建步骤中忽略了这个要求。

After reading the Cordova Blog Website I noticed that there's a new version for the Android platform.阅读 Cordova 博客网站后,我注意到 Android 平台有一个新版本。 The new version 9.0.0 targets by default to API 29.新版本 9.0.0 默认以 API 29 为目标。

I'm tried to install Cordova Android platform version 9:我尝试安装 Cordova Android 平台版本 9:

cordova platform add android@9.0.0 cordova平台添加android@9.0.0

but I get an error while doing it:但我在执行此操作时遇到错误:

Unable to load PlatformApi from the platform. SyntaxError: Unexpected token {
Unhandled "error" event. (The platform "android" does not appear to be a valid Cordova platform. It is missing API.js. android not supported.)

I'm currently using Cordova 8.1.2 and I need to update to Android platform version 9 so my app can be compiled with Android API 29 (requested by Google Play). I'm currently using Cordova 8.1.2 and I need to update to Android platform version 9 so my app can be compiled with Android API 29 (requested by Google Play).

  • Node version: v8.17.0节点版本:v8.17.0
  • Cordova version: 8.1.1 Cordova 版本:8.1.1
  • Cordova Android: 9.0.0 Cordova Android:9.0.0

What I'm missing so I can add the Android platform and compile to API 29?我缺少什么,所以我可以添加 Android 平台并编译到 API 29?

I finally solved the same problem by upgrading Node from version 8 to version 11.我终于通过将 Node 从版本 8 升级到版本 11 解决了同样的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM