RN随记

作者: RudyHao | 来源:发表于2019-08-10 00:44 被阅读0次

    环境

    xcode 10.0
    Android studio 3.4
    "react": "16.8.6",
    "react-native": "0.60.4",

    step1 安装yarn

    npm install -g yarn react-native-cli

    step2 创建项目

    react-native init AwesomeProject
    cd AwesomeProject
    yarn install

    step3 设置

    设置版本号必须三位数

    iOS:

     Bundle Identifier:xxxx.xxx.xxx
     version : 1.0.0
     pod install
    

    Android:

     android->build.gradle dependencies{classpath("com.android.tools.build:gradle:3.3.1")}
     android->gradle->wrapper->properties distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
     android->app->build.gradle->defaultConfig versionName "1.0.0"
    

    step4 运行

    react-native run-ios
    react-native run-android

    iOS错误参考
    ** BUILD FAILED **
    
    
    The following build commands failed:
        PhaseScriptExecution Run\ Script /development/misc/react/AwesomeProject/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/Script-006B79A01A781F38006873D1.sh
    (1 failure)
    Installing build/Build/Products/Debug-iphonesimulator/AwesomeProject.app
    An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
    Failed to install the requested application
    An application bundle was not found at the provided path.
    Provide a valid path to the desired application bundle.
    Print: Entry, ":CFBundleIdentifier", Does Not Exist
    /development/misc/react/AwesomeProject/node_modules/promise/lib/done.js:10
          throw err;
          ^
    
    Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject.app/Info.plist
    Print: Entry, ":CFBundleIdentifier", Does Not Exist
    
        at checkExecSyncError (child_process.js:470:13)
        at Object.execFileSync (child_process.js:490:13)
        at _runIOS (runIOS.js:91:34)
        at runIOS.js:24:5
        at tryCallTwo (/development/misc/react/AwesomeProject/node_modules/promise/lib/core.js:45:5)
        at doResolve (/development/misc/react/AwesomeProject/node_modules/promise/lib/core.js:200:13)
        at new Promise (/development/misc/react/AwesomeProject/node_modules/promise/lib/core.js:66:3)
        at Array.runIOS (runIOS.js:23:10)
        at Object.run (/development/misc/react/AwesomeProject/node_modules/react-native/local-cli/cli.js:86:13)
        at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:88:7)
    

    设置如下:参考

    image.png
    image.png

    相关文章

      网友评论

          本文标题:RN随记

          本文链接:https://www.haomeiwen.com/subject/aucljctx.html