我刚刚制作了一个“新”离子应用程序,但是我无法让Cordova来构建APK。我将新引号引起来,因为我创建了一个新项目并从先前项目的src复制过来。插件安装在该项目上的依赖关系出了什么问题,所以我决定从一个干净的开始。
我开始了新项目并安装了我需要的所有插件。它似乎可以在浏览器中正常工作。
当我运行ionic cordova build android
时,输出如下:
PS D:\Ionic\PigsNBulls\PigsNBulls> ionic cordova build android
> ionic-app-scripts build --target cordova --platform android
[20:21:27] ionic-app-scripts 3.2.0
[20:21:27] build dev started ...
[20:21:27] clean started ...
[20:21:27] clean finished in 16 ms
[20:21:27] copy started ...
[20:21:27] deeplinks started ...
[20:21:27] deeplinks finished in 111 ms
[20:21:27] transpile started ...
[20:21:31] transpile finished in 3.56 s
[20:21:31] preprocess started ...
[20:21:31] preprocess finished in 3 ms
[20:21:31] webpack started ...
[20:21:31] copy finished in 3.84 s
[20:21:36] webpack finished in 5.03 s
[20:21:36] sass started ...
[20:21:37] sass finished in 1.24 s
[20:21:37] postprocess started ...
[20:21:37] postprocess finished in 12 ms
[20:21:37] lint started ...
[20:21:37] build dev finished in 10.14 s
[20:21:40] lint finished in 3.12 s
> cordova build android
Android Studio project detected
(node:16624) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Invalid data, chunk must be a string or buffer, not object
(node:16624) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
PS D:\Ionic\PigsNBulls\PigsNBulls>
在这个新项目之前一切正常。
答案 0 :(得分:0)
我认为您可能具有最新的cordova 8.0.0,这会导致上述错误。请使用以下命令:
npm install -g cordova@7.1.0