SlideShare uma empresa Scribd logo
1 de 59
Baixar para ler offline
Making friends with robots
1
Agenda
• Building hello-world for Android
• Building Fiber2D project for Android
• Swift + Java = <3
• Overview
2
Hello world
• Linux environment
• Ubuntu 15.10 is the only officially supported
• 16.04 is used in Fiber2D
• NDK (r13 and later)
• Android API Version 21+
• Android device (meh…) with remote debugging
Prerequisites
3
Main header
• Installing curl, autoconf, automake, libtool,
git + CMake (!)
• Getting Android NDK r13b (and later)
• Getting SwiftAndroid/libiconv-libicu-android
Building dependencies
4
Hello world
Building Swift compiler
$ utils/build-script -R 
--android 
--android-ndk $ANDROID_NDK_HOME 
--android-api-level 21 
--android-icu-uc $ANDROID_LIBICONV/armeabi-v7a 
--android-icu-uc-include $ANDROID_LIBICONV/armeabi-v7a/icu/source/common 
--android-icu-i18n $ANDROID_LIBICONV/armeabi-v7a 
--android-icu-i18n-include $ANDROID_LIBICONV/armeabi-v7a/icu/source/i18n/
Export $ANDROID_NDK_HOME and $ANDROID_LIBICONV
5
Hello world
Before building the executable
sudo ln -s 
$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-
androideabi/bin/ld.gold 
/usr/bin/armv7-none-linux-androideabi-ld.gold
Let Swift compiler find the correct linker (gold)
From docs:
Also needed:
sudo ln -s 
$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-
androideabi/bin/ld.gold 
/usr/bin/armv7-none-linux-android-ld.gold
6
Hello world
Notes: compiler flags
7
• -l[foo] : Link to libfoo[.so][.dylib]

XCode: Other Link Flags
• -L[/path/foo] : Search path for linked libraries

XCode: Library Search Paths
• -I[/path/foo] : Search path for headers (C/C++)
or .swiftmodule (Swift)

XCode: Header Search Paths/Import Paths
• -D[FLAG] : Preprocessor flag (#if FLAG)

XCode: Preprocessor macros
Hello world
Building the executable
$ build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swiftc 
-target armv7-none-linux-androideabi 
-sdk $ANDROID_NDK_HOME/platforms/android-21/arch-arm 
-L $ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a 
-L $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/
linux-x86_64/lib/gcc/arm-linux-androideabi/4.9 
hello.swift
8
Hello world
Deploying the executable
Standalone Swift executable requires this to run:
• libswiftCore.so
• libswiftGlibc.so
• libswiftRemoteMirror.so
• libswiftSwiftOnoneSupport.so
and this:
• libc++_shared.so
finally, push the executable:
adb push hello /data/local/tmp
9
adb shell LD_LIBRARY_PATH=/data/local/tmp 
/data/local/tmp/hello
Hello world
10
Compiling Fiber2D
11
Compiling Fiber2D
The goal
• Swift Package Manager at the heart of build process
• Compile Fiber2D framework
• Use it in the real world (.apk) Android application
13
Compiling Fiber2D
Project structure
Fiber2D
Cpng CChipmunk2D
SwiftMath
SwiftBGFX
Cbgfx
bgfx
14
Compiling Fiber2D
Project structure
Fiber2D
Cpng CChipmunk2D
SwiftMath
SwiftBGFX
Cbgfx
bgfx
Legend:
• C++
• C
• Swift
15
Compiling Fiber2D
SwiftPM limitations
• Does not allow mixing languages within one target
• No Bridging-Headers
• No custom source code layouts
• No custom local config (-l/-L/-I/-D flags)
• No custom scripts/makefiles
16
Compiling Fiber2D
Notes: module maps
module CChipmunk2D {
header "chipmunk_private.h"
header "chipmunk.h"
header "cpHastySpace.h"
link "CChipmunk2D"
export *
}
17
Compiling Fiber2D
NDK
• Android apps are Java-based
• Android NDK lets you implement parts of your app using
native-code languages such as C and C++
• Java to C calls are handled by Java Native Interface (JNI)
public class MyActivity extends Activity {
  /**
  * Native method implemented in C/C++
  */
  public native void computeFoo();
}
18
Compiling Fiber2D
NDK
• NDK project must contain jni folder at its root
• ndk-build command recursively traverses it and
compiles every Android.mk it can find
• Compiled binaries are stored in libs/<ARCH> folders
19
Compiling Fiber2D
SDL
• SDL - low-level abstraction layer for audio, keyboard,
mouse, joystick, and graphics hardware
• Provides Android template project with JNI shim
• Wants you to add your C/C++ files to its main lib’s
Android.mk:
# Add your application source files here...
LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.c
20
Compiling Fiber2D
What SDL does not tell us?
#define main SDL_main
// And then
extern C_LINKAGE int SDL_main(int argc,
char *argv[]);
• SDL secretly redefines main function with its own
macro on certain platforms:
• We can’t use it in Swift
21
Compiling Fiber2D
What we want to do?
• Compile SDL and boilerplate code only once
• Compile our project as dynamic library
• Put it into Android project
• Load it during the runtime
• Make SDL call our SDL_main implementation
22
Compiling Fiber2D
Notes: Swift name mangling
23
class Shape {
func numberOfSides() -> Int {
return 5
}
}
_TFC9swifttest5Shape17simpleDescriptionfS0_FT_Si
JFYI: You can use swift-demangle
Compiling Fiber2D
Implementing SDL_main
• Make sure you don’t have main.swift
• Use @_silgen_name or @_cdecl attributes to overcome
Swift symbol mangling
@_cdecl("SDL_main")
public func SDL_main(argc: Int32, argv: OpaquePointer) -> Int32 {
…
}
• Function must be top-level, public and can’t throw
24
Compiling Fiber2D
Creating the build script
• To build SwiftPM package you do swift build
• swift != swiftc
• Use -Xlinker, -Xcc and -Xswiftc to forward flags
• Declarations with spaces requires multiple -X* flags, i.e.:

-Xlinker -framework -Xlinker AppKit
25
Compiling Fiber2D
Creating the build script
First, add flags that we used to build hello-world:
-Xswiftc -target -Xswiftc armv7-none-linux-androideabi 
-Xswiftc -sdk -Xswiftc $ANDROID_NDK_HOME/platforms/android-21/arch-arm 
-Xlinker -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a 
-Xlinker -L$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-
x86_64/lib/gcc/arm-linux-androideabi/4.9.x/
26
Compiling Fiber2D
Creating the build script
Add Fiber2D include paths:
-Xswiftc -I../../../../.build/debug 
-Xswiftc -I../../../../.build/checkouts/Cpng-8308068493617107876/Cpng/include 
-Xswiftc -I../../../../.build/checkouts/CChipmunk2D--4671306517288557973/CChipmunk2D/include 
-Xswiftc -I../../../../external/SwiftBGFX/.build/debug 
-Xswiftc -I../android-project/jni/SDL2-2.0.5/include 
Android-specific ones:
-Xswiftc -I$ANDROID_NDK_HOME/sources/android/native_app_glue/ 
-Xcc -I$ANDROID_NDK_HOME/platforms/android-21/arch-arm/usr/include 
And some for Foundation:
-Xswiftc -I$ANDROID_SWIFT_SOURCE/build/Ninja-ReleaseAssert/foundation-linux-x86_64/Foundation 
-Xswiftc -I$ANDROID_SWIFT_SOURCE/swift-corelibs-foundation 
-Xswiftc -I$ANDROID_SWIFT_SOURCE/swift-corelibs-foundation/closure 
27
Compiling Fiber2D
Creating the build script
Link to libraries:
-Xlinker -lgcc -Xlinker -lc++ -Xlinker -ldispatch 
-Xlinker -lFoundation -Xlinker -latomic -Xlinker -lFiber2D 
-Xlinker -licui18n -Xlinker -licuuc 
Add library search paths for libDispatch and libFoundation:
-Xlinker -L/usr/local/lib/swift/android/ 
-Xlinker -L$ANDROID_SWIFT_SOURCE/build/Ninja-ReleaseAssert/foundation-linux-x86_64/Foundation/ 
Add library search paths for Android stuff:
-Xlinker -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a 
-Xlinker -L$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/ 
-Xlinker -L$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/lib/armv7-a/ 
-Xlinker -L$ANDROID_LIBICONV/armeabi-v7a 
And for Fiber2D:
-Xlinker -L../../../../.build/debug 
-Xlinker -L../../../../external/SwiftBGFX/.build/debug 
28
Compiling Fiber2D
Creating the build script
Compile libSwiftMath without SIMD:
-Xswiftc -DNOSIMD 
Add cross-compilation flags:
-Xcc -B -Xcc $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-
x86_64/arm-linux-androideabi/bin/ 
-Xcc --sysroot=$ANDROID_NDK_HOME/platforms/android-21/arch-arm/ 
-Xlinker --sysroot=$ANDROID_NDK_HOME/platforms/android-21/arch-arm/
# This does not work for now and requires a hack for clang
29
Compiling Fiber2D
Build script:
cd f2dc
swift build 
-Xswiftc -I$ANDROID_NDK_HOME/sources/android/native_app_glue/ 
-Xcc -I$ANDROID_NDK_HOME/platforms/android-21/arch-arm/usr/include 
-Xswiftc -I../../../../.build/debug 
-Xswiftc -I../../../../.build/checkouts/Cpng-8308068493617107876/Cpng/include 
-Xswiftc -I../../../../.build/checkouts/CChipmunk2D--4671306517288557973/CChipmunk2D/include 
-Xswiftc -I../../../../external/SwiftBGFX/.build/debug 
-Xswiftc -I../android-project/jni/SDL2-2.0.5/include 
-Xswiftc -I$ANDROID_SWIFT_SOURCE/build/Ninja-ReleaseAssert/foundation-linux-x86_64/Foundation 
-Xswiftc -I$ANDROID_SWIFT_SOURCE/swift-corelibs-foundation 
-Xswiftc -I$ANDROID_SWIFT_SOURCE/swift-corelibs-foundation/closure 
-Xswiftc -target -Xswiftc armv7-none-linux-androideabi 
-Xswiftc -sdk -Xswiftc $ANDROID_NDK_HOME/platforms/android-21/arch-arm 
-Xswiftc -DNOSIMD 
-Xcc -target -Xcc armv7-none-linux-androideabi 
-Xcc -B -Xcc $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin/ 
-Xcc --sysroot=$ANDROID_NDK_HOME/platforms/android-21/arch-arm/ 
-Xlinker -L/usr/local/lib/swift/android/ 
-Xlinker -L$ANDROID_SWIFT_SOURCE/build/Ninja-ReleaseAssert/foundation-linux-x86_64/Foundation/ 
-Xlinker -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a 
-Xlinker -L$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/ 
-Xlinker -L$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/lib/armv7-a/ 
-Xlinker -L$ANDROID_LIBICONV/armeabi-v7a 
-Xlinker -L../../../../.build/debug 
-Xlinker -L../../../../external/SwiftBGFX/.build/debug 
-Xlinker -L../android-project/libs/armeabi-v7a 
-Xlinker -lgcc -Xlinker -lc++ -Xlinker -ldispatch 
-Xlinker -lFoundation -Xlinker -latomic -Xlinker -lFiber2D 
-Xlinker -licui18n -Xlinker -licuuc 
-Xlinker --sysroot=$ANDROID_NDK_HOME/platforms/android-21/arch-arm/ # This does not work for now and requires a hack for clang
30
Compiling Fiber2D
clang hack
#!/bin/bash
# This is a proxy hack until it gets fixed in SPM
# You have to add chmod +x to this file
/usr/bin/@clang -target armv7-none-linux-androideabi 
-B $(ANDROID_NDK_HOME)/toolchains/arm-linux-androideabi-4.9/
prebuilt/linux-x86_64/arm-linux-androideabi/bin/ 
—sysroot=$(ANDROID_NDK_HOME)/platforms/android-21/arch-arm/ $*
• Linking C/C++ with Swift is done by clang
• SwiftPM does not pass platform flags for cross-
compilation (-B/—sysroot/-target) to clang during
linkage stage (even when passed via -Xlinker)
• So we had to do a proxy clang script
• mv /usr/bin/clang /usr/bin/@clang
• chmod +x /usr/bin/clang
31
Compiling Fiber2D
Compiling libSDL2 and libmain
• Put freshly compiled libf2dc.so lib to jni/
dependncies
• Add -lf2dc -Ljni/dependencies to main lib’s
Android.mk
• Run ndk-build in the project root
32
Compiling Fiber2D
SDL hack + pure NDK
• As we wanted to use custom renderer we had to hack in
SDL to prevent it from managing the window’s context
• We create CAndroidAppGlue package to wrap pure
NDK API into Swift Module
• It is possible to create pure Swift + Java app
33
Compiling Fiber2D
Putting Swift binaries into .apk
libCbgfx.so
libCChipmunk2D.so
libCpng.so
libcurlll.so
libdispatch.so
libf2dc.so
libFiber2D.so
libFoundation.so
libscudata.so
libscui18n.so
libscuuc.so
libSwiftBGFX.so
libswiftCore.so
libswiftGlibc.so
libswiftRemoteMirror.so
libswiftSwiftOnoneSupport.so
libxml222.so
libc++_shared.so
Copy these libraries to libs/armeabi-v7a:
34
Compiling Fiber2D
Notes: executable file formats
35
• PE (Windows)
• Mach-O (Mac/iOS)
• ELF (Linux/Android)
Contain executable format, architecture type
and program header
Compiling Fiber2D
Notes: executable file formats
36
Compiling Fiber2D
Putting Swift binaries into .apk
Note that Android 5 manages sub-dependencies on
its own, but on Android 4.4 you have to put all libs to
System.load section of SDLActivity.java
protected String[] getLibraries() {
return new String[] {
"SDL2",
"main"
};
}
// Load the .so
public void loadLibraries() {
for (String lib : getLibraries()) {
System.loadLibrary(lib);
}
}
37
Compiling Fiber2D
Deploying the app
• ant debug install
• Run the app from Android launcher
• Use logcat to debug (NSLog() instead of print())
38
Compiling Fiber2D
libicu hack
• Android linker ignores LD_LIBRARY_PATH when
loading with System.loadLibrary()
• Android is shipped with its own outdated version
of libicu
• We have to ship our own libraries
• And hack into compiled binaries…
39
Compiling Fiber2D
libicu hack
• We have to fool Android linker to load our version of
libicu
• Conventional hack: 

rename libi***.so to libs***.so
• Rename binary links as well:

rpl -R -e libicu libscu lib*.so
• Note: keep the strings you change the same length
40
Compiling Fiber2D
libxml/libcurl hack
readelf -d libFoundation.so
41
Compiling Fiber2D
libxml/libcurl hack
readelf -d libFoundation.so
42
Compiling Fiber2D
libxml/libcurl hack
• Android can’t load libraries via symlinks or custom
names
• We have to ship our own versions of libxml and
libcurl
• You can find initial binaries in 

$ANDROID_NDK_HOME/sysroot/src/libxml2/.libs
• Rename: 

libxml2.so.2 to libxml222.so

libcurl.so.5 to libcurlll.so
43
Compiling Fiber2D
Results
44
Compiling Fiber2D
Results
45
Swift + Java = <3
46
Swift + Java
Calling from Java into C
Compile your C code as dynamic library, load it at runtime
System.loadLibrary("fooLib");
Define method with native keyword
public native Int intFromJNI();
Java side:
47
Swift + Java
Calling from Java into C
C side:
JNIEXPORT jint JNICALL
Java_com_example_app_HelloJNI_intFromJNI( JNIEnv* env,
jobject thiz )
• JNI naming rule:



Java_[package_name]_[class_name]_[exported_function_name]
• JNIEnv* is the pointer to the VM, and jobject is a
pointer to the implicit this object passed from the Java
side.
48
Swift + Java
Calling from Java into Swift
• Compile your Swift code as shared object library (.so),
load it at runtime
• Use @_silgen_name or @_cdecl to create JNI
declaration
• Call your top-level public Swift func whatever you want
internally
@_silgen_name(«Java_com_example_app__OurHello_intFromJNI")
public func fooWhatever(env: UnsafeMutablePointer<JNIEnv>,
jobj: jobject,
x: jint, y: jint) -> jint {
return x + y
}
49
Swift + Java
Calling from Swift into Java
Hint: create dummy XCode project
and add «jni.h» to Bridging Header
50
Swift + Java
Calling from Swift into Java
private func foo(env: UnsafeMutablePointer<JNIEnv>, jobj: jobject, value: jint) {
let jni = env.memory.memory
let methodName = "foo"
let methodSignature = "(I)V"
let javaClass = jni.GetObjectClass(env, jobj)
let methodID = jni.GetMethodID(env, javaClass, methodName, methodSignature)
let valueAsJValue = jvalue(i: value)
var methodArgs: [jvalue] = [valueAsJValue]
jni.CallVoidMethodA(env, jobj, methodID, &methodArgs)
}
51
Swift + Java
Decoding calling from Swift into Java
… func foo(env: UnsafeMutablePointer<JNIEnv> …
env is passed by Java.
env JNIEnv JNINativeInterface
let jni = env.memory.memory
52
Swift + Java
Decoding calling from Swift into Java
let methodName = "foo"
let methodSignature = "(I)V"
let javaClass = jni.GetObjectClass(env, jobj)
let methodID = jni.GetMethodID(env, javaClass, methodName, methodSignature)
Next we have to get an object and a method
signature to be called according to Oracle JNI Docs
(I)V means that method receives one Int
argument and returns Void
53
Swift + Java
Decoding calling from Swift into Java
• Actual calling should be done with
Call(ReturnType)MethodA
• All args must be wrapped into jvalue struct
let valueAsJValue = jvalue(i: value)
var methodArgs: [jvalue] = [valueAsJValue]
jni.CallVoidMethodA(env, jobj, methodID, &methodArgs)
54
What’s good
• Code once, run everywhere (really)
• Speed
• Swift itself
55
Try the future today!
Okay, maybe not that exciting…
56
What’s bad not ideal
• App size overhead
• No macOS cross-compiling
• Compilation is not easy
• Native stuff (i.e. In-Apps) is not easy as well
• GPU is bad for dirty-rectangles type of apps
• MIPS, x86 and simulators are not supported yet
• No SIMD/NEON support
• No lldb (yet)
57
That’s it!
58
@s1ddok
@s1ddok
siddok@gmail.com

Mais conteúdo relacionado

Mais procurados

Android OS Porting: Introduction
Android OS Porting: IntroductionAndroid OS Porting: Introduction
Android OS Porting: IntroductionJollen Chen
 
Tsunami of Technologies. Are we prepared?
Tsunami of Technologies. Are we prepared?Tsunami of Technologies. Are we prepared?
Tsunami of Technologies. Are we prepared?msyukor
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UIOpersys inc.
 
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...Igalia
 
The Android graphics path, in depth
The Android graphics path, in depthThe Android graphics path, in depth
The Android graphics path, in depthChris Simmonds
 
Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Opersys inc.
 
Android NDK and the x86 Platform
Android NDK and the x86 PlatformAndroid NDK and the x86 Platform
Android NDK and the x86 PlatformSebastian Mauer
 
Android Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and ResourcesAndroid Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and ResourcesOpersys inc.
 
Run Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using YoctoRun Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using YoctoMarco Cavallini
 
WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...
WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...
WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...Igalia
 
Reaching the multimedia web from embedded platforms with WPEWebkit
Reaching the multimedia web from embedded platforms with WPEWebkitReaching the multimedia web from embedded platforms with WPEWebkit
Reaching the multimedia web from embedded platforms with WPEWebkitIgalia
 
Embedded Recipes 2019 - Remote update adventures with RAUC, Yocto and Barebox
Embedded Recipes 2019 - Remote update adventures with RAUC, Yocto and BareboxEmbedded Recipes 2019 - Remote update adventures with RAUC, Yocto and Barebox
Embedded Recipes 2019 - Remote update adventures with RAUC, Yocto and BareboxAnne Nicolas
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Opersys inc.
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Opersys inc.
 
Headless Android at AnDevCon3
Headless Android at AnDevCon3Headless Android at AnDevCon3
Headless Android at AnDevCon3Opersys inc.
 
KUDO - Kubernetes Operators, the easy way
KUDO - Kubernetes Operators, the easy wayKUDO - Kubernetes Operators, the easy way
KUDO - Kubernetes Operators, the easy wayNick Jones
 
DockerとKubernetesをかけめぐる
DockerとKubernetesをかけめぐるDockerとKubernetesをかけめぐる
DockerとKubernetesをかけめぐるKohei Tokunaga
 
P2P Container Image Distribution on IPFS With containerd and nerdctl
P2P Container Image Distribution on IPFS With containerd and nerdctlP2P Container Image Distribution on IPFS With containerd and nerdctl
P2P Container Image Distribution on IPFS With containerd and nerdctlKohei Tokunaga
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowOpersys inc.
 

Mais procurados (20)

Android OS Porting: Introduction
Android OS Porting: IntroductionAndroid OS Porting: Introduction
Android OS Porting: Introduction
 
Tsunami of Technologies. Are we prepared?
Tsunami of Technologies. Are we prepared?Tsunami of Technologies. Are we prepared?
Tsunami of Technologies. Are we prepared?
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UI
 
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...
 
The Android graphics path, in depth
The Android graphics path, in depthThe Android graphics path, in depth
The Android graphics path, in depth
 
NDK Introduction
NDK IntroductionNDK Introduction
NDK Introduction
 
Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013
 
Android NDK and the x86 Platform
Android NDK and the x86 PlatformAndroid NDK and the x86 Platform
Android NDK and the x86 Platform
 
Android Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and ResourcesAndroid Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and Resources
 
Run Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using YoctoRun Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using Yocto
 
WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...
WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...
WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...
 
Reaching the multimedia web from embedded platforms with WPEWebkit
Reaching the multimedia web from embedded platforms with WPEWebkitReaching the multimedia web from embedded platforms with WPEWebkit
Reaching the multimedia web from embedded platforms with WPEWebkit
 
Embedded Recipes 2019 - Remote update adventures with RAUC, Yocto and Barebox
Embedded Recipes 2019 - Remote update adventures with RAUC, Yocto and BareboxEmbedded Recipes 2019 - Remote update adventures with RAUC, Yocto and Barebox
Embedded Recipes 2019 - Remote update adventures with RAUC, Yocto and Barebox
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013
 
Headless Android at AnDevCon3
Headless Android at AnDevCon3Headless Android at AnDevCon3
Headless Android at AnDevCon3
 
KUDO - Kubernetes Operators, the easy way
KUDO - Kubernetes Operators, the easy wayKUDO - Kubernetes Operators, the easy way
KUDO - Kubernetes Operators, the easy way
 
DockerとKubernetesをかけめぐる
DockerとKubernetesをかけめぐるDockerとKubernetesをかけめぐる
DockerとKubernetesをかけめぐる
 
P2P Container Image Distribution on IPFS With containerd and nerdctl
P2P Container Image Distribution on IPFS With containerd and nerdctlP2P Container Image Distribution on IPFS With containerd and nerdctl
P2P Container Image Distribution on IPFS With containerd and nerdctl
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with Marshmallow
 

Semelhante a Андрей Володин — Как подружиться с роботом

Getting started with the NDK
Getting started with the NDKGetting started with the NDK
Getting started with the NDKKirill Kounik
 
OpenCV 2.2.0 for Android
OpenCV 2.2.0 for AndroidOpenCV 2.2.0 for Android
OpenCV 2.2.0 for AndroidPicker Weng
 
Cross-compilation native sous android
Cross-compilation native sous androidCross-compilation native sous android
Cross-compilation native sous androidThierry Gayet
 
Rhodes mobile Framework
Rhodes mobile FrameworkRhodes mobile Framework
Rhodes mobile FrameworkYoshi Sakai
 
Introduction to the Android NDK
Introduction to the Android NDKIntroduction to the Android NDK
Introduction to the Android NDKSebastian Mauer
 
Android ndk - Introduction
Android ndk  - IntroductionAndroid ndk  - Introduction
Android ndk - IntroductionRakesh Jha
 
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins Mando Stam
 
Droidcon uk2012 androvm
Droidcon uk2012 androvmDroidcon uk2012 androvm
Droidcon uk2012 androvmdfages
 
Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014Paris Android User Group
 
Alternatives to Java for Android development
Alternatives to Java for Android developmentAlternatives to Java for Android development
Alternatives to Java for Android developmentttogrul
 
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaToğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaFarhad
 
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaToğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaFarhad
 
Build and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with dockerBuild and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with dockerQt
 
Container based android
Container based androidContainer based android
Container based androidLihan Chen
 
Begining Android Development
Begining Android DevelopmentBegining Android Development
Begining Android DevelopmentHayi Nukman
 
Alternatives to Java for Android development
Alternatives to Java for Android developmentAlternatives to Java for Android development
Alternatives to Java for Android developmentttogrul
 
Leveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon VLeveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon VOpersys inc.
 

Semelhante a Андрей Володин — Как подружиться с роботом (20)

Getting started with the NDK
Getting started with the NDKGetting started with the NDK
Getting started with the NDK
 
OpenCV 2.2.0 for Android
OpenCV 2.2.0 for AndroidOpenCV 2.2.0 for Android
OpenCV 2.2.0 for Android
 
Android ndk
Android ndkAndroid ndk
Android ndk
 
Android NDK
Android NDKAndroid NDK
Android NDK
 
Cross-compilation native sous android
Cross-compilation native sous androidCross-compilation native sous android
Cross-compilation native sous android
 
Rhodes mobile Framework
Rhodes mobile FrameworkRhodes mobile Framework
Rhodes mobile Framework
 
Introduction to the Android NDK
Introduction to the Android NDKIntroduction to the Android NDK
Introduction to the Android NDK
 
Android ndk - Introduction
Android ndk  - IntroductionAndroid ndk  - Introduction
Android ndk - Introduction
 
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
 
Droidcon uk2012 androvm
Droidcon uk2012 androvmDroidcon uk2012 androvm
Droidcon uk2012 androvm
 
Getting Native with NDK
Getting Native with NDKGetting Native with NDK
Getting Native with NDK
 
Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014
 
Alternatives to Java for Android development
Alternatives to Java for Android developmentAlternatives to Java for Android development
Alternatives to Java for Android development
 
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaToğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
 
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaToğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
 
Build and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with dockerBuild and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with docker
 
Container based android
Container based androidContainer based android
Container based android
 
Begining Android Development
Begining Android DevelopmentBegining Android Development
Begining Android Development
 
Alternatives to Java for Android development
Alternatives to Java for Android developmentAlternatives to Java for Android development
Alternatives to Java for Android development
 
Leveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon VLeveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon V
 

Mais de CocoaHeads

Дмитрий Котенко – Реактивный VIPER
Дмитрий Котенко – Реактивный VIPERДмитрий Котенко – Реактивный VIPER
Дмитрий Котенко – Реактивный VIPERCocoaHeads
 
Александр Зимин – Анимация как средство самовыражения
Александр Зимин – Анимация как средство самовыраженияАлександр Зимин – Анимация как средство самовыражения
Александр Зимин – Анимация как средство самовыраженияCocoaHeads
 
Николай Ашанин – Team Lead. Структурирование мыслей
Николай Ашанин – Team Lead. Структурирование мыслейНиколай Ашанин – Team Lead. Структурирование мыслей
Николай Ашанин – Team Lead. Структурирование мыслейCocoaHeads
 
Кирилл Аверьянов — Кастомная кнопка: взгляд изнутри
Кирилл Аверьянов —  Кастомная кнопка: взгляд изнутриКирилл Аверьянов —  Кастомная кнопка: взгляд изнутри
Кирилл Аверьянов — Кастомная кнопка: взгляд изнутриCocoaHeads
 
Виктор Брыкcин — Как всё починить и ничего не сломать: работа со сложным кодо...
Виктор Брыкcин — Как всё починить и ничего не сломать: работа со сложным кодо...Виктор Брыкcин — Как всё починить и ничего не сломать: работа со сложным кодо...
Виктор Брыкcин — Как всё починить и ничего не сломать: работа со сложным кодо...CocoaHeads
 
Самвел Меджлумян — S3: API на Swift за пять минут
Самвел Меджлумян —  S3: API на Swift за пять минутСамвел Меджлумян —  S3: API на Swift за пять минут
Самвел Меджлумян — S3: API на Swift за пять минутCocoaHeads
 
Александр Зимин (Alexander Zimin) — Магия Swift
Александр Зимин (Alexander Zimin) — Магия SwiftАлександр Зимин (Alexander Zimin) — Магия Swift
Александр Зимин (Alexander Zimin) — Магия SwiftCocoaHeads
 
Катерина Трофименко — Разработка фич: от флагов до a/b-тестов
Катерина Трофименко — Разработка фич: от флагов до a/b-тестовКатерина Трофименко — Разработка фич: от флагов до a/b-тестов
Катерина Трофименко — Разработка фич: от флагов до a/b-тестовCocoaHeads
 
Александр Зимин — Мобильные интерфейсы будущего
Александр Зимин — Мобильные интерфейсы будущегоАлександр Зимин — Мобильные интерфейсы будущего
Александр Зимин — Мобильные интерфейсы будущегоCocoaHeads
 
Николай Волосатов — Работа с крэшами библиотек
Николай Волосатов — Работа с крэшами библиотекНиколай Волосатов — Работа с крэшами библиотек
Николай Волосатов — Работа с крэшами библиотекCocoaHeads
 
Вадим Дробинин (Vadim Drobinin) — Заботимся правильно: CareKit, HealthKit и ...
Вадим Дробинин (Vadim Drobinin) —  Заботимся правильно: CareKit, HealthKit и ...Вадим Дробинин (Vadim Drobinin) —  Заботимся правильно: CareKit, HealthKit и ...
Вадим Дробинин (Vadim Drobinin) — Заботимся правильно: CareKit, HealthKit и ...CocoaHeads
 
Александр Зимин (Alexander Zimin) — UIViewController, откройся!
Александр Зимин (Alexander Zimin) — UIViewController, откройся!Александр Зимин (Alexander Zimin) — UIViewController, откройся!
Александр Зимин (Alexander Zimin) — UIViewController, откройся!CocoaHeads
 
Сергей Пронин, Никита Кошолкин — Как мы разрабатываем App in the Air: процесс...
Сергей Пронин, Никита Кошолкин — Как мы разрабатываем App in the Air: процесс...Сергей Пронин, Никита Кошолкин — Как мы разрабатываем App in the Air: процесс...
Сергей Пронин, Никита Кошолкин — Как мы разрабатываем App in the Air: процесс...CocoaHeads
 
Макс Грибов — Использование SpriteKit в неигровых приложениях
Макс Грибов — Использование SpriteKit в неигровых приложенияхМакс Грибов — Использование SpriteKit в неигровых приложениях
Макс Грибов — Использование SpriteKit в неигровых приложенияхCocoaHeads
 
Михаил Рахманов — Promises, или почему обещания надо выполнять
Михаил Рахманов — Promises, или почему обещания надо выполнятьМихаил Рахманов — Promises, или почему обещания надо выполнять
Михаил Рахманов — Promises, или почему обещания надо выполнятьCocoaHeads
 
Александр Зимин — Оптимизация разработки
Александр Зимин — Оптимизация разработкиАлександр Зимин — Оптимизация разработки
Александр Зимин — Оптимизация разработкиCocoaHeads
 
Алина Михайлова — Как обойтись без менеджера в своем проекте
Алина Михайлова — Как обойтись без менеджера в своем проектеАлина Михайлова — Как обойтись без менеджера в своем проекте
Алина Михайлова — Как обойтись без менеджера в своем проектеCocoaHeads
 

Mais de CocoaHeads (17)

Дмитрий Котенко – Реактивный VIPER
Дмитрий Котенко – Реактивный VIPERДмитрий Котенко – Реактивный VIPER
Дмитрий Котенко – Реактивный VIPER
 
Александр Зимин – Анимация как средство самовыражения
Александр Зимин – Анимация как средство самовыраженияАлександр Зимин – Анимация как средство самовыражения
Александр Зимин – Анимация как средство самовыражения
 
Николай Ашанин – Team Lead. Структурирование мыслей
Николай Ашанин – Team Lead. Структурирование мыслейНиколай Ашанин – Team Lead. Структурирование мыслей
Николай Ашанин – Team Lead. Структурирование мыслей
 
Кирилл Аверьянов — Кастомная кнопка: взгляд изнутри
Кирилл Аверьянов —  Кастомная кнопка: взгляд изнутриКирилл Аверьянов —  Кастомная кнопка: взгляд изнутри
Кирилл Аверьянов — Кастомная кнопка: взгляд изнутри
 
Виктор Брыкcин — Как всё починить и ничего не сломать: работа со сложным кодо...
Виктор Брыкcин — Как всё починить и ничего не сломать: работа со сложным кодо...Виктор Брыкcин — Как всё починить и ничего не сломать: работа со сложным кодо...
Виктор Брыкcин — Как всё починить и ничего не сломать: работа со сложным кодо...
 
Самвел Меджлумян — S3: API на Swift за пять минут
Самвел Меджлумян —  S3: API на Swift за пять минутСамвел Меджлумян —  S3: API на Swift за пять минут
Самвел Меджлумян — S3: API на Swift за пять минут
 
Александр Зимин (Alexander Zimin) — Магия Swift
Александр Зимин (Alexander Zimin) — Магия SwiftАлександр Зимин (Alexander Zimin) — Магия Swift
Александр Зимин (Alexander Zimin) — Магия Swift
 
Катерина Трофименко — Разработка фич: от флагов до a/b-тестов
Катерина Трофименко — Разработка фич: от флагов до a/b-тестовКатерина Трофименко — Разработка фич: от флагов до a/b-тестов
Катерина Трофименко — Разработка фич: от флагов до a/b-тестов
 
Александр Зимин — Мобильные интерфейсы будущего
Александр Зимин — Мобильные интерфейсы будущегоАлександр Зимин — Мобильные интерфейсы будущего
Александр Зимин — Мобильные интерфейсы будущего
 
Николай Волосатов — Работа с крэшами библиотек
Николай Волосатов — Работа с крэшами библиотекНиколай Волосатов — Работа с крэшами библиотек
Николай Волосатов — Работа с крэшами библиотек
 
Вадим Дробинин (Vadim Drobinin) — Заботимся правильно: CareKit, HealthKit и ...
Вадим Дробинин (Vadim Drobinin) —  Заботимся правильно: CareKit, HealthKit и ...Вадим Дробинин (Vadim Drobinin) —  Заботимся правильно: CareKit, HealthKit и ...
Вадим Дробинин (Vadim Drobinin) — Заботимся правильно: CareKit, HealthKit и ...
 
Александр Зимин (Alexander Zimin) — UIViewController, откройся!
Александр Зимин (Alexander Zimin) — UIViewController, откройся!Александр Зимин (Alexander Zimin) — UIViewController, откройся!
Александр Зимин (Alexander Zimin) — UIViewController, откройся!
 
Сергей Пронин, Никита Кошолкин — Как мы разрабатываем App in the Air: процесс...
Сергей Пронин, Никита Кошолкин — Как мы разрабатываем App in the Air: процесс...Сергей Пронин, Никита Кошолкин — Как мы разрабатываем App in the Air: процесс...
Сергей Пронин, Никита Кошолкин — Как мы разрабатываем App in the Air: процесс...
 
Макс Грибов — Использование SpriteKit в неигровых приложениях
Макс Грибов — Использование SpriteKit в неигровых приложенияхМакс Грибов — Использование SpriteKit в неигровых приложениях
Макс Грибов — Использование SpriteKit в неигровых приложениях
 
Михаил Рахманов — Promises, или почему обещания надо выполнять
Михаил Рахманов — Promises, или почему обещания надо выполнятьМихаил Рахманов — Promises, или почему обещания надо выполнять
Михаил Рахманов — Promises, или почему обещания надо выполнять
 
Александр Зимин — Оптимизация разработки
Александр Зимин — Оптимизация разработкиАлександр Зимин — Оптимизация разработки
Александр Зимин — Оптимизация разработки
 
Алина Михайлова — Как обойтись без менеджера в своем проекте
Алина Михайлова — Как обойтись без менеджера в своем проектеАлина Михайлова — Как обойтись без менеджера в своем проекте
Алина Михайлова — Как обойтись без менеджера в своем проекте
 

Último

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 

Último (20)

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 

Андрей Володин — Как подружиться с роботом

  • 2. Agenda • Building hello-world for Android • Building Fiber2D project for Android • Swift + Java = <3 • Overview 2
  • 3. Hello world • Linux environment • Ubuntu 15.10 is the only officially supported • 16.04 is used in Fiber2D • NDK (r13 and later) • Android API Version 21+ • Android device (meh…) with remote debugging Prerequisites 3
  • 4. Main header • Installing curl, autoconf, automake, libtool, git + CMake (!) • Getting Android NDK r13b (and later) • Getting SwiftAndroid/libiconv-libicu-android Building dependencies 4
  • 5. Hello world Building Swift compiler $ utils/build-script -R --android --android-ndk $ANDROID_NDK_HOME --android-api-level 21 --android-icu-uc $ANDROID_LIBICONV/armeabi-v7a --android-icu-uc-include $ANDROID_LIBICONV/armeabi-v7a/icu/source/common --android-icu-i18n $ANDROID_LIBICONV/armeabi-v7a --android-icu-i18n-include $ANDROID_LIBICONV/armeabi-v7a/icu/source/i18n/ Export $ANDROID_NDK_HOME and $ANDROID_LIBICONV 5
  • 6. Hello world Before building the executable sudo ln -s $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux- androideabi/bin/ld.gold /usr/bin/armv7-none-linux-androideabi-ld.gold Let Swift compiler find the correct linker (gold) From docs: Also needed: sudo ln -s $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux- androideabi/bin/ld.gold /usr/bin/armv7-none-linux-android-ld.gold 6
  • 7. Hello world Notes: compiler flags 7 • -l[foo] : Link to libfoo[.so][.dylib]
 XCode: Other Link Flags • -L[/path/foo] : Search path for linked libraries
 XCode: Library Search Paths • -I[/path/foo] : Search path for headers (C/C++) or .swiftmodule (Swift)
 XCode: Header Search Paths/Import Paths • -D[FLAG] : Preprocessor flag (#if FLAG)
 XCode: Preprocessor macros
  • 8. Hello world Building the executable $ build/Ninja-ReleaseAssert/swift-linux-x86_64/bin/swiftc -target armv7-none-linux-androideabi -sdk $ANDROID_NDK_HOME/platforms/android-21/arch-arm -L $ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a -L $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/ linux-x86_64/lib/gcc/arm-linux-androideabi/4.9 hello.swift 8
  • 9. Hello world Deploying the executable Standalone Swift executable requires this to run: • libswiftCore.so • libswiftGlibc.so • libswiftRemoteMirror.so • libswiftSwiftOnoneSupport.so and this: • libc++_shared.so finally, push the executable: adb push hello /data/local/tmp 9
  • 10. adb shell LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/hello Hello world 10
  • 12.
  • 13. Compiling Fiber2D The goal • Swift Package Manager at the heart of build process • Compile Fiber2D framework • Use it in the real world (.apk) Android application 13
  • 14. Compiling Fiber2D Project structure Fiber2D Cpng CChipmunk2D SwiftMath SwiftBGFX Cbgfx bgfx 14
  • 15. Compiling Fiber2D Project structure Fiber2D Cpng CChipmunk2D SwiftMath SwiftBGFX Cbgfx bgfx Legend: • C++ • C • Swift 15
  • 16. Compiling Fiber2D SwiftPM limitations • Does not allow mixing languages within one target • No Bridging-Headers • No custom source code layouts • No custom local config (-l/-L/-I/-D flags) • No custom scripts/makefiles 16
  • 17. Compiling Fiber2D Notes: module maps module CChipmunk2D { header "chipmunk_private.h" header "chipmunk.h" header "cpHastySpace.h" link "CChipmunk2D" export * } 17
  • 18. Compiling Fiber2D NDK • Android apps are Java-based • Android NDK lets you implement parts of your app using native-code languages such as C and C++ • Java to C calls are handled by Java Native Interface (JNI) public class MyActivity extends Activity {   /**   * Native method implemented in C/C++   */   public native void computeFoo(); } 18
  • 19. Compiling Fiber2D NDK • NDK project must contain jni folder at its root • ndk-build command recursively traverses it and compiles every Android.mk it can find • Compiled binaries are stored in libs/<ARCH> folders 19
  • 20. Compiling Fiber2D SDL • SDL - low-level abstraction layer for audio, keyboard, mouse, joystick, and graphics hardware • Provides Android template project with JNI shim • Wants you to add your C/C++ files to its main lib’s Android.mk: # Add your application source files here... LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.c 20
  • 21. Compiling Fiber2D What SDL does not tell us? #define main SDL_main // And then extern C_LINKAGE int SDL_main(int argc, char *argv[]); • SDL secretly redefines main function with its own macro on certain platforms: • We can’t use it in Swift 21
  • 22. Compiling Fiber2D What we want to do? • Compile SDL and boilerplate code only once • Compile our project as dynamic library • Put it into Android project • Load it during the runtime • Make SDL call our SDL_main implementation 22
  • 23. Compiling Fiber2D Notes: Swift name mangling 23 class Shape { func numberOfSides() -> Int { return 5 } } _TFC9swifttest5Shape17simpleDescriptionfS0_FT_Si JFYI: You can use swift-demangle
  • 24. Compiling Fiber2D Implementing SDL_main • Make sure you don’t have main.swift • Use @_silgen_name or @_cdecl attributes to overcome Swift symbol mangling @_cdecl("SDL_main") public func SDL_main(argc: Int32, argv: OpaquePointer) -> Int32 { … } • Function must be top-level, public and can’t throw 24
  • 25. Compiling Fiber2D Creating the build script • To build SwiftPM package you do swift build • swift != swiftc • Use -Xlinker, -Xcc and -Xswiftc to forward flags • Declarations with spaces requires multiple -X* flags, i.e.:
 -Xlinker -framework -Xlinker AppKit 25
  • 26. Compiling Fiber2D Creating the build script First, add flags that we used to build hello-world: -Xswiftc -target -Xswiftc armv7-none-linux-androideabi -Xswiftc -sdk -Xswiftc $ANDROID_NDK_HOME/platforms/android-21/arch-arm -Xlinker -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a -Xlinker -L$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux- x86_64/lib/gcc/arm-linux-androideabi/4.9.x/ 26
  • 27. Compiling Fiber2D Creating the build script Add Fiber2D include paths: -Xswiftc -I../../../../.build/debug -Xswiftc -I../../../../.build/checkouts/Cpng-8308068493617107876/Cpng/include -Xswiftc -I../../../../.build/checkouts/CChipmunk2D--4671306517288557973/CChipmunk2D/include -Xswiftc -I../../../../external/SwiftBGFX/.build/debug -Xswiftc -I../android-project/jni/SDL2-2.0.5/include Android-specific ones: -Xswiftc -I$ANDROID_NDK_HOME/sources/android/native_app_glue/ -Xcc -I$ANDROID_NDK_HOME/platforms/android-21/arch-arm/usr/include And some for Foundation: -Xswiftc -I$ANDROID_SWIFT_SOURCE/build/Ninja-ReleaseAssert/foundation-linux-x86_64/Foundation -Xswiftc -I$ANDROID_SWIFT_SOURCE/swift-corelibs-foundation -Xswiftc -I$ANDROID_SWIFT_SOURCE/swift-corelibs-foundation/closure 27
  • 28. Compiling Fiber2D Creating the build script Link to libraries: -Xlinker -lgcc -Xlinker -lc++ -Xlinker -ldispatch -Xlinker -lFoundation -Xlinker -latomic -Xlinker -lFiber2D -Xlinker -licui18n -Xlinker -licuuc Add library search paths for libDispatch and libFoundation: -Xlinker -L/usr/local/lib/swift/android/ -Xlinker -L$ANDROID_SWIFT_SOURCE/build/Ninja-ReleaseAssert/foundation-linux-x86_64/Foundation/ Add library search paths for Android stuff: -Xlinker -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a -Xlinker -L$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/ -Xlinker -L$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/lib/armv7-a/ -Xlinker -L$ANDROID_LIBICONV/armeabi-v7a And for Fiber2D: -Xlinker -L../../../../.build/debug -Xlinker -L../../../../external/SwiftBGFX/.build/debug 28
  • 29. Compiling Fiber2D Creating the build script Compile libSwiftMath without SIMD: -Xswiftc -DNOSIMD Add cross-compilation flags: -Xcc -B -Xcc $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux- x86_64/arm-linux-androideabi/bin/ -Xcc --sysroot=$ANDROID_NDK_HOME/platforms/android-21/arch-arm/ -Xlinker --sysroot=$ANDROID_NDK_HOME/platforms/android-21/arch-arm/ # This does not work for now and requires a hack for clang 29
  • 30. Compiling Fiber2D Build script: cd f2dc swift build -Xswiftc -I$ANDROID_NDK_HOME/sources/android/native_app_glue/ -Xcc -I$ANDROID_NDK_HOME/platforms/android-21/arch-arm/usr/include -Xswiftc -I../../../../.build/debug -Xswiftc -I../../../../.build/checkouts/Cpng-8308068493617107876/Cpng/include -Xswiftc -I../../../../.build/checkouts/CChipmunk2D--4671306517288557973/CChipmunk2D/include -Xswiftc -I../../../../external/SwiftBGFX/.build/debug -Xswiftc -I../android-project/jni/SDL2-2.0.5/include -Xswiftc -I$ANDROID_SWIFT_SOURCE/build/Ninja-ReleaseAssert/foundation-linux-x86_64/Foundation -Xswiftc -I$ANDROID_SWIFT_SOURCE/swift-corelibs-foundation -Xswiftc -I$ANDROID_SWIFT_SOURCE/swift-corelibs-foundation/closure -Xswiftc -target -Xswiftc armv7-none-linux-androideabi -Xswiftc -sdk -Xswiftc $ANDROID_NDK_HOME/platforms/android-21/arch-arm -Xswiftc -DNOSIMD -Xcc -target -Xcc armv7-none-linux-androideabi -Xcc -B -Xcc $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin/ -Xcc --sysroot=$ANDROID_NDK_HOME/platforms/android-21/arch-arm/ -Xlinker -L/usr/local/lib/swift/android/ -Xlinker -L$ANDROID_SWIFT_SOURCE/build/Ninja-ReleaseAssert/foundation-linux-x86_64/Foundation/ -Xlinker -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a -Xlinker -L$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/ -Xlinker -L$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/lib/armv7-a/ -Xlinker -L$ANDROID_LIBICONV/armeabi-v7a -Xlinker -L../../../../.build/debug -Xlinker -L../../../../external/SwiftBGFX/.build/debug -Xlinker -L../android-project/libs/armeabi-v7a -Xlinker -lgcc -Xlinker -lc++ -Xlinker -ldispatch -Xlinker -lFoundation -Xlinker -latomic -Xlinker -lFiber2D -Xlinker -licui18n -Xlinker -licuuc -Xlinker --sysroot=$ANDROID_NDK_HOME/platforms/android-21/arch-arm/ # This does not work for now and requires a hack for clang 30
  • 31. Compiling Fiber2D clang hack #!/bin/bash # This is a proxy hack until it gets fixed in SPM # You have to add chmod +x to this file /usr/bin/@clang -target armv7-none-linux-androideabi -B $(ANDROID_NDK_HOME)/toolchains/arm-linux-androideabi-4.9/ prebuilt/linux-x86_64/arm-linux-androideabi/bin/ —sysroot=$(ANDROID_NDK_HOME)/platforms/android-21/arch-arm/ $* • Linking C/C++ with Swift is done by clang • SwiftPM does not pass platform flags for cross- compilation (-B/—sysroot/-target) to clang during linkage stage (even when passed via -Xlinker) • So we had to do a proxy clang script • mv /usr/bin/clang /usr/bin/@clang • chmod +x /usr/bin/clang 31
  • 32. Compiling Fiber2D Compiling libSDL2 and libmain • Put freshly compiled libf2dc.so lib to jni/ dependncies • Add -lf2dc -Ljni/dependencies to main lib’s Android.mk • Run ndk-build in the project root 32
  • 33. Compiling Fiber2D SDL hack + pure NDK • As we wanted to use custom renderer we had to hack in SDL to prevent it from managing the window’s context • We create CAndroidAppGlue package to wrap pure NDK API into Swift Module • It is possible to create pure Swift + Java app 33
  • 34. Compiling Fiber2D Putting Swift binaries into .apk libCbgfx.so libCChipmunk2D.so libCpng.so libcurlll.so libdispatch.so libf2dc.so libFiber2D.so libFoundation.so libscudata.so libscui18n.so libscuuc.so libSwiftBGFX.so libswiftCore.so libswiftGlibc.so libswiftRemoteMirror.so libswiftSwiftOnoneSupport.so libxml222.so libc++_shared.so Copy these libraries to libs/armeabi-v7a: 34
  • 35. Compiling Fiber2D Notes: executable file formats 35 • PE (Windows) • Mach-O (Mac/iOS) • ELF (Linux/Android) Contain executable format, architecture type and program header
  • 37. Compiling Fiber2D Putting Swift binaries into .apk Note that Android 5 manages sub-dependencies on its own, but on Android 4.4 you have to put all libs to System.load section of SDLActivity.java protected String[] getLibraries() { return new String[] { "SDL2", "main" }; } // Load the .so public void loadLibraries() { for (String lib : getLibraries()) { System.loadLibrary(lib); } } 37
  • 38. Compiling Fiber2D Deploying the app • ant debug install • Run the app from Android launcher • Use logcat to debug (NSLog() instead of print()) 38
  • 39. Compiling Fiber2D libicu hack • Android linker ignores LD_LIBRARY_PATH when loading with System.loadLibrary() • Android is shipped with its own outdated version of libicu • We have to ship our own libraries • And hack into compiled binaries… 39
  • 40. Compiling Fiber2D libicu hack • We have to fool Android linker to load our version of libicu • Conventional hack: 
 rename libi***.so to libs***.so • Rename binary links as well:
 rpl -R -e libicu libscu lib*.so • Note: keep the strings you change the same length 40
  • 43. Compiling Fiber2D libxml/libcurl hack • Android can’t load libraries via symlinks or custom names • We have to ship our own versions of libxml and libcurl • You can find initial binaries in 
 $ANDROID_NDK_HOME/sysroot/src/libxml2/.libs • Rename: 
 libxml2.so.2 to libxml222.so
 libcurl.so.5 to libcurlll.so 43
  • 46. Swift + Java = <3 46
  • 47. Swift + Java Calling from Java into C Compile your C code as dynamic library, load it at runtime System.loadLibrary("fooLib"); Define method with native keyword public native Int intFromJNI(); Java side: 47
  • 48. Swift + Java Calling from Java into C C side: JNIEXPORT jint JNICALL Java_com_example_app_HelloJNI_intFromJNI( JNIEnv* env, jobject thiz ) • JNI naming rule:
 
 Java_[package_name]_[class_name]_[exported_function_name] • JNIEnv* is the pointer to the VM, and jobject is a pointer to the implicit this object passed from the Java side. 48
  • 49. Swift + Java Calling from Java into Swift • Compile your Swift code as shared object library (.so), load it at runtime • Use @_silgen_name or @_cdecl to create JNI declaration • Call your top-level public Swift func whatever you want internally @_silgen_name(«Java_com_example_app__OurHello_intFromJNI") public func fooWhatever(env: UnsafeMutablePointer<JNIEnv>, jobj: jobject, x: jint, y: jint) -> jint { return x + y } 49
  • 50. Swift + Java Calling from Swift into Java Hint: create dummy XCode project and add «jni.h» to Bridging Header 50
  • 51. Swift + Java Calling from Swift into Java private func foo(env: UnsafeMutablePointer<JNIEnv>, jobj: jobject, value: jint) { let jni = env.memory.memory let methodName = "foo" let methodSignature = "(I)V" let javaClass = jni.GetObjectClass(env, jobj) let methodID = jni.GetMethodID(env, javaClass, methodName, methodSignature) let valueAsJValue = jvalue(i: value) var methodArgs: [jvalue] = [valueAsJValue] jni.CallVoidMethodA(env, jobj, methodID, &methodArgs) } 51
  • 52. Swift + Java Decoding calling from Swift into Java … func foo(env: UnsafeMutablePointer<JNIEnv> … env is passed by Java. env JNIEnv JNINativeInterface let jni = env.memory.memory 52
  • 53. Swift + Java Decoding calling from Swift into Java let methodName = "foo" let methodSignature = "(I)V" let javaClass = jni.GetObjectClass(env, jobj) let methodID = jni.GetMethodID(env, javaClass, methodName, methodSignature) Next we have to get an object and a method signature to be called according to Oracle JNI Docs (I)V means that method receives one Int argument and returns Void 53
  • 54. Swift + Java Decoding calling from Swift into Java • Actual calling should be done with Call(ReturnType)MethodA • All args must be wrapped into jvalue struct let valueAsJValue = jvalue(i: value) var methodArgs: [jvalue] = [valueAsJValue] jni.CallVoidMethodA(env, jobj, methodID, &methodArgs) 54
  • 55. What’s good • Code once, run everywhere (really) • Speed • Swift itself 55
  • 56. Try the future today! Okay, maybe not that exciting… 56
  • 57. What’s bad not ideal • App size overhead • No macOS cross-compiling • Compilation is not easy • Native stuff (i.e. In-Apps) is not easy as well • GPU is bad for dirty-rectangles type of apps • MIPS, x86 and simulators are not supported yet • No SIMD/NEON support • No lldb (yet) 57