Lets create your first React App using create-react-app. Here we will go through all steps required to build a React App.
Follow the instructions shown to create your first React App
[email protected] start C: Users loicq Desktop Coding react diablo-mvp react-scripts start. There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you need to fix locally. The react-scripts package provided by Create React App requires a dependency: 'webpack': '4.19.1'. Create the folder inside say your Documents folder on your Mac as below: mkdir Apps. Open VS Code and open New Terminal and type the following command to create a new React-Native App: react-native init MyApp cd MyApp cd ios pod install. Come back to the MyApp folder and run the below command to run your App in the iOS simulator: react-native.
Once you run this command your project will be created like below, I am using Microsoft VSCode but you can use any code editor.
Please note if you close the command prompt, the development server will be stopped and your pages will not be loaded. So keep it running so that background processes for development server keeps running and your webpages will be loaded automatically, any change you make to your code will be loaded automatically without hitting the refresh button.
Folder structure of yournew react project
There are lot of filesand directories in our project, we will talk about the most important ones, wewill need these files in future to edit in various scenarios
The App Center SDK uses a modular architecture so you can use any or all of the services.
Let's get started with setting up App Center React Native SDK in your app to use App Center Analytics and App Center Crashes.
1. Prerequisites
Before you begin, make sure that the following prerequisites are met:
2. Create your app in the App Center Portal to obtain the App Secret
If you have already created your app in the App Center portal, you can skip this step.
Once you have created an app, you can obtain its App Secret on the Settings page on the App Center Portal. At the top right hand corner of the Settings page, click on the triple vertical dots and select
Copy app secret to get your App Secret. Mac apps store download.
3. Add the App Center SDK modules
The default integration of the SDK uses CocoaPods for iOS. If you are not using CocoaPods in your app, you need to integrate the React Native SDK manually for your iOS app.
Open a Terminal and navigate to the root of your React Native project, then enter the following line to add App Center Analytics and Crashes to the app:
In case you prefer
yarn over npm , use the following command to install App Center:
The App Center SDK uses a modular approach, where you just add the modules for App Center services that you want to use. appcenter-analytics and appcenter-crashes make sense to add to almost every app, as they provide value with no additional setup required. appcenter provides general purpose App Center APIs, useful for multiple services.
3.1 Integrate the SDK automatically for React Native 0.603.1.1 Integrate React Native iOS
3.1.2 Integrate React Native Android
Note: If the folder named assets does not exist, it should be created under 'project_root/android/app/src/main/assets'
3.2 Integrate the SDK automatically for React Native lower than 0.60
Note
If you have your React modules linked using relative path inside your Podfile but not referenced in the project, the linking script will fail because it links App Center using static pod versions. You will either have to follow the steps from the React Native troubleshooting section if you have already run the linking script, or link it yourself
3.3 [iOS only] Integrate the SDK manually for React Native without react-native link or CocoaPods![]()
Do this integration, if you don't want to use CocoaPods.We strongly recommend integrating the SDK via CocoaPods as described above. Nonetheless, it's also possible to integrate the iOS native SDK manually.
Note
The latest App Center React Native SDK doesn't necessarily depend on the latest App Center iOS SDK, because the iOS SDK is updated and released before the React Native one.
The consequence is that you have to know which version of the iOS SDK the React Native SDK depends on.
Note
The next two steps are only for the apps that use React Native 0.60 and above.
3.4 [Android only] Integrate the SDK manually for React Native lower than 0.60 without react-native link
Integration steps without the
react-native link command.
3.5 If you use auto-backup to avoid getting incorrect information about device, follow the next steps:
Note
Apps that target Android 6.0 (API level 23) or higher have Auto Backup automatically enabled.
Note
If you already have a custom file with backup rule, switch to the third step.
a. Create appcenter_backup_rule.xml file in the android/app/src/main/res/xml folder.
b. Open the project's AndroidManifest.xml file. Add the
android:fullBackupContent attribute to the <application> element. It should point to the appcenter_backup_rule.xml resource file.
c. Add the following backup rules to the appcenter_backup_rule.xml file:
4. Start the SDK
Now you can build and launch your application either from command line or Xcode/Android Studio.
4.1 Build and run your application from command line
You may build and launch your iOS application by the following command:
You can launch it on an iOS simulator or iOS device by specifying the iOS device name in
react-native run-ios --device 'myDeviceName' .
You may build and launch your Android application by the following command:
Tip
You can launch it on an android emulator or android device by specifying the device id in
react-native run-android --deviceId 'myDeviceId' (deviceId from adb devices command).
Create-react-app Mac Download4.2 Build and run your application from Xcode or Android Studio
For iOS, open your project's
ios/{appname}.xcworkspace or ios/{appname}.xcodeproj file in Xcode and build from there.
Note
Install Create React App
If you linked App Center automatically via
react-native link (as in step 3.1), you should open the project's ios/{appname}.xcworkspace file in Xcode. Because App Center CocoaPods dependencies only works with xcworkspace not xcodeproj , and the ios/{appname}.xcodeproj file won't have App Center CocoaPods dependencies linked.
For Android, import your android project in Android Studio and build from there.
Create A New React App
You are all set to visualize Analytics and Crashes data on the portal that the SDK collects automatically. There is no additional setup required. Look at Analytics and Crashes section for APIs guides and walkthroughs to learn what App Center can do.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |