Adding to the list of crazy things that happen wit...
# multiplatform
c
Adding to the list of crazy things that happen with KMP:
Copy code
* What went wrong:
An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
  > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
   You can try some of the following options:
    - changing the IDE settings.
    - changing the JAVA_HOME environment variable.
    - changing `org.gradle.java.home` in `gradle.properties`.
Yes, so I actually changed my java system version:
Copy code
11:~ ch$ $JAVA_HOME/bin/java -version
java version "11.0.10" 2021-01-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.10+8-LTS-162)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.10+8-LTS-162, mixed mode)
11:~ ch$
a
Please check:
./gradlew assembleDebug
./gradlew --version
https://www.jetbrains.com/help/idea/switching-boot-jdk.html
c
Going to check asap
Copy code
./gradlew assembleDebug

> Configure project :common
Kotlin Multiplatform Projects are an Alpha feature. See: <https://kotlinlang.org/docs/reference/evolution/components-stability.html>. To hide this message, add 'kotlin.mpp.stability.nowarn=true' to the Gradle properties.


The Kotlin source set androidAndroidTestRelease was configured but not added to any Kotlin compilation. You can add a source set to a target's compilation by connecting it with the compilation's default source set using 'dependsOn'.
See <https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#connecting-source-sets>

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See <https://docs.gradle.org/6.8.2/userguide/command_line_interface.html#sec:command_line_warnings>

BUILD SUCCESSFUL in 13s
55 actionable tasks: 10 executed, 45 up-to-date
Copy code
./gradlew --version

------------------------------------------------------------
Gradle 6.8.2
------------------------------------------------------------

Build time:  2021-02-05 12:53:00 UTC
Revision:   b9bd4a5c6026ac52f690eaf2829ee26563cad426

Kotlin:    1.4.20
Groovy:    2.5.12
Ant:     Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:     11.0.10 (Oracle Corporation 11.0.10+8-LTS-162)
OS:      Mac OS X 10.16 x86_64
a
JVM:     11.0.10 (Oracle Corporation 11.0.10+8-LTS-162)
Gradle is using 11 jvm and can compile the code. What version is IDEA using?
c
Android Studio is working like a charm, all the commands do. But as soon as I try to run it on xcode it breaks and complain that my java version is wrong. I’m exporting a new version of the common and everything
I believe to have found a way to fix this and it’s probably a bigSur issue
Didn’t fixed, setting my java home was not the issue.
Copy code
* Where:
Build file '/Users/ch/kmm-basics/android/build.gradle.kts' line: 1

* What went wrong:
An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
  > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
   You can try some of the following options:
    - changing the IDE settings.
    - changing the JAVA_HOME environment variable.
    - changing `org.gradle.java.home` in `gradle.properties`.
And this output is when Xcode runs:
Copy code
cd "$SRCROOT/.."
$JAVA_HOME/bin/java -version
./gradlew :common:packForXCode -PXCODE_CONFIGURATION=${CONFIGURATION}
Which I didn’t touched yet
Output of this $JAVA_HOME/bin/java -version when run by Xcode:
Copy code
/Users/ch/Library/Developer/Xcode/DerivedData/ios-ggswitxqatyvowbawnqkebqhtgjs/Build/Intermediates.noindex/ios.build/Debug-iphonesimulator/ios.build/Script-7555FFB5242A651A00829871.sh: line 6: /bin/java: No such file or directory
a
Android studio can use ANOTHER jdk. You have to check - https://www.jetbrains.com/help/idea/switching-boot-jdk.html
c
I followed this tutorial and it is already java11 😐
Everything works until I run it with Xcode. I don’t believe that it could be anything with android. What it looks like is that from the path I export while running the script there is no java.
I believe this tells my JDK is the 11 😞
I’m really a little out of options
I installed jenv and set java global/local environment to 11
What worries me is that creating a fresh project works.
I think this is the culprit
As soon as I update gradle to 7 and add this things go bad
And it looks like the people in space Xcode project also doesn’t run
I will solve this but I can’t do it now 😞
Simple solution for now. As Xcode couldn’t run the script without this stupid error and I could run the project on AS and export my common, I just removed the script temporarily.
I’m running: ./gradlew commonpackForXCode -PXCODE_CONFIGURATION=${CONFIGURATION} manually to update my project but I would be very happy to understand how to investigate this if anyone has tips