How To Write A Cross-Platform Cordova 3.3 App for Android and iOS

CordovaWriting an app in Cordova 3.3 for iOS 7 and Android? This is the article for you.

This article will cover the specifics of…

  • Setting up a Cordova 3.3 development environment for iPhone, iPad and Android application creation
  • Configuring your Bash profile accordingly to interact with Cordova in a happy manner
  • Setting up and installing Cordova plugins which may be useful such as Splash Screen and In App Browser
  • Using Cordova’s CLI tools to install and manage Cordova plugins
  • How to package and distribute your Android and iOS application on TestFlight

If you are the book-reading sort, you can also check out: Apache Cordova 3 Programming (Mobile Programming).

You can also read more here: http://iphonedevlog.wordpress.com/2013/12/19/using-phonegap-3-3-cli-on-mac-os-x-mavericks-to-build-ios-projects/.

[Read more…]

“Error could not access the package manager. Is the system running android studio?”

“Error could not access the package manager. Is the system running android studio?”

If you are getting this with Android Studio, you need to unlock your simulator (assuming it is running) by sliding the lock on the lock screen like it was a real phone.

Android Studio can’t connect to your simulator if it is in the locked state.

Exporting An Android Project From Eclipse Into Android Studio 0.4.0

packing

The Eclipse IDE. Remember the good times? So few, so…far between. The time has come to get comfortable with Android Studio, this guide will show you how to pack your bags and make the transition.

I encountered a number of issues while exporting an existing Eclipse project (containing multiple sub-projects) into Android Studio. I will show you how to avoid these problems and successfully migrate an old Eclipse project to Android Studio using Gradle. My goal is to cover a number of common errors you may encounter when migrating a cranky old Eclipse app to Android Studio.

We will cover the following:

  • Fixing different classes of Gradle error you are likely to encounter
  • Resolving Android manifest merge errors
  • Fixing Gradle version errors
  • Importing multi-project Eclipse projects into Android Studio Modules
  • Exporting / Importing Library projects

This guide covers the process using Gradle 1.9, Eclipse Juno and Android Studio 0.4.0. The Android project had API level 9 – 15.
[Read more…]

Using The Android BOX SDK With Android Studio

This is a guide on how to use Box’s Android SDK in Android Studio. Parts of this guide are derived from ReadMe files provided by Box, the rest is provided to fill in the blanks about how to actually do this.

Step 1: Install Gradle (OSX Mavericks)

We will need Gradle installed to build and install some key dependencies.

  • Download the Gradle 1.6 (NOT THE LATEST GRADLE, IT MUST BE 1.6 ONLY): http://www.gradle.org/downloads
  • Unzip the full directory
  • Move the contents of this directory to: /Users/*****(yourname)/Developer/gradle (or your desired directory)
  • Now run “vi .bashrc”
  • Add the following lines to your .bashrc:
GRADLE_HOME=/Users/*****/Development/gradle
export GRADLE_HOME
export PATH=$PATH:$GRADLE_HOME/bin

Step 2: Download & Build The Box Java SDK

Before you can use the Box Android SDK in Android Studio you must install the Box Java SDK V2.

Step 3: Install Maven

We must also install the Android Support Library for this to work. To do that, we must also install Maven.

  • Simply use Homebrew to get Maven: “brew install maven”
  • “mvn -v” to see if Maven is installed in the Terminal

Step 4: Install The Android Support Library

Next, time to install Android Support Library using Maven.

In my case, I use “~/Applications/Android Studio.app/sdk” because this is where Android Studio installs it’s SDK by default. Here is the Maven command that worked for me (note you must wrap the path in “‘s).

Additional Note: On OSX you have two application’s directories, one at the very root path and the other under your Users folder. The below command must target the appropriate directory where you have Android Studio installed.

mvn install:install-file \
-Dfile="/Applications/Android Studio.app/sdk/extras/android/support/v4/android-support-v4.jar" \
-DgroupId=com.google.android \
-DartifactId=support-v4 \
-Dversion=r13 \
-Dpackaging=jar

This should yield the following message or something like it:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing /Applications/Android Studio.app/sdk/extras/android/support/v4/android-support-v4.jar to /Users/rexstjohn/.m2/repository/com/google/android/support-v4/r13/support-v4-r13.jar
[INFO] Installing /var/folders/49/6kvdjbmx2_55s6mt2vbdl12r0000gn/T/mvninstall6323110116717365831.pom to /Users/rexstjohn/.m2/repository/com/google/android/support-v4/r13/support-v4-r13.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.448s
[INFO] Finished at: Sun Dec 01 14:20:37 PST 2013
[INFO] Final Memory: 3M/81M
[INFO] ------------------------------------------------------------------------

Step 5: Build the BOX SDK

If you haven’t already, download the Box Android SDK (This is a totally separate SDK from the BOX Java SDK we installed earlier, which is also required).

Download, unzip (or use Git to fetch) the BOX Android SDK directory and navigate to the “BoxAndroidLibraryV2” folder using the terminal.

You may need to add a “local.properties” file into the project directory with the following variable: “sdk.dir=/Users/*****/android-sdks/”

Otherwise, set your ANDROID_HOME environmental variable in your .bashrc like so:

ANDROID_HOME=/Applications/Android\ Studio.app/sdk
export ANDROID_HOME
export PATH=$PATH:$ANDROID_HOME

And then “source .bashrc” to make it official.

Now run: “gradle build” while in the BoxAndroidLibraryV2 directory, you should get the following:

...
:processReleaseJavaRes UP-TO-DATE
:packageReleaseJar UP-TO-DATE
:packageReleaseLocalJar UP-TO-DATE
:packageReleaseRenderscript UP-TO-DATE
:packageReleaseResources UP-TO-DATE
:bundleRelease UP-TO-DATE
:assembleRelease UP-TO-DATE
:assemble UP-TO-DATE
:check UP-TO-DATE
:build UP-TO-DATE

BUILD SUCCESSFUL

Total time: 11.583 secs

Finally, add the BoxAndroidLibraryV2 to your Gradle dependencies of your Android project:

dependencies {
	...
	compile project(':box-android-sdk-private:BoxAndroidLibraryV2')
}

Next you will need to build in the Box SDK using a multi-project setup. You can read about how to do that here: http://rexstjohn.com/exporting-android-project-eclipse-android-studio-0-4-0/