升级到android studio 3.6.1遇到Unsupported Modules Detected的问题的解决方法

升级到android studio 3.6.1遇到Unsupported Modules Detected的问题的解决方法:

现象就是每次打开项目时,都会提示如下警告:

Unsupported Modules Detected: Compilation is not supported for following modules: 
 android-lottie-react-native, android-react-native-image-crop-picker,
 lottie-react-native-src-android-lottie-react-native,
 node_modules-react-native-dialog-android-react-native-dialog~1, node_modules-react-native-dialog-android-react-native-dialog~2, 
 lottie-react-native-src-android-lottie-react-native~2, node_modules-react-native-image-crop-picker-android-react-native-image-crop-picker, 
 lottie-react-native-src-android-lottie-react-native~1, node_modules-react-native-image-crop-picker-android-react-native-image-crop-picker~2
 
而且项目中会出现多余的module文件夹,且不可删除。经过多次尝试,发现是因为升级到android studio 3.6.1以后,react native项目中依赖的module里重新build之后多出了一些xxx.iml文件,直接删除掉项目的.idea文件夹和删除掉.iml文件都还是会出现;
而多出的xxx.iml文件内容如下,此为build错误的情况下出现的:

<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
  <component name="NewModuleRootManager">
    <orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
    <orderEntry type="sourceFolder" forTests="false" />
  </component>
</module>

这里有一个误区就是,我一开始删除的是react native根项目中的.idea文件夹,所以无效。直接删除android文件夹下的.idea文件夹应该是直接有效的。或者不想都删除的话,
可以只更改 .idea/modules.xml,把多余的未成功build的module记录删除即可。

更改前:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/../node_modules/lottie-react-native/src/android/lottie-react-native.iml" filepath="$PROJECT_DIR$/../node_modules/lottie-react-native/src/android/lottie-react-native.iml" group="demo/lottie-react-native" />
      <module fileurl="file://$PROJECT_DIR$/../node_modules/react-native-date-picker/android/react-native-date-picker.iml" filepath="$PROJECT_DIR$/../node_modules/react-native-date-picker/android/react-native-date-picker.iml" group="demo/react-native-date-picker" />
	  <module fileurl="file://$PROJECT_DIR$/../node_modules/lottie-react-native/src/android/lottie-react-native-src-android-lottie-react-native.iml" filepath="$PROJECT_DIR$/../node_modules/lottie-react-native/src/android/lottie-react-native-src-android-lottie-react-native.iml" group="demo/lottie-react-native" />
      <module fileurl="file://$PROJECT_DIR$/../node_modules/lottie-react-native/src/android/lottie-react-native-src-android-lottie-react-native~1.iml" filepath="$PROJECT_DIR$/../node_modules/lottie-react-native/src/android/lottie-react-native-src-android-lottie-react-native~1.iml" group="demo/lottie-react-native" />
      <module fileurl="file://$PROJECT_DIR$/../node_modules/react-native-image-crop-picker/android/react-native-image-crop-picker.iml" filepath="$PROJECT_DIR$/../node_modules/react-native-image-crop-picker/android/react-native-image-crop-picker.iml" group="demo/react-native-image-crop-picker" />
      <module fileurl="file://$PROJECT_DIR$/../node_modules/react-native-splash-screen/android/react-native-splash-screen.iml" filepath="$PROJECT_DIR$/../node_modules/react-native-splash-screen/android/react-native-splash-screen.iml" group="demo/react-native-splash-screen" />
    </modules>
  </component>
</project>

 

更改后:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/../node_modules/lottie-react-native/src/android/lottie-react-native.iml" filepath="$PROJECT_DIR$/../node_modules/lottie-react-native/src/android/lottie-react-native.iml" group="demo/lottie-react-native" />
      <module fileurl="file://$PROJECT_DIR$/../node_modules/react-native-date-picker/android/react-native-date-picker.iml" filepath="$PROJECT_DIR$/../node_modules/react-native-date-picker/android/react-native-date-picker.iml" group="demo/react-native-date-picker" />
      <module fileurl="file://$PROJECT_DIR$/../node_modules/lottie-react-native/src/android/lottie-react-native-src-android-lottie-react-native.iml" filepath="$PROJECT_DIR$/../node_modules/lottie-react-native/src/android/lottie-react-native-src-android-lottie-react-native.iml" group="demo/lottie-react-native" />
      <module fileurl="file://$PROJECT_DIR$/../node_modules/react-native-image-crop-picker/android/react-native-image-crop-picker.iml" filepath="$PROJECT_DIR$/../node_modules/react-native-image-crop-picker/android/react-native-image-crop-picker.iml" group="demo/react-native-image-crop-picker" />
      <module fileurl="file://$PROJECT_DIR$/../node_modules/react-native-splash-screen/android/react-native-splash-screen.iml" filepath="$PROJECT_DIR$/../node_modules/react-native-splash-screen/android/react-native-splash-screen.iml" group="demo/react-native-splash-screen" />
    </modules>
  </component>
</project>


 
然后重新build一下项目即可。仅此记录一下,项目的结构终于恢复正常了。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值