Replace project name with variable in Android Studio modules.xml

坚强是说给别人听的谎言 提交于 2020-01-06 14:44:06

问题


We have issues in our team because each developer has different folder structure so the name of project is different too. Is it possible to use some variable to automaticaly substitute the last part of .iml file name?

In following example of modules.xml, the project name is MyProject but other team members have e.g. HisProject.

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/MyProject.iml" filepath="$PROJECT_DIR$/MyProject.iml" />
      <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
    </modules>
  </component>
</project>

I have found this:

${PROJECT_NAME} - the name of the current project.

here but none of following paths does not work.

<module fileurl="file://$PROJECT_DIR$/$PROJECT_NAME$.iml" filepath="$PROJECT_DIR$/$PROJECT_NAME$.iml" />
<module fileurl="file://$PROJECT_DIR$/$PROJECT_NAME.iml" filepath="$PROJECT_DIR$/$PROJECT_NAME.iml" />
<module fileurl="file://$PROJECT_DIR$/${PROJECT_NAME}.iml" filepath="$PROJECT_DIR$/${PROJECT_NAME}.iml" />

来源:https://stackoverflow.com/questions/34927251/replace-project-name-with-variable-in-android-studio-modules-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!