2014-02-26 24 views
1

应用程序的名称和徽标这是我的清单文件更新基于Maven的机器人的建造轮廓

<?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> 

我想控制的应用程序和徽标的名称它基于我选择构建Android项目的maven配置文件。这是一个支持的功能,如果是这样,我们如何做到这一点?

回答

2

你可以用android-maven插件(至少在3.80版本中)做到这一点。以下是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插件。

+0

感谢您的更新。你可以请分享这个项目的文件。我无法找到一个这个plusin的原因。我想知道支持的其他选项 –

+0

由于应用程序名称是在'application'标记下指定的,所以这不起作用。我认为它适用于清单标记下的所有属性。我正在更新我的POM和清单文件。 –

+0

它为我工作。尝试摆脱''中的'android:label',并且''标记中不需要'$ {manifestApplicationLabel}'。坦率地说,我不知道''和''的顺序是否重要,但也许你应该改变它。而且我看到你在你的pom中有两次'manifest-update'目标。 –