AWS Mobile
Developer Guide

Get Started

Choose your platform:

Android - JavaAndroid - KotliniOS - Swift
Android - Java

Get started building a cloud-powered Android app using the AWS Amplify CLI and the AWS SDK for Android. This page guides you through setting up an initial backend and integrating the SDK into your app.

Android - Kotlin

Get started building a cloud-powered Android app using the AWS Amplify CLI and the AWS SDK for Android. This page guides you through setting up an initial backend and integrating the SDK into your app.

iOS - Swift

Get started building a cloud-powered iOS app using the AWS Amplify CLI and the AWS SDK for iOS. This page guides you through setting up an initial backend and integrating the SDK into your app.

Step 1: Set Up Your Development Environment

We strongly recommend that you use the Amplify CLI for building the serverless backend for your app. If you have already installed the CLI, skip ahead to Step 2.

Note

Verify that you are running at least Node.js version 8.x or greater and npm version 5.x or greater by running node -v and npm -v in a terminal/console window. Older versions aren't supported and might generate errors.

To install and configure the Amplify CLI globally, run the following commands in a terminal window.

$ npm install -g @aws-amplify/cli $ amplify configure

Minimum requirements for your development environment are as follows.

Android - JavaAndroid - KotliniOS - Swift
Android - Java
  • Choose the Android Java app project you want to integrate with an AWS backend.

  • Install Android Studio version 2.33 or higher.

  • Install Android SDK for API level 23 (Android SDK 6.0).

Android - Kotlin
  • Choose the Android Kotlin app project you want to integrate with an AWS backend.

  • Install Android Studio version 2.33 or higher.

  • Install Android SDK for API level 23 (Android SDK 6.0).

iOS - Swift
  • Choose the iOS app project you want to integrate with an AWS backend.

  • Install Xcode version 8.0 or later.

Step 2: Set Up Your Backend

  1. The CLI prompts you for configuration parameters.

    Android - JavaAndroid - KotliniOS - Swift
    Android - Java

    In a terminal window, navigate to your project folder (the folder that typically contains your project level build.gradle), and add the SDK to your app.

    $ cd ./YOUR_PROJECT_FOLDER $ amplify init
    Android - Kotlin

    In a terminal window, navigate to your project folder (the folder that typically contains your project level build.gradle), and add the SDK to your app.

    $ cd ./YOUR_PROJECT_FOLDER $ amplify init
    iOS - Swift

    In a terminal window, navigate to your project folder (the folder that typically contains your project level xcodeproj file), and add the SDK to your app.

    $ cd ./YOUR_PROJECT_FOLDER $ amplify init
  2. To create your backend AWS resources and add a configuration file to your app, run the following:

    Android - JavaAndroid - KotliniOS - Swift
    Android - Java
    $ amplify push
    Android - Kotlin
    $ amplify push
    iOS - Swift
    $ amplify push

    In the Finder, navigate to the folder containing your app .xcodeproj file. From there, drag awsconfiguration.json to Xcode under the top Project Navigator folder (the folder name should match your Xcode project name). In the Options dialog box that appears, do the following:

    • Clear the Copy items if needed check box.

    • Choose Create groups, and then choose Next.

  3. To verify that the CLI is set up for your app, run the following command. The CLI displays a status table with no resources listed. As you add categories to your app, backend resources created for your app are listed in this table.

    $ amplify status | Category | Resource name | Operation | Provider plugin | | -------- | ------------- | --------- | --------------- |

    Use the steps in the next section to configure the connection between your app and the serverless backend.

Step 3: Connect to Your Backend

Perform the following steps to set up a connection to AWS services that you'll use in the Get Started section of this guide.

Android - JavaAndroid - KotliniOS - Swift
Android - Java
  1. Add dependencies to your app/build.gradle, and then choose Sync Now on the upper-right side of Android Studio. These libraries enable basic AWS functions, like credentials and analytics.

    dependencies { implementation 'com.amazonaws:aws-android-sdk-core:2.7.+' }
  2. Your AndroidManifest.xml must contain the following:

    <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Your app is now ready for you to add cloud-powered features. We recommend adding analytics as your first feature.

Android - Kotlin
  1. Add dependencies to your app/build.gradle, and then choose Sync Now on the upper-right side of Android Studio. These libraries enable basic AWS functions, like credentials and analytics.

    dependencies { implementation 'com.amazonaws:aws-android-sdk-core:2.7.+' }
  2. Your AndroidManifest.xml must contain the following:

    <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Your app is now ready for you to add cloud-powered features. We recommend adding analytics as your first feature.

iOS - Swift
  1. Install Cocoapods. From a terminal window run the following:

    sudo gem install cocoapods
  2. Create Podfile. From a terminal window, navigate to the directory that contains your project's .xcodeproj file and run the following:

    pod init
  3. Open Podfile in a text editor and add the pod for core AWS Mobile SDK components to your build.

    platform :ios, '9.0' target :'YOUR-APP-NAME' do use_frameworks! pod 'AWSCore', '~> 2.6.13' # other pods end
  4. Install dependencies by running the following:

    pod install --repo-update

    If you encounter an error message that begins "[!] Failed to connect to GitHub to update the CocoaPods/Specs . . .", and your internet connectivity is working, you might need to update openssl and Ruby.

  5. The command pod install creates a new workspace file. Close your Xcode project and reopen it using ./YOUR-PROJECT-NAME.xcworkspace.

    Use ONLY your .xcworkspace

    Remember to always use ./YOUR-PROJECT-NAME.xcworkspace to open your Xcode project from now on.

  6. Rebuild your app after reopening it in the workspace to resolve APIs from new libraries called in your code. This is a good practice any time you add import statements.

Your app is now ready for you to add cloud-powered features. We recommend adding analytics as your first feature.

Next Steps