Hello, I keep getting this error in my iOS project...
# compose-ios
m
Hello, I keep getting this error in my iOS project. Can anyone please help me?
Copy code
./gradlew: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
a
@Dima Avdeev Can you help?
d
How are you launching iOS project? Can you please try this template project with following instructions? https://github.com/JetBrains/compose-multiplatform-template#ios
l
Are you on Windows or mac/linux? Windows uses gradlew.bat, but if you're on mac/linux, then your gradlew may be missing. You'd need to install the gradle command line tool and run 'gradle init'
m
Thank you I was able to run using cocoapods. Is that the recommended approach?
d
yes
m
However, I am using Bamboo for CI jobs and running unit test cases on my existing application. If I run locally i was able to build, but bamboo fails to recognize the shared.framework. Should I be adding any setting?
One difference is : My local machine has java 18 where as my CI machine has JAVA 11.0.7.
l
You may need to pod install
m
Yeah on every run, we do a fresh pod install
@Landry Norris Im using mac. Should i still run gradle init? running the command in terminal works just fine though.
p
Can you identify the reasons why shared could not be created, was a compilation error ? Was a symbol linking error. Notice that when you create a framework for iOS your Composable functions have to be
internal
m
Its an empty shared folder with the default greeting and platform files
p
Ah ok, then disregard that possibility
m
Note that it runs locally but fails on build machine.
l
Did you gitignore the gradlew file?
m
gitignore looks like this
Copy code
#Android Studio
*.iml
.gradle
.idea
.DS_Store
build
captures
.externalNativeBuild
.cxx
local.properties

# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData/
Copy code
## Other
*.moved-aside
*.xcuserstate

## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
I have a mac mini as the build machine. I can launch xcode and build it just fine on that. Issue is only with running with bamboo.
Also, What is the recommended CI/CD for KMM?
l
I don't know a full list, but I can vouch for github actions and CodeMagic.
m
CI spins up a new VM for running unit test cases. Should we run any gradle commands first ?
l
Is there a good way for you to ssh into the CI machine? Sometimes, the cocoapods gradle plugin creates a placeholder framework.
m
yeah I can SSH
l
Check the contents of build/cocoapods after it's done building. See if you see placeholder.h in the Header folder.
m
In my local its only framework. Will check in the build machine
Copy code
cocoapods % ls
framework
Ooh wait, i can see placeholder.h in my machine. Now checking local machine
l
If you see placeholder.h, look at the podspec gradle generates and copy the syncFramework command, hardcoding the env vars. This should run before you try to build the iOS app. I don't think it matters which arch you use, since xcode really only wants the header at this point. It'll build the binary later. I usually pass in arm64 and iphoneos, though, to be safe.
m
I dont see placeholder.h, I only see shared.h
Does that mean its working?
l
That means the framework is generated properly. XCode should be able to see it now if the Podfile is set up right.
m
Yeah its working fine on xcode no issues. Build agent also showed shared.h Fails with message cannot find shared
l
Runtime or buildtime error?
m
Na. No files in shared just the greeting file
Does java version matter?
I have 11.0.7 downloaded from oracle
162 Views