读书笔记-2019年03月19日

记录

ReactNative Android从0.53.0到0.59.1升级记录

1. npm install or yarn

有几个库有问题,私有库要设置一下,log有详细记录:


Panda-MBP:MobileApp_V2 panda8z$ yarn
yarn install v1.12.3
warning package.json: No license field
info No lockfile found.
warning [email protected]: No license field
[1/4] ?  Resolving packages...
error An unexpected error occurred: "https://registry.npm.taobao.org/react-native-panda-alipay: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/Users/panda8z/panda/MobileApp_V2/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Panda-MBP:MobileApp_V2 panda8z$ nrm ls

  npm ---- https://registry.npmjs.org/
  cnpm --- http://r.cnpmjs.org/
* taobao - https://registry.npm.taobao.org/
  nj ----- https://registry.nodejitsu.com/
  rednpm - http://registry.mirror.cqupt.edu.cn/
  npmMirror  https://skimdb.npmjs.com/registry/
  edunpm - http://registry.enpmjs.org/
  sinopia  https://panda_npm.morme.top/

Panda-MBP:MobileApp_V2 panda8z$ nrm sinopia
Panda-MBP:MobileApp_V2 panda8z$ node -v
v11.8.0
Panda-MBP:MobileApp_V2 panda8z$ npm uninstall -g react-native-cli
removed 41 packages in 0.373s
Panda-MBP:MobileApp_V2 panda8z$ nrm ls

  npm ---- https://registry.npmjs.org/
  cnpm --- http://r.cnpmjs.org/
* taobao - https://registry.npm.taobao.org/
  nj ----- https://registry.nodejitsu.com/
  rednpm - http://registry.mirror.cqupt.edu.cn/
  npmMirror  https://skimdb.npmjs.com/registry/
  edunpm - http://registry.enpmjs.org/
  sinopia  https://panda_npm.morme.top/

Panda-MBP:MobileApp_V2 panda8z$ npm install -g react-native-cli
/usr/local/bin/react-native -> /usr/local/lib/node_modules/react-native-cli/index.js
+ [email protected]
added 41 packages from 15 contributors in 2.922s


   ╭───────────────────────────────────────────────────────────────╮
   │                                                               │
   │       New minor version of npm available! 6.5.0 → 6.9.0       │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.9.0   │
   │               Run npm install -g npm to update!               │
   │                                                               │
   ╰───────────────────────────────────────────────────────────────╯

Panda-MBP:MobileApp_V2 panda8z$ npm -v
6.5.0
Panda-MBP:MobileApp_V2 panda8z$ npm install -g npm
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/aproba
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/agent-base
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/builtin-modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/cidr-regex
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/colors
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/cli-table3
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/es6-promise
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/genfun
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/get-stream
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/is-builtin-module
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/JSONStream
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/libnpmhook/node_modules/npm-registry-fetch
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/lru-cache
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-bundled
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-packlist
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-client/node_modules/retry
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-client/node_modules/ssri
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-client
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/node_modules/figgy-pudding
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/node_modules/pump
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/node_modules/cacache/node_modules/mississippi
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/node_modules/socks
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/node_modules/smart-buffer
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/node_modules/socks-proxy-agent
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/node_modules/cacache
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/node_modules/ssri
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/node_modules/make-fetch-happen
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/libnpmhook
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-profile
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/protoduck
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/rimraf
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/cacache
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/lock-verify
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/semver
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/normalize-package-data
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-pick-manifest
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/spdx-license-ids
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/string_decoder
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/unique-filename
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/pacote
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/write-file-atomic
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/byte-size
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/chownr
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/ci-info
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/is-cidr
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/libcipm
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-audit-report
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/query-string
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/read-package-tree
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/readable-stream
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/copy-concurrently/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/fs-write-stream-atomic/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/gauge/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/gentle-fs/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/libnpmhook/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-client/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/node_modules/cacache/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/are-we-there-yet
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/concat-stream
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/duplexify
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/execa
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/flush-write-stream
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/from2
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/got
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/is-ci
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/move-concurrently
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/parallel-transform
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/run-queue
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/sha
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/stream-iterate
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm/node_modules/through2
npm ERR! path /usr/local/lib/node_modules/npm/node_modules/aproba
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/aproba'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/aproba']
npm ERR!   stack:
npm ERR!    "Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/aproba'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules/npm/node_modules/aproba' }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/panda8z/.npm/_logs/2019-03-19T01_53_42_427Z-debug.log
Panda-MBP:MobileApp_V2 panda8z$ sudo npm install -g npm
Password:
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
+ [email protected]
added 52 packages from 9 contributors, removed 15 packages and updated 37 packages in 6.581s
Panda-MBP:MobileApp_V2 panda8z$ npm -v
6.9.0
Panda-MBP:MobileApp_V2 panda8z$ node -v
v11.8.0
Panda-MBP:MobileApp_V2 panda8z$ yarn 
yarn install v1.12.3
warning package.json: No license field
info No lockfile found.
warning [email protected]: No license field
[1/4] ?  Resolving packages...
⠈ mimic-fn@^1.0.0^C
Panda-MBP:MobileApp_V2 panda8z$ nrm ls

  npm ---- https://registry.npmjs.org/
  cnpm --- http://r.cnpmjs.org/
* taobao - https://registry.npm.taobao.org/
  nj ----- https://registry.nodejitsu.com/
  rednpm - http://registry.mirror.cqupt.edu.cn/
  npmMirror  https://skimdb.npmjs.com/registry/
  edunpm - http://registry.enpmjs.org/
  sinopia  https://panda_npm.morme.top/

Panda-MBP:MobileApp_V2 panda8z$ nrm use sinopia
                        

   Registry has been set to: https://panda_npm.morme.top/

Panda-MBP:MobileApp_V2 panda8z$ yanr
bash: yanr: command not found
Panda-MBP:MobileApp_V2 panda8z$ yarn
yarn install v1.12.3
warning package.json: No license field
info No lockfile found.
warning [email protected]: No license field
[1/4] ?  Resolving packages...
error Couldn't find package "@react-native-community/cli@^1.2.1" required by "[email protected]" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Panda-MBP:MobileApp_V2 panda8z$ npm config set "@react-native-community:registry" http://registry.npmjs.org/
Panda-MBP:MobileApp_V2 panda8z$ yarn
yarn install v1.12.3
warning package.json: No license field
info No lockfile found.
warning [email protected]: No license field
[1/4] ?  Resolving packages...
error Couldn't find package "@types/node@*" required by "jest-worker@^24.0.0-alpha.6" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Panda-MBP:MobileApp_V2 panda8z$ npm config set "@types:registry" http://registry.npmjs.org/
Panda-MBP:MobileApp_V2 panda8z$ yarn
yarn install v1.12.3
warning package.json: No license field
info No lockfile found.
warning [email protected]: No license field
[1/4] ?  Resolving packages...
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads https://github.com/apache/cordova-node-xcode.git
Directory: /Users/panda8z/panda/MobileApp_V2
Output:
fatal: unable to access 'https://github.com/apache/cordova-node-xcode.git/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Panda-MBP:MobileApp_V2 panda8z$ yarn
yarn install v1.12.3
warning package.json: No license field
info No lockfile found.
warning [email protected]: No license field
[1/4] ?  Resolving packages...
warning react-native-sqlite-storage > xcode > [email protected]: Use uuid module instead
error Couldn't find package "@jest/transform@^24.5.0" required by "babel-jest@^24.5.0" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Couldn't find package "@jest/types@^24.5.0" required by "babel-jest@^24.5.0" on the "npm" registry.
    at MessageError.ExtendableBuiltin (/usr/local/lib/node_modules/yarn/lib/cli.js:727:66)
    at new MessageError (/usr/local/lib/node_modules/yarn/lib/cli.js:756:123)
    at PackageRequest. (/usr/local/lib/node_modules/yarn/lib/cli.js:35729:17)
    at Generator.throw ()
    at step (/usr/local/lib/node_modules/yarn/lib/cli.js:304:30)
    at /usr/local/lib/node_modules/yarn/lib/cli.js:317:13
    at processTicksAndRejections (internal/process/next_tick.js:81:5)
Panda-MBP:MobileApp_V2 panda8z$ npm config set "@jest:registry" http://registry.npmjs.org/
Panda-MBP:MobileApp_V2 panda8z$ yarn
yarn install v1.12.3
warning package.json: No license field
info No lockfile found.
warning [email protected]: No license field
[1/4] ?  Resolving packages...
warning react-native-sqlite-storage > xcode > [email protected]: Use uuid module instead
error Couldn't find package "@cnakazawa/watch@^1.0.3" required by "sane@^4.0.3" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Panda-MBP:MobileApp_V2 panda8z$ npm config set "@cnakazawa:registry" http://registry.npmjs.org/
Panda-MBP:MobileApp_V2 panda8z$ yarn
yarn install v1.12.3
warning package.json: No license field
info No lockfile found.
warning [email protected]: No license field
[1/4] ?  Resolving packages...
warning react-native-sqlite-storage > xcode > [email protected]: Use uuid module instead
[2/4] ?  Fetching packages...
[3/4] ?  Linking dependencies...
warning " > [email protected]" has incorrect peer dependency "[email protected]".
warning " > [email protected]" has unmet peer dependency "react-art@>= 16.3.2".
warning " > [email protected]" has unmet peer dependency "react-dom@>= 16.3.2".
warning " > [email protected]" has unmet peer dependency "react-native-web@>= 0.7".
warning " > [email protected]" has unmet peer dependency "jcore-react-native@>= 1.2.0".
warning " > [email protected]" has incorrect peer dependency "react-native@^0.40".
warning " > [email protected]" has incorrect peer dependency "react-native-svg@^6.5.2".
warning "react-navigation > [email protected]" has unmet peer dependency "react-native-screens@^1.0.0 || ^1.0.0-alpha".
warning "react-navigation > [email protected]" has unmet peer dependency "react-native-screens@^1.0.0 || ^1.0.0-alpha".
warning "react-navigation > [email protected]" has unmet peer dependency "react-native-screens@^1.0.0 || ^1.0.0-alpha".
warning "jest > jest-cli > jest-config > [email protected]" has unmet peer dependency "jest-haste-map@^24.0.0".
warning "jest > jest-cli > @jest/core > [email protected]" has unmet peer dependency "jest-resolve@^24.1.0".
[4/4] ?  Building fresh packages...
success Saved lockfile.
✨  Done in 41.74s.
Panda-MBP:MobileApp_V2 panda8z$ 

2. 升级yarn


Panda-MBP:MobileApp_V2 panda8z$ yarn -v
1.12.3
Panda-MBP:MobileApp_V2 panda8z$ npm install -g yarn
/usr/local/bin/yarn -> /usr/local/lib/node_modules/yarn/bin/yarn.js
/usr/local/bin/yarnpkg -> /usr/local/lib/node_modules/yarn/bin/yarn.js
+ [email protected]
updated 1 package in 1.115s
Panda-MBP:MobileApp_V2 panda8z$ 

3. 更改Android项目蓝图级文件


1. project级别
  • build.gradle
  • gradle.properties
2. appModules级别
  • build.gradle
  • proguard-rules.pro

4. SyncAndroid工程后找到了react-native-video库不适配了


升级react-native-video库从2.2.04.4.0

重新Sync工程。

出现两类主要问题:

1. 第三方库在清单文件(manifest)文件里写minSdk的问题

读书笔记-2019年03月19日_第1张图片

2. 一些第三方库滞后的依赖标识符,和buildTool版本的适配问题

读书笔记-2019年03月19日_第2张图片

5. 解决第三方库在清单文件(manifest)文件里写minSdk的问题


ERROR: The minSdk version should not be declared in the android manifest file. You can move the version from the manifest to the defaultConfig in the build.gradle file.
Remove minSdkVersion and sync project
Affected Modules: react-native-i18n, react-native-panda-jpush

具体表现是这样的:

读书笔记-2019年03月19日_第3张图片

暂时性解决方案:(本方案在重新安装node_modules后失效)
去第三方库的清单文件先删掉相应的定义minSdk的行,
读书笔记-2019年03月19日_第4张图片

后期解决方案是:

  1. 看看他们在高版本库里有没有解决,然后考虑是否升级他们的版本。
  2. 把当前依赖的这个版本的库拉取到自己的私有云自己维护,自己改。但是权利越大责任越大。

6. 解决第4步中的:一些第三方库滞后的依赖标识符,和buildTool版本的适配问题


暂时忽略,不理他。问题不大。
使用了Android Studio3.3.2版本之后报错清晰。很好用。
读书笔记-2019年03月19日_第5张图片

7. 更改报名将相应的源码文件和资源文件移过来


  • java文件夹的内容
  • res文件夹的内容移动过来

注意几个文件:

  • MainApplication.java
  • MainActivity.java 已经不用依赖一个自定义的ReactActivity了,相应缺少了一个startLoadRNView方法。这个后面再解决 ,一起不能解析的方法先注释。

8. 运行下./gradlew assembleDebug试试有哪些错误存在


读书笔记-2019年03月19日_第6张图片
这个问题最终的解决方案是升级信用卡库:升级到7.4.0
tipsi/tipsi-stripe: React Native Stripe binding for iOS/Android platforms

8. 升级了第7步的库之后有其他问题报错


读书笔记-2019年03月19日_第7张图片
解决方案: 错误说的很清楚,在标签里加一行:
读书笔记-2019年03月19日_第8张图片

9. 解决完第8步之后继续./gradlew assembleDebug报了新的错误


读书笔记-2019年03月19日_第9张图片

解决方案: minSdk升级到19

10. 解决完第9步之后继续./gradlew assembleDebug报了新的错误


读书笔记-2019年03月19日_第10张图片
解决方案:
java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs - HYD的博客 - CSDN博客
读书笔记-2019年03月19日_第11张图片
然后,完善appModule下的build.gradle

11. 解决完第10步之后继续./gradlew assembleDebug报了新的错误


读书笔记-2019年03月19日_第12张图片

解决方案:
查看知道,这个东西都是知乎的图片选择库里的属性,引入这些库就行,继续完善appModule下的build.gradle

12. 不断完善build.gradle后


读书笔记-2019年03月19日_第13张图片

解决方案: 所有的这些有问题的库要么去升级要么都得提PR 。


你可能感兴趣的:(读书笔记)