rhodes mobile framework

38
Rhodes Ruby to iPhone, Android Native Application Yoshi Sakai / Twitter @bluemooninc

Upload: yoshi-sakai

Post on 03-Jul-2015

779 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Rhodes mobile Framework

Rhodes

Ruby to iPhone, Android Native Application

Yoshi Sakai / Twitter @bluemooninc

Page 2: Rhodes mobile Framework

Rhodes is

• Rhodes makes multiple native application as the iPhone, Android from single code.

• Ruby + HTML MVC Framework

• MIT License

• Rhodes deploy to device with the Xcode and Android SDK,NDK.

Page 3: Rhodes mobile Framework

Install Rhodes

• Open the Gems Folder

– sudo chmod 775 /Library/Ruby/Gems/1.8

• $ gem install rhodes

Page 4: Rhodes mobile Framework

Install homebrew

• $ ruby -e "$(curl -fsSkLraw.github.com/mxcl/homebrew/go)"

• $ sudo chmod 775 /usr/local

• $ sudo chown -R $USER /usr/local/*

• $ brew update

Homebrew is the package system for UNIX Tool on Macintosh. Homebrew is compact and simple than MacPorts.

Page 5: Rhodes mobile Framework

Install gcc

• $ brew tap homebrew/dupes

• $ brew install autoconf automake apple-gcc42

Page 6: Rhodes mobile Framework

Install Xcode

• https://developer.apple.com/devcenter/ios/index.action

Page 7: Rhodes mobile Framework

Additional install on Xcode

• Boot xCode, Click preference. After that Install the iOS Simulator and Command line Tools

Page 8: Rhodes mobile Framework

Install Android SDK/NDK

• Download the android JDK from Apple

– http://support.apple.com/downloads/#java

• Download Android SDK/NDK

– http://developer.android.com/sdk/index.html#download

• Select a 64bit version When you use MoutainLion

– http://support.apple.com/kb/HT3696

Android NDK is Native(C、C++) Development kit

Page 9: Rhodes mobile Framework

Path set for Android SDK

• Open the terminal window and goto home.

• Make a .bash_profile by Editor (vim etc…)

• open .bash_profile is easy to edit on Mac

Page 10: Rhodes mobile Framework

.bash_profile

• .bash_profile-------------------------------------------• export PATH=$PATH:/Users/bluemooninc/android_sdk/sdk/tools

• #Android NDK PATH• ANDROID_NDK=/Users/bluemooninc/android_ndk/toolchains• export PATH=$PATH:${ANDROID_NDK}

• #Android SDK PATH• ANDROID_SDK=/Users/bluemooninc/android_sdk/sdk/platform-

tools• export PATH=$PATH:${ANDROID_SDK}• -------------------------------------------------------------

Page 11: Rhodes mobile Framework

Make sure the path

• $ printenv

• PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/local/rvm/bin:/Users/bluemooninc/android_sdk/sdk/tools:/Users/bluemooninc/android_ndk/toolchains:/Users/bluemooninc/android_sdk/sdk/

• Check the Android SDK/NDK path

• Close terminal or below command to refresh

– $source ~/.bash_profile

Page 12: Rhodes mobile Framework

Set build parameter

• $ rhodes-setup >> build.yml will made

– We will ask you a few questions below about your devenvironment.

– JDK path (required) (/Library/Java/Home): /System/Library/Flameworks/JavaVM.flamework/Home

– Android SDK path (blank to skip) (): /Users/bluemooninc/android_sdk/sdk/

– Android NDK path (blank to skip) (): /Users/bluemooninc/android_ndk/

Page 14: Rhodes mobile Framework

Set UTF-8

• /Library/Ruby/Gems/1.8/gems/highline-1.6.18/lib/highline.rb:621:in `say': undefined method `default_external' for Encoding:Class(NoMethodError)

• default_external to 'UTF-8’

Page 15: Rhodes mobile Framework

Generate a Application

• $ rhodes app storemanager

– >> Ganerate an Application folder and template files.

• $ cd storemanager

– >> move to project folder

• $ rhodes model storemanager name

– >> Ganarate a scaffold for MVC framework

Page 16: Rhodes mobile Framework

Run the Android simulator

• rhodes/platform/android/build/androidcommon.rb

– Add "_64” to androidcommon.rb When you drive 64 bit as the Android NDK

– $ndkhost = `uname -s`.downcase!.chomp! + "-x86_64”

• $ rake run:android:rhosimulator

– >> Quick simulate for debug

Page 17: Rhodes mobile Framework

1 bug fix

• As the 3.5.1.12 has one bug(Already fixed at github)– There is a bug in build script that causes this error.

It is already fixed at master. You may fix it yourself in your rhodes.Open /var/lib/gems/1.9.1/gems/rhodes-3.5.1.12/platform/android/build/android_tools.rb

– At line 211 And make this line to look as Class name

– FileUtils.rm_f $applog_path if !$applog_path.nil?

Page 18: Rhodes mobile Framework

Prepare the Android Virtual Device

• Boot eclipse on android_sdk, Select AVM manager on Window menu

Page 19: Rhodes mobile Framework

Change build.yml

• build.yml for AVD ---------------------------------

• android:

• minSDK: 11

• version: 4.0.3

• emulator: galaxyS2

• android_title: 0

• orientation: portrait

• --------------------------------------------------------

Page 20: Rhodes mobile Framework

Run the Emulator

• $ adb start-server >> Start the adb server

• rake run:android:rhosimulator >>Quick debug

• $ rake run:android >> Deploy to the emulater

Page 21: Rhodes mobile Framework

Make the iOS Development

• Edit build.yml --------------------------------

• iphone:

• configuration: Debug

• sdk: iphonesimulator6.1

• provisionprofile:

• codesignidentity: "iPhone Developer"

• -------------------------------------------------------

Page 22: Rhodes mobile Framework

Run the simulator

• rake run:iphone:rhosimulator >> Quick debug

• rake run:iPhone >> Deploy to iOS simulator

Page 23: Rhodes mobile Framework

Deploy to Android Device

• $ CD $home >> move to home directory

• open .android/adb_usb.ini

• Connect USB your device and Check the Manufacture ID by the system profiler on your Macintosh

Page 24: Rhodes mobile Framework

Example of Galaxy SII

• Manufacturer ID for Samsung

• 0x04e8

Page 25: Rhodes mobile Framework

Check Device and Build

• Cd ~/android_sdk/sdk/platform-tools/• android update adb• adb devices

List of devices attached4*************c device >> You will see your Android device serial number

• Goto project folder and build it.rake run:android:deviceIf you’ve get the error: device not found, Then Try it below ex.

• /Users/bluemooninc/android_sdk/sdk/platform-tools/adb -d install -r /Users/bluemooninc/RhodesProject/storemanager/bin/target/android/storemanager-debug.apk

Success mean finish

Page 26: Rhodes mobile Framework

Deploy to iPhone Device

• Edit build.yml---------------------------------

• iphone:

• configuration: Release

• sdk: iphoneos6.1

• provisionprofile:

• codesignidentity: "iPhone Developer"

• entitlements: ""

• BundleIdentifier: com.xoopsec.ios.* >> from iOS developper

• BundleURLScheme: StoreManager001 >> from iOS developper

Page 27: Rhodes mobile Framework

Generate a iPhone package

• $ rake device:iphone:production

– Will ganarate iOS folder below ex.RhodesProject/bin/target/iOS/iPhoneos6.1/Release/storemanager.app

Page 28: Rhodes mobile Framework

Build the Xcodeprj

• $ rake switch_app

• $ rake build:iphone:setup_xcode_project

Library/Ruby/Gems/1.8/gems/rhodes-3.5.1.12/platform/iphone/rhorunner.xcodeproj

Page 29: Rhodes mobile Framework

Deploy to Real device

• Double click to Library/Ruby/Gems/1.8/gems/rhodes-3.5.1.12/platform/iphone/rhorunner.xcodeproj

• Connect iPhone to USB and Click Run

• After pages are Apple Developer registration

Page 30: Rhodes mobile Framework

[email protected]

https://developer.apple.com

Page 31: Rhodes mobile Framework

Make a certification data

• Boot key chain from utility folder and select Assistant• Keep blank a CA email address,Save to disk, set the key pear info.• Input (2048bit, RSA to key pear parameter)• CertificateSigningRequest.certSigningRequest will save on your disk

Page 32: Rhodes mobile Framework

Entry your CertificationSelect

Certification. After while you will get a email

for Approve.

Page 33: Rhodes mobile Framework

Install the certification on your Mac

• Double click the downloaded developer_identity.cer file from Apple

Page 34: Rhodes mobile Framework

Entry the iOS device info

• Connect your iOS device on your Mac

• Boot Xcode, Click device at Window Organizer

Copy this 40th strings

Page 35: Rhodes mobile Framework

Entry the Identifier to Developer

Page 36: Rhodes mobile Framework

Get the AppID

• Wildcard App ID: opsit the domain name for unique name

• App ID Name: as you like.

ex)com.xoopsec.ios.*

App name etc.

Page 37: Rhodes mobile Framework

Entry the Provisioning Profiles

• Profile Name:As any• Certificates:check• App ID:Choice in this time• Device:Check

Page 38: Rhodes mobile Framework

Set Code Signing Identity

• Open the Xcode project on Rhodes folder• Select Code Signing Identity in Build Setting