Hello, everyone. Just wondering what people do deb...
# multiplatform
m
Hello, everyone. Just wondering what people do debug:
Copy code
Task 'embedAndSignAppleFrameworkForXcode' not found in project ':shared'.
Adding
--debug
or
--stacktrace
to the task doesn't really help. I usually have to just randomly change things till it starts working. Is there a way to know the specific reason for the task failing. I know for a fact that it's generated when run from
XCode
but that's about it. Any debugging tips? 😅 Thanks in advance. Also. Is the source code available on Github? 🤔
s
The task ist not failing, it doesn't get found.
Sorry that I can't help further - I assume that it is a task of some other module.
m
It's supposed to be autogenerated by the KMP plugin. But it doesn't. I've found no clear solution to this online.
t
it’s added when there are some env variables set by XCode. this will change in the future because it’s really annoying: https://github.com/JetBrains/kotlin/commit/14ee13c72e132daa9da8a67aa1dd07d23e71c67c that should also lead you to what makes it currently get added
g
Anyone found a solution to this in the last few days? A brand new KMM project just doesn’t build in XCode because of this error.
m
@Tijl thanks 🙌🏽
@grahamborland still stuck on this. Debugging is next to impossible 😵
n
I'm seeing the same thing. I've been debugging this for hours, and I have had no luck. Adding --debug doesn't log anything about why the task isn't being registered. @Michael, @grahamborland, are you two using M1 macs by chance?
m
@nschulzke I was using an M1 before. Struggled the error for days. The issue turned out to be to a JDK issue. Changing to the Zulu sdk fixed. Now I'm using an intel mac and the error suddenly appeared again.
n
I just switched to use the Cocoapods integration, and it's now working fine.
m
@nschulzke Let me try that.
g
I couldn’t get the Cocoapods integration to work at all (
pod install
command failed), which is why I went with the Framework option. I’m using an M1 Mac. So far I have completely failed to get anything working for iOS.
n
What was the failure for the
pod install
command?
g
Something along these lines:
Copy code
* What went wrong:
Execution failed for task ':shared:podInstall'.
> 'pod install' command failed with code 1.
  Error message:
  
         Please, check that podfile contains following lines in header:
         source '<https://cdn.cocoapods.org>'
  
          Please, check that each target depended on shared contains following dependencies:
m
@grahamborland cocoapods wasn't working on M1 for me as well. But it had something to with versions mismatch (Xcode etc).
n
Hmm, does running
pod install
from the iOS directory work? I don't use any pods from within
build.gradle.kts
, so I never ran
:shared:podInstall
(which is meant for loading pods specified as gradle dependencies). I ran
:shared:podspec
and then
pod install
from the iOS directory, and now they're linked up correctly.
I did have to specify my deployment target to match my existing iOS project's target:
Copy code
ios.deploymentTarget = "12.1"
g
Running
pod install
in the
iosApp
directory causes this funky failure.
Copy code
graham@grahams2021mbp ~/W/K/iosApp> pod install
Analyzing dependencies
/Library/Ruby/Gems/2.6.0/gems/ethon-0.15.0/lib/ethon/curls/classes.rb:36: [BUG] Illegal instruction at 0x00000001007f0000
ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:                    
     * ~/Library/Logs/DiagnosticReports                                     
     * /Library/Logs/DiagnosticReports                                      
   for more details.                                                        
Don't forget to include the above Crash Report log file in bug reports.
I eventually got the CocoaPods solution up and running by installing
cocoapods
from Homebrew instead of
gem install
. Courtesy of this comment: https://github.com/CocoaPods/CocoaPods/issues/9907#issuecomment-901790027 After doing that, I then quit Android Studio and recreated my KMM project, and it worked. I also had to uncomment the
iosSimulatorArm64Main
lines in the shared
build.gradle.kts
to get the app to build and run on the iOS simulator.