Deploy React-Native

MacOS

For iOS

https://medium.com/react-native-development/deploying-a-react-native-app-for-ios-pt-1-a79dfd15acb8

https://stackoverflow.com/questions/26720764/install-ipa-with-itunes-12

https://stackoverflow.com/questions/14934808/how-to-convert-xcarchive-to-ipa-for-client-to-submit-app-to-app-store-using-aphttps://stackoverflow.com/questions/26720764/install-ipa-with-itunes-12

For Android

dfdf

Window

dfdfdf

Advertisements

Error – Tips – React-Native

Execution failed for task ‘:app:mergeDebugResources’.
> Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:

Cách sửa: Lỗi do hình ảnh không đúng format

aaptOptions {
 cruncherEnabled false
 useNewCruncher false
 }

Cannot merge new index 65536 into a nonjumbo instruction

Cách sửa:

  • Vào file ./android/app/build.gradle
  • Thêm đoạn sau vào object android
android {
    dexOptions {
        jumboMode = true
    }
}

Could not expand ZIP ‘D:\Project\reactnative\trackapp\node_modules\react-native-signature

Cách sửa: Hầu hết trường hợp như này chỉ cần chạy lệnh sau

cd android
gradlew clean

React-Native Module HMRClinet is not a registered callable module(calling enable)

Cách sửa: Chưa xác định, thử trong số vài cách sau

Cách 1: Xóa thử mục build trong android và android/app
Cách 2:
cd android
gradlew clean
Cách 3:
adb kill-server
adb start-server

error: bundling: UnableToResolveError: Unable to resolve module

Cách sửa (tạm thời)

npm install
npm start -- --reset-cache

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.
util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/andr
oid/gms/iid/MessengerCompat;

CÁCH SỬA:

Find defaultConfig in android/app/build.gradle

Add code

multiDexEnabled true

Cấu hình Icon, Slash screen cho React-Native

Icon

Use this Tool to generate icons : https://makeappicon.com/ để export ra  icon file theo cấu trúc thư mục của android và ios

Android

Put ic_launcher.png to folder [ProjectFolder]/android/app/src/main/res/mipmap-*.

  • 72*72 ic_launcher.png to mipmap-hdpi.
  • 48*48 ic_launcher.png to mipmap-mdpi.
  • 96*96 ic_launcher.png to mipmap-xhdpi.
  • 144*144 ic_launcher.png to mipmap-xxhdpi.
  • 192*192 ic_launcher.png to mipmap-xxxhdpi.

iOS

  • Set AppIcon in Images.xcassets.
  • Add 9 different size icons:
    • 29pt
    • 29pt*2
    • 29pt*3
    • 40pt*2
    • 40pt*3
    • 57pt
    • 57pt*2
    • 60pt*2
    • 60pt*3.

Images.xcassets will look like this:

Sử dụng Generator ToolBox

Install

You need node 6 installed and image-magick.

Then install the generator with

npm install -g yo generator-rn-toolbox

Using

Have a single icon file at the ready somewhere. 200x200px is sufficient.

Then in your React Native project, run:

yo rn-toolbox:assets --icon 
# For instance
yo rn-toolbox:assets --icon ../icon.png

You will be asked for the name of your react-native project. For instance, if you created your project with react-native init MyAwesomeProject, your project name is MyAwesomeProject.

When you are asked, ? Overwrite ios/MyAwesomeProject/Images.xcassets/AppIcon.appiconset/Contents.json?, reply with Y

Slash screen

Android

Readmore: https://medium.com/react-native-development/change-splash-screen-in-react-native-android-app-74e6622d699

Githup source : https://github.com/cstew/Splash

iOS

Read here : https://medium.com/the-react-native-log/change-default-launch-screen-in-react-native-ios-app-544f94f1e947

Với Expo

Cấu hình toàn bộ trong file app.json

{
  "expo": {
    "name": "TrackLite",
    "icon": "./src/assets/img/logo.png",
    "version": "1.0.1-beta",
    "sdkVersion": "21.0.0",
    "splash": {
      "image": "./src/assets/img/splash.png",
      "resizeMode": "cover"
    },
    "ios": {
     "bundleIdentifier": "com.yourcompany.yourappname"
   },
   "android": {
     "package": "com.yourcompany.yourappname"
   }
  }
}