Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
SwiftAndoroidを使ってシミュレータでアプリを動かした話
Search
matuyuji
January 28, 2016
Programming
0
590
SwiftAndoroidを使ってシミュレータでアプリを動かした話
SwiftAndoroidでAPKを作って、それをAndroidシミュレータで動かしてみました。
matuyuji
January 28, 2016
Tweet
Share
More Decks by matuyuji
See All by matuyuji
Emacs × Touch Bar
matuyuji
2
1.7k
ARKit + SceneKitでMinesweeperを作ってみた
matuyuji
1
770
Go + QtでiOS アプリ開発
matuyuji
0
370
@_specialized なお話し
matuyuji
0
470
Xcode Souce Code Extensionを使ってみた
matuyuji
0
340
Codebeatを 試してみた
matuyuji
0
730
React Nativeで UIコンポーネントをつくる
matuyuji
0
980
React Nativeを使ってみた
matuyuji
0
1.3k
SwiftでLens
matuyuji
1
940
Other Decks in Programming
See All in Programming
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
130
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
CSC305 Lecture 25
javiergs
PRO
0
130
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
事業成長を爆速で進めてきたプロダクトエンジニアたちの成功談・失敗談
nealle
3
1.4k
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
180
Go の GC の不得意な部分を克服したい
taiyow
2
760
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
Haze - Real time background blurring
chrisbanes
1
500
テスト自動化失敗から再挑戦しチームにオーナーシップを委譲した話/STAC2024 macho
ma_cho29
1
1.3k
As an Engineers, let's build the CRM system via LINE Official Account 2.0
clonn
1
670
The rollercoaster of releasing an Android, iOS, and macOS app with Kotlin Multiplatform | droidcon Italy
prof18
0
150
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
Speed Design
sergeychernyshev
25
670
Fireside Chat
paigeccino
34
3.1k
Building Adaptive Systems
keathley
38
2.3k
What's in a price? How to price your products and services
michaelherold
243
12k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
A Philosophy of Restraint
colly
203
16k
Documentation Writing (for coders)
carmenintech
66
4.5k
Making the Leap to Tech Lead
cromwellryan
133
9k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
The Pragmatic Product Professional
lauravandoore
32
6.3k
How GitHub (no longer) Works
holman
311
140k
Transcript
4XJGU"OEPSPJEΛͬͯ γϛϡϨʔλͰΞϓϦΛಈ͔ͨ͠ ؔϞόΠϧΞϓϦݚڀձ !NBUVZVKJ
@matuyuji safx-dev.blogspot.jp
4XJGU"OESPJE
None
None
Port of Apple's reference Swift toolchain to Android; doesn't quite
work yet SwiftAndroid / swift forked from apple/swift
https://github.com/SwiftAndroid/swift/wiki/Getting-started
6CVOUV CJU
https://www.vagrantup.com
7BHSBOU
7BHSBOU vagrant init boxcutter/ubuntu1510 vagrant up vagrant ssh
/%,4XJGU"OESPJE curl -LO http://dl.google.com/android/ndk/android-ndk-r10e-linux- x86_64.bin chmod a+x android-ndk-r10e-linux-x86_64.bin ./android-ndk-r10e-linux-x86_64.bin >
/dev/null export ANDROID_NDK_HOME=$HOME/android-ndk-r10e curl -LO https://github.com/SwiftAndroid/swift/releases/download/ swiftandroid-2016-01-06/swift_android_2016-01-06.tar.xz tar xf swift_android_2016-01-06.tar.xz export PATH=$PATH:$HOME/swiftandroid/bin
$PNQJMF $ echo 'print("Hello world!")' > hello.swift $ swiftc-android hello.swift
$ file hello hello: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /system/bin/linker, not stripped
"OESPJE4%, sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get
install -y libncurses5:i386 \ libstdc++6:i386 \ zlib1g:i386 sudo apt-get install -y openjdk-7-jdk curl -LO http://dl.google.com/android/android-sdk_r24.4.1- linux.tgz tar xf android-sdk_r24.4.1-linux.tgz export ANDROID_HOME=$HOME/android-sdk-linux echo y | $ANDROID_HOME/tools/android update sdk \ —-no-ui —-all \ —-filter platform-tools,tools,android-23,build-tools-23.0.2
4XJGU"OESPJE(SBEMF git clone https://github.com/SwiftAndroid/ swift-android-gradle.git cd swift-android-gradle ./gradlew install
4XJGU"OESPJE4BNQMFT git clone https://github.com/SwiftAndroid/ swift-android-samples.git cd swift-android-samples/swifthello ./gradlew build cp
-r build/outputs/apk/ /vagrant
7BHSBOU 1SPWJTJPOJOH
TBGY4XJGU"OESPJE7BHSBOU git clone https://github.com/safx/SwiftAndroid-Vagrant.git cd SwiftAndroid-Vagrant vagrant up ls apk
vagrant halt vagrant destroy
4JNVMBUPS
4JNVMBUFPO.BD curl -LO http://dl.google.com/android/android-sdk_r24.3.4- macosx.zip unzip android-sdk_r24.3.4-macosx.zip cd android-sdk-macosx echo
y | ./tools/android update sdk -a --no-ui —-filter \ android-23,sys-img-armeabi-v7a-android-23,platform-tools ./tools/android list targets ./tools/android create avd -n my_android23 -t 1 ./tools/emulator -avd my_android23 ./platform-tools/adb install swifthello-debug.apk
None
None
4PVSDFT
NBJOTXJGU @_silgen_name("Java_net_zhuoweizhang_swifthello_SwiftHello_return42") public func return42() -> Int { return 42
}
4XJGU)FMMPKBWB public class SwiftHello extends Activity { @Override protected void
onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); loadNativeDependencies(); TextView myText = (TextView) findViewById(R.id.mytext); myText.setText("Result of swift return42() function is " + return42()); } private static void loadNativeDependencies() { System.loadLibrary("c++_shared"); System.loadLibrary("icudata"); System.loadLibrary("icui18n"); System.loadLibrary("icuuc"); // Swift System.loadLibrary("swiftCore"); System.loadLibrary("swiftGlibc"); // Our library System.loadLibrary("swifthello"); } public static native int return42(); }