问题
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