0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

React Native Android Studio 3.1 系で @hoge/hoge となっている npmモジュールが存在すると gradle sync に失敗する

Posted at

とあるアプリを React Native で開発していて、Android 3.1 系統にアップグレードしたら、gradle sync が通らなくなってしまって修正しました。

次の2つのことが同時に発生したことが原因でした。

  • gradle 4.2 を適用したこと
  • @hoge/ と スコープを限定している npm モジュールを利用してる

によると、gradle4.2 で、path-separator-characters ( /, \, :, <, >, ", ?, * )を使用したパスの指定は deprecated になったようです。

アプリでは、@terrylinla/react-native-sketch-canvas を下記のコマンドでインストールしていました。

$npm i -s @terrylinla/react-native-sketch-canvas
$react-native link

こうすると、settings.gradle と app/build.gradle にそれぞれ次のような行が追加されます。

  • settings.gradle
include ':@terrylinla/react-native-sketch-canvas'
project(':@terrylinla/react-native-sketch-canvas').projectDir = new File(rootProject.projectDir, '../node_modules/@terrylinla/react-native-sketch-canvas/android')
  • app/build.gradle
compile project(':@terrylinla/react-native-sketch-canvas')

これらのファイルの、 @terrylinna/ のうち / の文字が原因です。

Hotfix になるのですが、 @terrylinla/ を削除しても動作に支障はないので次のように修正して解決しました。

  • settings.gradle
include ':@terrylinla/react-native-sketch-canvas'
project(':@terrylinla/react-native-sketch-canvas').projectDir = new File(rootProject.projectDir, '../node_modules/@terrylinla/react-native-sketch-canvas/android')

include ':react-native-sketch-canvas'
project(':react-native-sketch-canvas').projectDir = new File(rootProject.projectDir, '../node_modules/@terrylinla/react-native-sketch-canvas/android')
  • app/build.gradle
compile project(':@terrylinla/react-native-sketch-canvas')

compile project(':react-native-sketch-canvas')
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?