我正在尝试构建 sencha 本机应用程序。我经历了以下步骤:
但是,第 3 步会引发错误:
[INF] Writing content to c:\xampp\htdocs\Cordova-template\cordova\www\index.html
[INF] [Cordova] Attempting Cordova Build for platforms "android"
[INF] [shellscript]
[INF] [shellscript] c:\xampp\htdocs\Cordova-template\cordova>cordova build android
[INF] [shellscript] (node:10588) [DEP0128] DeprecationWarning: Invalid '''main''' field in '''C:\Users\USER\AppData\Roaming\npm\node_modules\cordova\node_modules\objectorarray\package.json''' of '''dist/index.js'''. Please either fix that or report it to the module author
[INF] [shellscript] (Use `node --trace-deprecation ...` to show where the warning was created)
[INF] [shellscript] Checking Java JDK and Android SDK versions
[INF] [shellscript] ANDROID_SDK_ROOT=c:\Android\cmdline-tools\ (recommended setting)
[INF] [shellscript] ANDROID_HOME=c:\Android\cmdline-tools\ (DEPRECATED)
[INF] [shellscript] (node:10588) [DEP0128] DeprecationWarning: Invalid '''main''' field in '''c:\xampp\htdocs\Cordova-template\cordova\node_modules\objectorarray\package.json''' of '''dist/index.js'''. Please either fix that or report it to the module author
[INF] [shellscript] Requirements check failed for JDK 1.8.x! Detected version: 1024.0.0
[INF] [shellscript] Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.
[ERR] C:\Users\USER\bin\Sencha\Cmd\7.3.0.19\plugin.xml:333: The following error occurred while executing this line:
C:\Users\USER\bin\Sencha\Cmd\7.3.0.19\ant\build\app\build-impl.xml:443: The following error occurred while executing this line:
C:\Users\USER\bin\Sencha\Cmd\7.3.0.19\ant\build\app\packager-impl.xml:17: The following error occurred while executing this line:
C:\Users\USER\bin\Sencha\Cmd\7.3.0.19\ant\build\app\cordova-impl.xml:77: The following error occurred while executing this line:
jar:file:/C:/Users/USER/bin/Sencha/Cmd/7.3.0.19/sencha.jar!/com/sencha/ant/antlib.xml:671: shellscript returned: 1
[ERR] A log is available in the file "C:\xampp\htdocs\Cordova-template\sencha-error-20210530-3.log"
有谁知道是什么导致了这个错误?
步骤 2 在应用程序根目录中创建 cordova
目录。我还修改了 app.json 中的构建对象:
"builds": {
"web": {"default": true},
"native": {
"packager": "cordova",
"cordova" : {
"config": {
// Uncomment the line below and add the platforms you wish to build for
//"platforms": "ios android",
"platforms": "android",
"id": "com.mycompany.MyApp",
"name": "MyApp"
}
}
}
},
我安装了最新版本的cordova 和最新的Java SDK (jdk-15.0.1) 并在环境变量中放置了适当的路径。我没有安装 Android Studio,但我安装了 cmdline-tools,并将它们放在 c:\Android\cmdline-tools\tools\
中。