首页 > 解决方案 > 如何从 react-native 项目中取消链接库

问题描述

我按照安装说明安装了这个库(https://github.com/stefalda/ReactNativeLocalization

npm install react-native-localization --save
react-native link react-native-localization

我不想再使用它了。我已经尝试了以下步骤将其从我的项目中删除:

npm unlink react-native-localization
npm uninstall react-native-localization --save

我试着跑

react-native unlink react-native-localization

但是,我收到错误消息react-native-localization is not a react-native library.

当我运行时,react-native run-android我收到以下错误:

Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve project :react-native-localization.
     Required by:
         project :app
      > Unable to find a matching configuration of project :react-native-localization:
          - None of the consumable configurations have attributes.

标签: react-native

解决方案


第一次运行

react-native unlink libraryname

然后

npm uninstall libraryname

或使用yarn

yarn remove libraryname

以防万一,如果它不起作用,那么

转到您的项目 android 目录并打开setting.gradle

并手动删除您的库配置。和

还要检查您的MainActivity.java以删除有关库的任何配置。

希望它会有所帮助!!!


推荐阅读