https://kotlinlang.org logo
#compose-ios
Title
# compose-ios
m

Meherdatta Chepuri

03/10/2023, 4:43 AM
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

Alexander Maryanovsky

03/10/2023, 6:49 AM
@Dima Avdeev Can you help?
d

Dima Avdeev

03/10/2023, 7:12 AM
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

Landry Norris

03/10/2023, 1:05 PM
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

Meherdatta Chepuri

03/10/2023, 5:07 PM
Thank you I was able to run using cocoapods. Is that the recommended approach?
d

Dima Avdeev

03/10/2023, 5:07 PM
yes
m

Meherdatta Chepuri

03/10/2023, 5:08 PM
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

Landry Norris

03/10/2023, 5:11 PM
You may need to pod install
m

Meherdatta Chepuri

03/10/2023, 5:12 PM
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

Pablichjenkov

03/10/2023, 7:55 PM
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

Meherdatta Chepuri

03/10/2023, 7:56 PM
Its an empty shared folder with the default greeting and platform files
p

Pablichjenkov

03/10/2023, 8:05 PM
Ah ok, then disregard that possibility
m

Meherdatta Chepuri

03/10/2023, 8:05 PM
Note that it runs locally but fails on build machine.
l

Landry Norris

03/10/2023, 8:20 PM
Did you gitignore the gradlew file?
m

Meherdatta Chepuri

03/10/2023, 8:26 PM
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

Landry Norris

03/10/2023, 8:31 PM
I don't know a full list, but I can vouch for github actions and CodeMagic.
m

Meherdatta Chepuri

03/10/2023, 9:05 PM
CI spins up a new VM for running unit test cases. Should we run any gradle commands first ?
l

Landry Norris

03/10/2023, 9:37 PM
Is there a good way for you to ssh into the CI machine? Sometimes, the cocoapods gradle plugin creates a placeholder framework.
m

Meherdatta Chepuri

03/10/2023, 9:38 PM
yeah I can SSH
l

Landry Norris

03/10/2023, 9:38 PM
Check the contents of build/cocoapods after it's done building. See if you see placeholder.h in the Header folder.
m

Meherdatta Chepuri

03/10/2023, 10:02 PM
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

Landry Norris

03/10/2023, 10:21 PM
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

Meherdatta Chepuri

03/10/2023, 10:35 PM
I dont see placeholder.h, I only see shared.h
Does that mean its working?
l

Landry Norris

03/10/2023, 11:27 PM
That means the framework is generated properly. XCode should be able to see it now if the Podfile is set up right.
m

Meherdatta Chepuri

03/10/2023, 11:31 PM
Yeah its working fine on xcode no issues. Build agent also showed shared.h Fails with message cannot find shared
l

Landry Norris

03/10/2023, 11:32 PM
Runtime or buildtime error?
m

Meherdatta Chepuri

03/10/2023, 11:32 PM
Na. No files in shared just the greeting file
Does java version matter?
I have 11.0.7 downloaded from oracle
151 Views