---
# System prepended metadata

title: DragonCloud(Abc123) App Setup -MacOS
tags: [Dragon Cloud AI]

---

# DragonCloud(Abc123) App Setup -MacOS


###### tags: `Dragon Cloud AI`

## Requirements
**Install Node.js, Watchman, and React Native.**

```
brew install node
brew install watchman
npm install -g react-native-cli
```

## AWS - Pre-Installation

**To install for all users using the macOS command line**
Install the AWS CLI version 2 for all users on the computer.
```
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /
```

**Confirming the installation**
Confirm the installation. The following commands verify that the shell can find the aws command in your path, and that the command can actually run.

```
$ which aws
/usr/local/bin/aws 
$ aws --version
aws-cli/2.0.6 Python/3.7.4 Darwin/18.7.0 botocore/2.0.0
```

**Configuring the AWS CLI**
The following example shows sample values. Replace them with your own values as described in the following sections. (If you don't have credential yet, jump to next section to create one)
```
$ aws configure 
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-west-2
Default output format [None]: json
```

## AWS - Amplify & Credentail Setup

In your terminal, to configure Amplify by running the following command:

```
amplify configure
```
`amplify configure` will ask you to sign into the AWS Console. 
(sign in with developer2 AWS account)
<br>

Once you’re signed in, Amplify CLI will ask you to create an IAM user.

```
Specify the AWS Region
? region:  # Your preferred region
Specify the username of the new IAM user:
? user name:  # User name for Amplify IAM user
Complete the user creation using the AWS console
```
Create a user with AdministratorAccess to your account to provision AWS resources for you like AppSync, Cognito etc.  

Once the user is created, Amplify CLI will ask you to provide the accessKeyId and the secretAccessKey to connect Amplify CLI with your newly created IAM user.

```
Enter the access key of the newly created user: NewUser
? accessKeyId:  # YOUR_ACCESS_KEY_ID
? secretAccessKey:  # YOUR_SECRET_ACCESS_KEY
This would update/create the AWS Profile in your local machine
? Profile Name:  # (default)

Successfully set up the new user.
```
## Initialize App (Abc123)

**From your projects directory, run the following commands:**
```
cd Abc123
yarn (or npm install)
```
**Initialize AWS Backend**
From the root of the project, run:

```
amplify init
```
When you initialize Amplify you’ll be prompted for some information about the app:

> If the environment and aws configure already setup
```
? Do you want to use an existing environment? Yes
? Choose the environment you would like to use: dragon
Using default provider  awscloudformation
✔ Initialized provider successfully.
```

> If not
```
? Do you want to use an existing environment? No
? Enter a name for the environment: Dragon
Using default provider  awscloudformation

For more information on AWS Profiles, see:
https://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html

? Do you want to use an AWS profile? Yes 
> NewUser (from your AWS configure profile)

# if Choose No, import your aws credential

? accessKeyId:  (<YOUR_ACCESS_KEY_ID>) 
? AWS Secret Access Key: (<YOUR_SECRET_ACCESS_KEY>) 
? Default region name: us-east-1

```
**Install Amplify Library**
make sure you have `aws-amplify` `aws-amplify-react-native` in your package.json, if not:
```
yarn add/npm install aws-amplify aws-amplify-react-native @react-native-community/netinfo
```
for more amplify information:
https://docs.amplify.aws/cli/start/install#sign-up-for-an-aws-account

## Running On Simulator
```
cd Abc123
npx react-native link
npx react-native run-ios/run-android
```

## Runninng On Device -ios

1. Open the **Xcode** under ios/.
2. Sign DragonCloudApp to run on a simulator.
3. Also sign DragonCloudAppTests if you’d like to run on your device.
4. Run.


## Runninng On Device -android
**1. Install Android Studio**

**2. Configure the ANDROID_HOME environment variable**
The React Native tools require some environment variables to be set up in order to build apps with native code.

Add the following lines to your $HOME/.bash_profile or $HOME/.bashrc config file:
```
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
```

`.bash_profile` is specific to `bash`. If you're using another shell, you will need to edit the appropriate shell-specific config file.

Type `source $HOME/.bash_profile` to load the config into your current shell. Verify that `ANDROID_HOME` has been added to your path by running `echo $PATH`.

Please make sure you use the correct Android SDK path. You can find the actual location of the SDK in the Android Studio "Preferences" dialog, under Appearance & Behavior → System Settings → Android SDK.
1. Open the Android Studio under android/.
2. Wait for gradle to build
3. Run .
> **Troubleshoot device connection with the Connection Assistant**
> The Connection Assistant provides step-by-step instructions to help you set up and use a device over the ADB connection.
> 
> To start the assistant, choose Tools > Connection Assistant.
> Flow The Connection Assistant provides instructions.(Key point below)
> 
>>Connect your device over USB
> Enable USB debugging: enable USB debugging in the on-device developer options.
> Restart the ADB server
> 
## Dependencies Check

under project repository
```
npm list --depth=0

node@v10.18.1
react-native@0.59.10
```

## Zip file Configeration
unzip DragonCloud-master.zip & node_module.zip
add node_mudle at reporistory

```
cd DragonCloud-master
amplify init // see above info if you don't have api dev
npx react-native run-ios //run on simulator
```

## iOS build from Zip File
```
1. copy Abc123.zip and unzip it.
2. cd Abc123
3. rm -rf node_modules
4. npm install 
5. npm install graceful-fs --save-dev
6. npx react-native run-ios --simulator="iPhone 11 Pro Max"
...
