เป้าหมาย: Android, iOS, เดสก์ท็อป, เว็บ, เซิร์ฟเวอร์
แพลตฟอร์มที่โค้ดเบส Kotlin เดียวสามารถคอมไพล์ไปได้
เป้าหมาย: Android, iOS, เดสก์ท็อป, เว็บ, เซิร์ฟเวอร์ เป็นบทเรียน Kotlin Multiplatform Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Kotlin Multiplatform Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Kotlin Multiplatform Academy มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
What Is a Target
A target is a platform your Kotlin code compiles to. One shared codebase can produce builds for several targets at once. 🎯
The Android Target
Android is the most common starting target. Kotlin compiles to JVM bytecode, the same format Android apps have always used.
The iOS Target
For iOS, Kotlin compiles ahead of time into a native binary using Kotlin/Native, packaged as a framework Swift can call.
The Desktop Target
Desktop apps for Windows, macOS, and Linux run on the JVM too. The same desktop target serves all three operating systems.
The Web Target
Kotlin can target the browser by compiling to JavaScript or to WebAssembly, so shared logic runs on the web as well.
The Server Target
On the backend, Kotlin runs on the JVM server side. You can even share models and validation between your app and your API.
Declaring Targets
You list targets in your Gradle build. Each call like androidTarget adds one platform to the shared module.
kotlin {
androidTarget()
iosArm64()
jvm("desktop")
}Pick Only What You Need
You do not have to ship every target. Most teams start with just Android and iOS and add more targets only when needed.
iOS Has Variants
iOS itself has a few targets: real devices use arm64, while the simulator uses x64 or arm64 depending on your Mac.
Share the Same Source
Every target reads from your common code. That shared source set is compiled fresh for each platform you declared.
One Codebase, Many Outputs
The magic is reach: a single Kotlin codebase becomes an APK, an iOS framework, a desktop app, and more from one build.
Quick Check
Let's confirm what targets are.
Recap
Targets are the platforms you compile to: Android, iOS, desktop, web, and server. Declare only the targets your team actually needs. 🌍
คำถามที่พบบ่อย
บทเรียน “เป้าหมาย: Android, iOS, เดสก์ท็อป, เว็บ, เซิร์ฟเวอร์” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “เป้าหมาย: Android, iOS, เดสก์ท็อป, เว็บ, เซิร์ฟเวอร์” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Kotlin Multiplatform Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Kotlin Multiplatform Academy มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “เป้าหมาย: Android, iOS, เดสก์ท็อป, เว็บ, เซิร์ฟเวอร์”
แพลตฟอร์มที่โค้ดเบส Kotlin เดียวสามารถคอมไพล์ไปได้ คุณปฏิบัติ Kotlin Multiplatform Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Kotlin Multiplatform Academy หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Kotlin Multiplatform Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน
บทเรียน “เป้าหมาย: Android, iOS, เดสก์ท็อป, เว็บ, เซิร์ฟเวอร์” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Kotlin Multiplatform Academy นี้ได้ไหม
ได้ บทเรียน Kotlin Multiplatform Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- แชร์ตรรกะ ไม่ใช่ UI: คำมั่นสัญญาของ KMP
- KMP เทียบกับ Flutter และ React Native
- เป้าหมาย: Android, iOS, เดสก์ท็อป, เว็บ, เซิร์ฟเวอร์
- สิ่งที่แชร์ได้และยังแชร์ไม่ได้