当前位置:   article > 正文

升级到android studio 3.6.1遇到Unsupported Modules Detected的问题的解决方法_compilation is not supported for following modules

compilation is not supported for following modules: beento.react-native-rean

升级到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错误的情况下出现的:

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

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

更改前:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project version="4">
  3. <component name="ProjectModuleManager">
  4. <modules>
  5. <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" />
  6. <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" />
  7. <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" />
  8. <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" />
  9. <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" />
  10. <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" />
  11. </modules>
  12. </component>
  13. </project>

 

更改后:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project version="4">
  3.   <component name="ProjectModuleManager">
  4.     <modules>
  5.       <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" />
  6.       <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" />
  7.       <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" />
  8.       <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" />
  9.       <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" />
  10.     </modules>
  11.   </component>
  12. </project>


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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/476650
推荐阅读
相关标签
  

闽ICP备14008679号