一、エラー内容
タスク「:app:mergeDebugAssets」の依存関係を特定できませんでした。
構成「:app:debugRuntimeClasspath」のすべてのタスクの依存関係を解決できませんでした。
com.facebook.react:react-native:0.62.2 が見つかりませんでした。
主な理由は、バージョンの問題により、react-native-community に関連する一連のライブラリをリンクできないことです。
私の React Native バージョンは 0.62.2 です。
具体的なエラーのスクリーンショットは次のとおりです。
第二に、解決策
andriod フォルダーの下で、build.gradle 構成を変更し、以下を追加します。
// Top-level build file where you can add configuration options common to all sub-projects/modules.
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
allprojects {
//...其他配置
configurations.all {
resolutionStrategy {
// Remove this override in 0.65+, as a proper fix is included in react-native itself.
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
}
参考記事:
https://stackoverflow.com/questions/74430295/could-not-find-any-matches-for-com-facebook-reactreact-native-as-no-version