android和ios的cordova构建都失败了
Posted
技术标签:
【中文标题】android和ios的cordova构建都失败了【英文标题】:cordova build failed for both android and ios 【发布时间】:2017-12-17 23:26:41 【问题描述】:环境
(1)MacOS:10.12.5 (2)节点:v8.1.4 (3)科尔多瓦:7.0.1(4)cordova平台ls
安卓 6.2.3
ios 4.4.0
步骤
按照http://cordova.apache.org/docs/en/latest/guide/cli/index.html,创建您的第一个 Cordova 应用程序。
科尔多瓦要求
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-26,android-25,android-24,android-N,android-23,Google Inc.:Google APIs:23,android-22,android-21,android-20,android-19,android-18,android-17,android-16,android-15,android-14
Gradle: installed /Applications/Android Studio 3.0 Preview.app/Contents/gradle/gradle-4.1-milestone-1/bin/gradle
Requirements check results for ios:
Apple OS X: installed darwin
Xcode: installed 8.3.3
ios-deploy: not installed
ios-deploy was not found. Please download, build and install version 1.9.0 or greater from https://github.com/phonegap/ios-deploy into your path, or do 'npm install -g ios-deploy'
CocoaPods: installed
Error: Some of requirements check failed
sudo npm install -g ios-deploy --unsafe-perm=true
科尔多瓦要求
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-26,android-25,android-24,android-N,android-23,Google Inc.:Google APIs:23,android-22,android-21,android-20,android-19,android-18,android-17,android-16,android-15,android-14
Gradle: installed /Applications/Android Studio 3.0 Preview.app/Contents/gradle/gradle-4.1-milestone-1/bin/gradle
Requirements check results for ios:
Apple OS X: installed darwin
Xcode: installed 8.3.3
ios-deploy: installed 1.9.1
CocoaPods: installed
cordova build(或cordova build android)
ANDROID_HOME=/Users/open/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home
Error: spawn EACCES
cordova 构建 ios
BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Copy\ www\ directory /Users/open/Library/Developer/Xcode/DerivedData/HelloWorld-fqxzydxnjuyjjobwofitkplrpyef/Build/Intermediates/HelloWorld.build/Debug-iphonesimulator/HelloWorld.build/Script-304B58A110DAC018002A0835.sh
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/open/NodeProjects/cordova-projects/hello/platforms/ios/cordova/build-debug.xcconfig,-workspace,HelloWorld.xcworkspace,-scheme,HelloWorld,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,name=iPhone SE,build,CONFIGURATION_BUILD_DIR=/Users/open/NodeProjects/cordova-projects/hello/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/open/NodeProjects/cordova-projects/hello/platforms/ios/build/sharedpch
如何解决问题?
【问题讨论】:
如果您在 Ubuntu/Linux 上,则将 +rx 权限添加到 cordova 项目文件夹并检查 @pro_cheats 谢谢。我在使用macos。我尝试 +rx 到项目文件夹,没有效果。 急需帮助。 【参考方案1】:找到触发器,android studio是3.0的预览版,gradle是4.1的milestone-1。关键是gradle没有执行权!
MacOS:~ open$ cd "/Applications/Android Studio 3.0 Preview.app/Contents/gradle/gradle-4.1-milestone-1/bin/"
MacOS:bin open$ ls -l
total 24
-rw-r--r-- 1 open staff 5286 Jul 2 11:37 gradle
-rw-r--r-- 1 open staff 2250 Jul 2 11:37 gradle.bat
MacOS:bin open$ sudo chmod a+x gradle
然后执行命令:cordova build
,一切正常。
【讨论】:
以上是关于android和ios的cordova构建都失败了的主要内容,如果未能解决你的问题,请参考以下文章
在 Android 中添加 Neumorphism 依赖项时构建失败
AzureDevOps Android Pipeline zipalign - 失败,退出代码为 1
Cordova HttpClient 调用在 IOS 设备中失败,但在 Android 中有效