0

Thanks to the help by Shai and Steve, I am making progress to build the iOS Xcode project in Eclipse. After installing cocoapods (Failed to build iOS Xcode project in Eclipse using the example codenameone project) and JDK 11 (Cannot run program "xcodebuild" in Eclipse on MacBook using the example codenameone project), my build failed at a later stage. I posted the stack trace below, although I am not sure the cause of failure. One info line says "Failed to fix xcode project schemes. Make sure you have Cocoapods installed". I did "brew list cocoapods" and saw version 1.11.3_1 installed at /usr/local/Cellar/cocoapods. The info lines above that line suggest that repeated efforts to chmod a particular file (/Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/hooks/fix_xcode_schemes.rb) failed. However when I went into /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/ and watched its content during build, I saw sub directories created in that directory then deleted but did not see the "hooks" subdirectory. I don't know how to debug further.

Thank you for your help.


[[1;34mINFO[m] Parsing: /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/classes/com/codename1/media/RemoteControlCallback$6.class

[[1;34mINFO[m] Parsing: /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/classes/com/codename1/media/AbstractMedia.class

[[1;34mINFO[m] Parsing: /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/classes/com/codename1/media/RemoteControlCallback$4.class

[[1;34mINFO[m] Parsing: /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/classes/com/codename1/media/MediaManager.class

[[1;34mINFO[m] Parsing: /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/classes/com/codename1/media/AbstractMedia$2StateChangeListener.class
[[1;34mINFO[m] 
Parsing: /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/classes/com/codename1/media/AudioBuffer$1.class

[[1;34mINFO[m] Rewrite /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/dist/MyCNOApp-src/cn1_globals.h with 1 changes

[[1;34mINFO[m] outputDirectory is: /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/dist/MyCNOApp-src
[[1;34mINFO[m] 

[[1;34mINFO[m] 43 native files

[[1;34mINFO[m] Native files total 1035K

[[1;34mINFO[m] Optimizer On: Removing unused methods and classes...

[[1;34mINFO[m] cullClasses()

[[1;34mINFO[m] cullClasses()

[[1;34mINFO[m] cullClasses()

[[1;34mINFO[m] cullClasses()

[[1;34mINFO[m] cullClasses()
unusued Method cull removed 5729 methods in 30 seconds

[[1;34mINFO[m] Rewrite /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/dist/MyCNOApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata with 1 changes

[[1;34mINFO[m] Rewrite /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/dist/MyCNOApp.xcodeproj/project.pbxproj with 60 changes

[[1;34mINFO[m] Rewrite /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/dist/MyCNOApp-src/MyCNOApp-Info.plist with 5 changes

[[1;34mINFO[m] Process return code is 0
[[1;34mINFO[m] Executing: 
[[1;34mINFO[m] echo chmod 0755 /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/hooks/fix_xcode_schemes.rb 
[[1;34mINFO[m] Executing with timeout -1
[[1;34mINFO[m] chmod 0755 /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/hooks/fix_xcode_schemes.rb

[[1;34mINFO[m] Process return code is 0
[[1;34mINFO[m] Executing: 
[[1;34mINFO[m] chmod 0755 /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/hooks/fix_xcode_schemes.rb 
[[1;34mINFO[m] Executing with timeout -1
[[1;34mINFO[m] Process return code is 0
[[1;34mINFO[m] Executing: 
[[1;34mINFO[m] echo /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/hooks/fix_xcode_schemes.rb 
[[1;34mINFO[m] Executing with timeout -1
[[1;34mINFO[m] /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/hooks/fix_xcode_schemes.rb

[[1;34mINFO[m] Process return code is 0
[[1;34mINFO[m] Executing: 
[[1;34mINFO[m] /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/hooks/fix_xcode_schemes.rb 
[[1;34mINFO[m] Executing with timeout -1
[[1;34mINFO[m] /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- xcodeproj (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/hooks/fix_xcode_schemes.rb:2:in `<main>'

[[1;34mINFO[m] Process return code is 1
[[1;34mINFO[m] Failed to fix xcode project schemes. Make sure you have Cocoapods installed. 
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;34mINFO[m] [1mReactor Summary for mycnoapp 1.0-SNAPSHOT:[m
[[1;34mINFO[m] 
[[1;34mINFO[m] mycnoapp ........................................... [1;32mSUCCESS[m [ 0.010 s]
[[1;34mINFO[m] mycnoapp-common .................................... [1;32mSUCCESS[m [ 7.675 s]
[[1;34mINFO[m] mycnoapp-ios ....................................... [1;31mFAILURE[m [ 54.198 s]
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;34mINFO[m] [1;31mBUILD FAILURE[m
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;34mINFO[m] Total time: 01:02 min
[[1;34mINFO[m] Finished at: 2023-01-23T16:51:42-05:00
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;31mERROR[m] Failed to execute goal [32mcom.codenameone:codenameone-maven-plugin:7.0.86:build[m [1m(build-ios)[m on project [36mmycnoapp-ios[m: [1;31miOS build failed[m -> [1m[Help 1][m
[1;31morg.apache.maven.lifecycle.LifecycleExecutionException[m: [1;31mFailed to execute goal [32mcom.codenameone:codenameone-maven-plugin:7.0.86:build[m [1m(build-ios)[m on project [36mmycnoapp-ios[m: [1;31miOS build failed[m[m
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 ([1mMojoExecutor.java:375[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.doExecute ([1mMojoExecutor.java:351[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.execute ([1mMojoExecutor.java:215[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.execute ([1mMojoExecutor.java:171[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.execute ([1mMojoExecutor.java:163[m)
[1mat[m org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject ([1mLifecycleModuleBuilder.java:117[m)
[1mat[m org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject ([1mLifecycleModuleBuilder.java:81[m)
[1mat[m org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build ([1mSingleThreadedBuilder.java:56[m)
[1mat[m org.apache.maven.lifecycle.internal.LifecycleStarter.execute ([1mLifecycleStarter.java:128[m)
[1mat[m org.apache.maven.DefaultMaven.doExecute ([1mDefaultMaven.java:294[m)
[1mat[m org.apache.maven.DefaultMaven.doExecute ([1mDefaultMaven.java:192[m)
[1mat[m org.apache.maven.DefaultMaven.execute ([1mDefaultMaven.java:105[m)
[1mat[m org.apache.maven.cli.MavenCli.execute ([1mMavenCli.java:960[m)
[1mat[m org.apache.maven.cli.MavenCli.doMain ([1mMavenCli.java:293[m)
[1mat[m org.apache.maven.cli.MavenCli.main ([1mMavenCli.java:196[m)
[1mat[m jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 ([1mNative Method[m)
[1mat[m jdk.internal.reflect.NativeMethodAccessorImpl.invoke ([1mNativeMethodAccessorImpl.java:62[m)
[1mat[m jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke ([1mDelegatingMethodAccessorImpl.java:43[m)
[1mat[m java.lang.reflect.Method.invoke ([1mMethod.java:566[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced ([1mLauncher.java:282[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.launch ([1mLauncher.java:225[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode ([1mLauncher.java:406[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.main ([1mLauncher.java:347[m)
[1mCaused by[m: org.apache.maven.plugin.MojoExecutionException: [1;31miOS build failed[m
[1mat[m com.codename1.maven.CN1BuildMojo.doIOSLocalBuild ([1mCN1BuildMojo.java:1016[m)
[1mat[m com.codename1.maven.CN1BuildMojo.createAntProject ([1mCN1BuildMojo.java:564[m)
[1mat[m com.codename1.maven.CN1BuildMojo.executeImpl ([1mCN1BuildMojo.java:116[m)
[1mat[m com.codename1.maven.AbstractCN1Mojo.execute ([1mAbstractCN1Mojo.java:195[m)
[1mat[m org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo ([1mDefaultBuildPluginManager.java:137[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 ([1mMojoExecutor.java:370[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.doExecute ([1mMojoExecutor.java:351[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.execute ([1mMojoExecutor.java:215[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.execute ([1mMojoExecutor.java:171[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.execute ([1mMojoExecutor.java:163[m)
[1mat[m org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject ([1mLifecycleModuleBuilder.java:117[m)
[1mat[m org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject ([1mLifecycleModuleBuilder.java:81[m)
[1mat[m org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build ([1mSingleThreadedBuilder.java:56[m)
[1mat[m org.apache.maven.lifecycle.internal.LifecycleStarter.execute ([1mLifecycleStarter.java:128[m)
[1mat[m org.apache.maven.DefaultMaven.doExecute ([1mDefaultMaven.java:294[m)
[1mat[m org.apache.maven.DefaultMaven.doExecute ([1mDefaultMaven.java:192[m)
[1mat[m org.apache.maven.DefaultMaven.execute ([1mDefaultMaven.java:105[m)
[1mat[m org.apache.maven.cli.MavenCli.execute ([1mMavenCli.java:960[m)
[1mat[m org.apache.maven.cli.MavenCli.doMain ([1mMavenCli.java:293[m)
[1mat[m org.apache.maven.cli.MavenCli.main ([1mMavenCli.java:196[m)
[1mat[m jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 ([1mNative Method[m)
[1mat[m jdk.internal.reflect.NativeMethodAccessorImpl.invoke ([1mNativeMethodAccessorImpl.java:62[m)
[1mat[m jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke ([1mDelegatingMethodAccessorImpl.java:43[m)
[1mat[m java.lang.reflect.Method.invoke ([1mMethod.java:566[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced ([1mLauncher.java:282[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.launch ([1mLauncher.java:225[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode ([1mLauncher.java:406[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.main ([1mLauncher.java:347[m)
[[1;31mERROR[m] 
[[1;31mERROR[m] 
[[1;31mERROR[m] For more information about the errors and possible solutions, please read the following articles:
[[1;31mERROR[m] [1m[Help 1][m http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[[1;31mERROR[m] 
[[1;31mERROR[m] After correcting the problems, you can resume the build with the command
[[1;31mERROR[m] [1mmvn <args> -rf :mycnoapp-ios[m

I did "build iOS Xcode Project" in Eclipse on the sample codename one project. The first encountered error says "Failed to execute goal com.codenameone:codenameone-maven-plugin:7.0.86:build (build-ios) on project mycnoapp-ios: iOS build failed".

zUser2020
  • 53
  • 4

1 Answers1

0

You need to install cocoapods e.g. using:

sudo gem install cocoapods

In the command line.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
  • Thanks, Shai. I did "sudo gem install cocoapods" originally but got the same error as in https://stackoverflow.com/questions/20939568/error-error-installing-cocoapods-error-failed-to-build-gem-native-extension, which was recommended by Steve. I used "brew install cocoapods" to install it successfully. If I try to install cocoapods again with brew, the message is "warning: cocoapods 1.11.3_1 is already installed and up-to-date". "which pod" shows "/usr/local/bin/pod". – zUser2020 Jan 24 '23 at 14:17
  • Did you install xcodeproj too as explained [here](https://shannah.github.io/cn1-maven-archetypes/cn1app-archetype-tutorial/getting-started.html#ios-local-builds)? – Shai Almog Jan 25 '23 at 02:49
  • Thanks, Shai. It worked after I did "sudo gem install xcodeproj"! I did "which xcodeproj" and "xcodeproj --version" before running the gem command and saw that xcodeproj was under /usr/local/bin with version 1.22.0. However, the gem install command overwrote existing xcodeproj and also installed several other packages such as atomos, claide, and rexml. Afterwards, the build was completed successfully and an IOS app was shown in xcode simulator. Thank you very much for your help. – zUser2020 Jan 25 '23 at 04:54