Wednesday, 31 October 2012

Blackberry Development Mac

Blackberry Eclipse tutorial for Mac

Introduction

In my opinion, RIM makes it harder than it needs to be to develop Blackberry apps on a Mac. (Despite the tools being written in Java). However it is possible, and once your environment is setup correctly, does get a little easier..

The first thing that differs from the Windows setup, is that you need an actual Blackberry device. No Simulators are available for Mac unfortunately. (I managed to bag a pretty cheap, Blackberry Curve 8520 from eBay for around £50, and can be put back on eBay to get most of cost back afterwards if you find it's not your cup of tea)

N.B Blackberry App World only accepts BB OS 4.5 or greater. Devices seem to be locked into the OS they are manufactured with, so bear that in mind when purchasing a device that's used for development.

Blackberry Eclipse Setup

I'll be using the Blackberry Eclipse Plugin that can be downloaded from the Blackberry site here: Blackberry Eclipse 7.1 Mac

You will also need the Blackberry Desktop Software, again downloadable from the Blackberry site here also (optional, but useful):
Blackberry Desktop Software Mac

After downloading the latest version, 7,1 and installing, you should be presented with the standard Eclipse welcome tab.

Blackberry Eclipse tutorial for Mac

Close 'Welcome' tab Window->Open Perspective->Blackberry Application Development

Blackberry Eclipse tutorial for Mac

File -> New -> BlackBerry Project

Blackberry Eclipse tutorial for Mac

Blackberry project setup with default source code.

Blackberry Eclipse tutorial for Mac

Setup JRE for Device

The latest version of Blackberry Eclipse comes with BB JRE version 7.1. Unless your device is brand new, it's likely to have an older version installed, and wont be able to run with 7.1

My device, a Blackberry Curve 8520 comes with version 5.0, so this is the JRE version I need also.

Help -> Instal new Software

In the 'work with' field (drop down) ad the following url:
http://www.blackberry.com/go/eclipseUpdate/mac/java

Blackberry Eclipse tutorial for Mac

A list of the available JRE's will be displayed, select the version suitable for your device.

Once the JRE's have been installed you can go back to the main project, right click and then select properties.

From properties, select 'Java Build Path'. Then in the 'Libraries' tab, click 'Add Library'

Blackberry Eclipse tutorial for Mac
Add 'JRE System Library' and the 'Alternate JRE', select the one you want, in my case Blackberry JRE5.0.0

Once the new JRE has been added, remove the 7.1 one, and we're set to debug on the actual device.

Running on the device

At this stage make sure your Blackberry device is plugged in using the USB cable, and that the 'Blackberry Desktop Software ISN'T running'

Back to package explorer, right click on the project, and then Debug - > Blackberry Device

Blackberry Eclipse tutorial for Mac

Ignore any errors or warning that pop up. Also an info popup telling you that it want's to download 'Debug' files will appear, just agree to this and continue. (No need to create debug files from the Windows version as the official RIM documentation/website tells you.) Looks like they've improved the Mac version without updating the docs.

Blackberry Eclipse tutorial for Mac

A bit more compiling will occur, the Blackberry device will light up, and either the app will start automatically, or will have created an executable in the 'downloads' folder on the device. That's it, a fully functional Blackberry App (Wont actually appear to do much however) running on your device.

0 comments:

Post a Comment

Twitter Facebook Pinterest YouTube