KMM: embedAndSignAppleFrameworkForXcode task not found - android-studio

I have created a basic KMM by following "Create your first app" guide
https://kotlinlang.org/docs/kmm-create-first-app.html
Then I've tried to build the framework with the following command from Terminal in Android Studio.
./gradlew :shared:embedAndSignAppleFrameworkForXcode
But I'm getting this error.
Task 'embedAndSignAppleFrameworkForXcode' not found in project ':shared'.
Android Studio 2020.3.1 Patch 3
Kotlin 1.5.31
There's a similar question on SO. People say that embedAndSignAppleFrameworkForXcode should work with Kotlin 1.5.20 at least.
KMM - Error Task 'embedAndSignAppleFrameworkForXcode' not found in project ':shared'
But it doesn't in my setup.
Does anyone know how to fix this?
UPDATE
The task is running perfectly fine when launched form XCode/Build Phases script.
Somehow it is not able to launch from terminal (Android Studio or system one).

I think embedAndSignAppleFrameworkForXcode is not supposed to run from the terminal as packForXCode used be.
The proper way to run this task is from XCode build system.
Anyway, I was able to run embedAndSignAppleFrameworkForXcode from terminal after exporting the following variables.
export CONFIGURATION\=Debug
export ARCHS\=x86_64
export EXPANDED_CODE_SIGN_IDENTITY\=-
export FRAMEWORKS_FOLDER_PATH\=iosApp.app/Frameworks
export SDK_NAME\=iphonesimulator15.0
export TARGET_BUILD_DIR\="../build/ios/${CONFIGURATION}-iphonesimulator"

Related

android studio error - Could not determine the dependencies of task ':app:installDebug'

While running the React Native Android app, then building the project the following error is shown:
Could not determine the dependencies of task ':app:installDebug'.
Go to android folder in your project and then type
gradlew clean for Windows and
./gradlew clean for Mac and Linux. I use this method every time I encounter the same problem, and also when changing the package.json (add / remove library)
Please remove build folder in /android/app and run build command again.
It worked for me.

Run a shell script before a gradle build in Android Studio?

Is it possible to run a unix shell script in Android Studio before every (gradle) build?
I'm having some trouble with gradle builds taking forever and one (admittedly bad) solution that works is to kill all java processes if they hold more than say 6Mb memory.
What I would like to do is run a shell script that does that before every build in Android Studio.
I'm not looking to add a gradle task to run before my build. That won't work because if I kill all java processes, gradle will also be killed.
So again:
Can I set up Android Studio (or gradlew) to run a script before building?
Instruction for Intellij Idea, but I hope it works for Android Studio
Edit configirations...
Select\create run configuration for gradle build. Add "before launch" option
Select ptoper option. For example - "Run external tool"

How do I create a build configuration in Android Studio which executes a console command?

I want to create a build configuration in android studio which runs a console command and nothing else. I also have another android build configuration which I don't want to change.
I've searched on the internet and haven't found any answers as to how an "empty" build configuration could be made.
I found the "Compound" build template, but that doesn't allow me to add "Before launch" configurations.
Is there any way of creating such a build configuration, which just executes a shell/console command?
It's the Bash Run Configuration in Android Studio. Edit the Run/Debug Configurations, press the add (+) button and select Bash:
And then fill in the details similar to below:
Sample output below when selected and run in Android Studio:

Finish can only be called once : Android

Recently updated Build: 2.3.1, AI-162.3871768, 20170401,
AI-162.3871768, JRE 1.8.0_112-release-b06x64 JetBrains s.r.o, OS Mac OS X(x86_64) v10.11.6 unknown, screens 1440x900; Retina
Switching back to Android 2.2.2 did not help either. Successfully able to build from command Line though(MacOX Terminal)
Delete your $HOME/.gradle directory (or on Windows, %HOME%\.gradle folder). The next execution of gradle will rebuild this. (It will require some downloads, so make sure you have an internet connection).
You can try just deleting $HOME/.gradle/caches, but this will not solve the problem in all cases.
I have similar issue on 2.3.1
I tried using the Android 2.4 Preview 4 but that did not help. I am able to build from command line too.
Android-Studio-2.3.1-Gradle-Sync
It happens when Android Studio creates two instances of gradle. I tried clearing the gradle cache or even deleting the .gradle but did not help. All this problem started when I deleted my old project repo and re-pulled it and imported to my Android Studio.
Best is to delete all your gradle instance from your home directly before your re-import your project Android Studio.
Android Studio started behaving like this after I tried building with the command line(osx) using ./gradlew
What helps is running the studio with sudo:
sudo /Applications/Android\ Studio.app/Contents/MacOS/studio
I wonder if theres a fix to this problem that allows the studio to be started normally as well.

Intellij 14 gradle fails to run bower command

I am just starting to play with the JHipster framework / code generator using intellij 14.1.5 on OSX Yosemite. I have a simple app with a couple of domain objects which I have imported into Intellij as a gradle project. When I attempt to run the app via the gradle build "run" task, the build fails on the bower command. I can successfully run this gradle task from the osx terminal app AND from withing Intellij's terminal window. It fails when I invoke the run task from the from the gradle tasks pane or if I run it from the "run configurations" drop down in the toolbar. It feels like it fails when Intellij invokes gradle, but succeeds when gradlew is invoked in a terminal. I'm not sure why there would be a difference in these environments / invocations.
I have installed npm/gulp/bower/yoeman via nvm/node and am up on current versions (installed today). Node is at 4.1.1.
Posting this answer because no one has posted one yet. I have followed the recommendation of this other post. It fixes the Intellij app launcher on the mac to recognize the path for node commands. The original technique is described in apple.stackexchange.com. I am using this technique with the latest Intellij Idea 2016.1.3 and Intellij invoked gradle runs bower / npm just fine.
Just update gradle version.
Open gradle/wrapper/gradle-wrapper.properties
and change version like
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip

Resources