更新基于Maven的Android组建轮廓应用程序名称和标志 [英] Update the app name and logo based on the maven android build profile
本文介绍了更新基于Maven的Android组建轮廓应用程序名称和标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的清单文件
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="20411" android:versionName="2.4.11-SNAPSHOT" package="com.customcompany">
<uses-percustomssion android:name="android.percustomssion.ACCESS_WIFI_STATE"/>
<uses-percustomssion android:name="android.percustomssion.CHANGE_WIFI_STATE"/>
<uses-percustomssion android:name="android.percustomssion.CHANGE_WIFI_MULTICAST_STATE"/>
<uses-percustomssion android:name="android.percustomssion.ACCESS_NETWORK_STATE"/>
<uses-percustomssion android:name="android.percustomssion.INTERNET"/>
<uses-percustomssion android:name="android.percustomssion.READ_LOGS"/>
<uses-percustomssion android:name="android.percustomssion.WRITE_SETTINGS"/>
<uses-percustomssion android:name="android.percustomssion.RECORD_AUDIO"/>
<uses-percustomssion android:name="android.percustomssion.WRITE_EXTERNAL_STORAGE"/>
<uses-percustomssion android:name="com.customcompany.percustomssion.AUTHENTICATE_USER"/>
<uses-percustomssion android:name="android.percustomssion.ACCESS_COARSE_LOCATION"/>
<uses-percustomssion android:name="com.customcompany.percustomssion.LAUNCH_ACTIVITY"/>
<!--<uses-percustomssion android:name="android.percustomssion.SET_DEBUG_APP"/>
<percustomssion android:description="@string/percustomssion_launchActivity_description" android:label="@string/percustomssion_launchActivity_label" android:name="com.customcompany.percustomssion.LAUNCH_ACTIVITY" android:protectionLevel="signature"/>
<percustomssion android:description="@string/percustomssion_authenticateUser_description" android:label="@string/percustomssion_authenticateUser_label" android:name="com.customcompany.percustomssion.AUTHENTICATE_USER" android:protectionLevel="signature"/>-->
<uses-sdk android:customnSdkVersion="13" android:targetSdkVersion="13"/>
<application android:allowBackup="false" android:debuggable="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:largeHeap="true" android:logo="@drawable/actionbarlogo" android:name="com.customcompany.application.CustomApplication" android:theme="@style/Theme.CustomAirline">
<activity android:exported="true" android:name="com.customcompany.activities.ExternalLaunchActivity" android:screenOrientation="portrait">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
<activity android:name="com.customcompany.activities.CustomAirlineActivity" android:screenOrientation="sensorPortait" android:theme="@style/Theme.CustomAirline.ActionBar" android:windowSoftInputMode="adjustPan"/>
<activity android:name="com.customcompany.payment.CardPaymentActivity" android:screenOrientation="sensorPortait" android:theme="@style/Theme.CustomAirline.ActionBar" android:windowSoftInputMode="adjustPan"/>
<activity android:name="com.customcompany.payment.CashPaymentActivity" android:screenOrientation="sensorPortait" android:theme="@style/Theme.CustomAirline.ActionBar" android:windowSoftInputMode="adjustPan"/>
<activity android:name="com.customcompany.chooseflight.FlightDataActivity" android:screenOrientation="sensorPortait"/>
<activity android:name="com.customcompany.login.LoginActivity" android:screenOrientation="sensorPortait" android:theme="@style/Theme.CustomAirline.ActionBar" android:windowSoftInputMode="stateAlwaysVisible|adjustResize"/>
<activity android:name="com.customcompany.forms.FormEntryActivity" android:screenOrientation="sensorPortait" android:theme="@style/Theme.CustomAirline.ActionBar"/>
<activity android:configChanges="orientation|screenSize" android:name="com.customcompany.manual.reader.pdfreader.PDFReaderAct" android:theme="@style/Theme.CustomAirline.ActionBar"/>
<activity android:configChanges="orientation" android:name="com.customcompany.manual.reader.pdfreader.AndroidListViewActivity"/>
<activity android:configChanges="orientation|screenSize" android:name="com.customcompany.manual.CustomManualActivity" android:theme="@style/Theme.CustomAirline.ActionBar"/>
<activity android:configChanges="orientation|screenSize" android:name="com.customcompany.manual.reader.genericreader.GenericReader" android:theme="@android:style/Theme.NoDisplay"/>
<service android:enabled="true" android:exported="false" android:name="com.customcompany.service.ControlledReplicationService"/>
<service android:enabled="true" android:exported="false" android:name="com.couchbase.android.CouchbaseService"/>
<service android:enabled="true" android:exported="false" android:name="com.customcompany.service.LocalCouchService"/>
<service android:enabled="true" android:exported="false" android:name="com.customcompany.ifs.discovery.InflightSyncService"/>
<activity android:configChanges="orientation|screenSize" android:name="com.customcompany.manual.reader.htmlreader.HTMLReader" android:theme="@style/Theme.CustomAirline.ActionBar" android:windowSoftInputMode="stateHidden|adjustResize|adjustPan"/>
<activity android:name="com.customcompany.payment.PreOrderActivity" android:screenOrientation="sensorPortait" android:theme="@style/Theme.CustomAirline.ActionBar" android:windowSoftInputMode="adjustPan"/>
</application>
</manifest>
POM文件
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.8.0</version>
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-base</artifactId>
<version>${proguard.version}</version>
</dependency>
</dependencies>
<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>
<configuration>
<release>true</release>
<sign>
<debug>false</debug>
</sign>
<zipalign>
<skip>false</skip>
<verbose>false</verbose>
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk
</inputApk>
<outputApk>
${project.build.directory}/${project.artifactId}-${project.version}-signed-aligned.apk
</outputApk>
</zipalign>
<manifest>
<debuggable>false</debuggable>
<!-- note: below is set to false for testing. Feel free to use auto-increment
if you are sure about using auto-increment -->
<versionCodeAutoIncrement>false</versionCodeAutoIncrement>
</manifest>
<proguard>
<!-- Set the skip to false when making a proguard release -->
<skip>true</skip>
<config>${proguard.config}</config>
<jvmArguments>
<jvmArgument>-Xms512m</jvmArgument>
<jvmArgument>-Xmx1024m</jvmArgument>
</jvmArguments>
</proguard>
<manifestApplicationLabel>CrewApp-CD</manifestApplicationLabel>
</configuration>
</plugin>
我想它基于Maven的配置文件我选择来构建Android项目来控制应用程序和标识的名称。这是一个支持的功能,如果是这样,我们怎么办呢?
I would like to control the name of the app and logo for it based on the maven profile I select to build the Android project. Is this a supported feature, if so , how do we do this?
推荐答案
您可以做到这一点与Android的Maven插件(至少在3.80版本)。以下是在POM轮廓的蓝图:
You can do that with the android-maven plugin (at least in version 3.80). The following is a blueprint for the profile in the pom:
<profile>
<id>yourProfile</id>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<executions>
<execution>
<id>manifestUpdate</id>
<phase>process-resources</phase>
<goals>
<goal>manifest-update</goal>
</goals>
</execution>
</executions>
<configuration>
<manifestApplicationLabel>yourLabel</manifestApplicationLabel>
<manifestApplicationIcon>yourIcon</manifestApplicationIcon>
</configuration>
</plugin>
</plugins>
</build>
</profile>
有关其他参数见Maven插件。
For other parameters see the maven plugin.
这篇关于更新基于Maven的Android组建轮廓应用程序名称和标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文