Javascript/reactnative/helloworld/react-native-cli
提供: 初心者エンジニアの簡易メモ
目次
react-native-cliを使ったhelloworld
$ react-native init hello
以下構成で作成される
App.js __tests__ [dir] android [dir] app.json babel.config.js index.js ios [dir] metro.config.js node_modules [dir] package.json yarn.lock
Android実行
cd hello npx react-native run-android # android npx react-native run-ios # ios
removed in Gradle 7.0削除エラー
以下エラーが出て失敗。
Internal API constructor DefaultDomainObjectSet(Class<T>) has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use ObjectFactory.domainObjectSet(Class<T>) instead.
対応方法は謎
端末表示失敗
warn No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.
react-nativeを0.59から0.62に上げると、このエラーになったとの情報があるので、react-native本体バージョンを指定して作成し直す。
npx react-native init hello59 --version 0.59
参考:https://github.com/facebook/react-native/issues/29396
arm-linux-androideabi-stripエラー
以下エラーが発生する場合
Starting a Gradle Daemon (subsequent builds will be faster) /Users/user1/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.12.1/dc6d02e4e68514eff5631963e28ca7742ac69efe/okhttp-3.12.1.jar: D8: Type `org.conscrypt.Conscrypt` was not found, it is required for default or static interface methods desugaring of `java.security.Provider okhttp3.internal.platform.ConscryptPlatform.getProvider()` > Task :app:transformNativeLibsWithStripDebugSymbolForDebug FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:transformNativeLibsWithStripDebugSymbolForDebug'. > A problem occurred starting process 'command '/d/src/unity-ndk/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-strip''
~/.bash_profileあたりで指定してるandroid-ndkがandroid-ndk-r16bなので、最新をDLして更新する
ios実行
cd hello react-native run-ios # ios