我需要从相同的代码库构建不同的应用程序。第一个应用程序具有提供拼车的功能,第二个应用程序具有搜索和注册拼车的功能。现在这两个应用程序需要不同。他们的切入点就是我需要与众不同。有没有办法提供构建时间选项来在启动期间更改意图过滤器?
有许多建议用于创建常见功能的jar。但我不想那样做。还有其他办法吗?
答案 0 :(得分:1)
这需要以可在构建时配置代码的方式对代码进行分解。这通常需要编辑某些文件的编程文件(清单,java文件,构建文件等等)来处理构建时间。
答案 1 :(得分:1)
是, 创建两个清单文件。 使用Maven编译(我假设您也可以使用Ant) 创建两个配置文件 根据个人资料设置清单。
即。
的pom.xml
<profile>
<id>Target1</id>
<properties>
<customerManifest>Target1Manifest.xml</customerManifest>
</properties>
</profile>
<profile>
<id>Target2</id>
<properties>
<customerManifest>Target2Manifest.xml</customerManifest>
</properties>
</profile>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<androidManifestFile>${customerManifest}</androidManifestFile>
<sdk>
<platform>15</platform>
</sdk>
</plugin>
这会关闭清单,以便您可以设置单独的入口点。