私は自分のプロジェクトのビルドプロセスに取り組んでいます。基本的に、同じソースから 2 つのアプリをビルドしたいと考えています。これを行うために、さまざまなプロファイルを使用しています。
アプリ内で名前とURLを変更するmavenを構成することができました。両方のアプリが同時にデバイス上にあるように、パッケージも変更する必要があります。
私のプロジェクトは、親POMと2つの子POMで設定されています
最初の子 POM は、APKlib としてパッケージ化されたライブラリです。パッケージは com.companylib です
2 番目の子 POM は、実際の APK を作成し、apklib を参照します。これは com.company としてパッケージ化されています。
現時点では、この構成でマニフェストのパッケージングを変更しています。
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<renameManifestPackage>${manifest_pakage}</renameManifestPackage>
<sign>
<debug>false</debug>
</sign>
<zipalign>
<verbose>true</verbose>
<inputApk>${project.build.directory}/${project.artifactId}.apk</inputApk>
<outputApk>${project.build.directory}/${project.artifactId}-signed-aligned.apk
</outputApk>
</zipalign>
<manifest>
<debuggable>true</debuggable>
<versionCodeAutoIncrement>true</versionCodeAutoIncrement>
</manifest>
<proguard>
<skip>true</skip>
</proguard>
</configuration>
<executions>
<execution>
<id>manifestUpdate</id>
<phase>process-resources</phase>
<goals>
<goal>manifest-update</goal>
</goals>
</execution>
<execution>
<id>alignApk</id>
<phase>package</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
使用するさまざまなプロファイルで manifest_pakage を定義します。これは、最初の子 POM で定義されます。
どちらのプロファイルも正常にビルドされ、同じデバイスに両方をインストールできます。ただし、roboguice が APKLIB を参照しようとすると、ステージング アプリで問題が発生します。次のエラーが表示されます...
FATAL EXCEPTION: main
com.google.inject.ConfigurationException: Guice configuration errors:
1) No implementation for com.companylib.ServerComms.Senders.StringSenderImp annotated with @com.google.inject.name.Named(value=json) was bound.
while locating com.companylib.ServerComms.Senders.StringSenderImp annotated with @com.google.inject.name.Named(value=json)
そのため、apklib のパッケージは変更されていないようです。奇妙なことに、生産時にパッケージを交換すると、問題なく動作します(同じパッケージに交換します)。
このようにセットアップすると、ビルドによって lib のパッケージが変更されることを期待する必要がありますか?
lib のパッケージ名がメイン アプリと異なっていても問題ありませんか?