“settings.gradle”中未设置自动链接:expo 模块不会自动链接

Bry*_*yan 5 android autolink android-studio react-native expo

我正在设计一个 React Native 应用程序,我想创建一个 Apk 来测试该应用程序。但是当我在 Android Studio 上单击“将项目与 Gradle 文件同步”时,出现以下错误:

Autolinking is not set up in `settings.gradle`: expo modules won't be autolinked.
Run Code Online (Sandbox Code Playgroud)

我不明白问题是什么,或者更确切地说如何配置自动链接。

小智 4

将以下内容添加到settings.gradle参考

apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle");
useExpoModules()
Run Code Online (Sandbox Code Playgroud)