Skip to content
This repository was archived by the owner on Mar 27, 2020. It is now read-only.

Commit 32ebe40

Browse files
committed
Improved process for generating APK, signing locally, updating version numbers and removing debug code
1 parent 07d12b1 commit 32ebe40

File tree

3 files changed

+49
-249
lines changed

3 files changed

+49
-249
lines changed

AndroidManifest.xml

Lines changed: 39 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,73 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="org.iilab.pb"
4-
android:versionCode="1"
5-
android:versionName="1.2.6b"
6-
>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="123" android:versionName="1.2.7" package="org.iilab.pb">
73

8-
<uses-sdk
9-
android:minSdkVersion="10"
10-
android:targetSdkVersion="17" />
4+
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17"/>
115

12-
<uses-permission android:name="android.permission.READ_CONTACTS" />
13-
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
14-
<uses-permission android:name="android.permission.INTERNET" />
15-
<uses-permission android:name="android.permission.SEND_SMS" />
16-
<uses-permission android:name="android.permission.VIBRATE" />
17-
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
18-
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
19-
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
20-
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
21-
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
22-
<uses-permission android:name="android.permission.WAKE_LOCK" />
23-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
24-
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
25-
<uses-permission android:name="android.permission.GET_TASKS" />
6+
<uses-permission android:name="android.permission.READ_CONTACTS"/>
7+
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
8+
<uses-permission android:name="android.permission.INTERNET"/>
9+
<uses-permission android:name="android.permission.SEND_SMS"/>
10+
<uses-permission android:name="android.permission.VIBRATE"/>
11+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
12+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
13+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
14+
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
15+
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"/>
16+
<uses-permission android:name="android.permission.WAKE_LOCK"/>
17+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
18+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
19+
<uses-permission android:name="android.permission.GET_TASKS"/>
2620

27-
<application
28-
android:allowBackup="true"
29-
android:icon="@drawable/icon_calculator"
30-
android:label="@string/app_name"
31-
android:name=".common.ApplicationSettings"
32-
android:theme="@android:style/Theme.Light.NoTitleBar">
21+
<application android:allowBackup="true" android:debuggable="false" android:icon="@drawable/icon_calculator" android:label="@string/app_name" android:name=".common.ApplicationSettings" android:theme="@android:style/Theme.Light.NoTitleBar">
3322

34-
<activity
35-
android:excludeFromRecents="true"
36-
android:label="@string/app_name_setup"
37-
android:name=".HomeActivity"
38-
android:noHistory="true"
39-
android:screenOrientation="portrait">
23+
<activity android:excludeFromRecents="true" android:label="@string/app_name_setup" android:name=".HomeActivity" android:noHistory="true" android:screenOrientation="portrait">
4024
<intent-filter>
41-
<action android:name="android.intent.action.MAIN" />
25+
<action android:name="android.intent.action.MAIN"/>
4226
<!--<category android:name="android.intent.category.LAUNCHER"/>-->
4327
</intent-filter>
4428
</activity>
4529

46-
<activity-alias
47-
android:enabled="true"
48-
android:icon="@drawable/icon_setup"
49-
android:label="@string/app_name_setup"
50-
android:name=".HomeActivity-setup"
51-
android:targetActivity=".HomeActivity">
30+
<activity-alias android:enabled="true" android:icon="@drawable/icon_setup" android:label="@string/app_name_setup" android:name=".HomeActivity-setup" android:targetActivity=".HomeActivity">
5231
<intent-filter>
53-
<action android:name="android.intent.action.MAIN" />
54-
<category android:name="android.intent.category.LAUNCHER" />
32+
<action android:name="android.intent.action.MAIN"/>
33+
<category android:name="android.intent.category.LAUNCHER"/>
5534
</intent-filter>
5635
</activity-alias>
5736

58-
<activity-alias
59-
android:enabled="false"
60-
android:icon="@drawable/icon_calculator"
61-
android:label="@string/app_name"
62-
android:name=".HomeActivity-calculator"
63-
android:targetActivity=".HomeActivity">
37+
<activity-alias android:enabled="false" android:icon="@drawable/icon_calculator" android:label="@string/app_name" android:name=".HomeActivity-calculator" android:targetActivity=".HomeActivity">
6438
<intent-filter>
65-
<action android:name="android.intent.action.MAIN" />
66-
<category android:name="android.intent.category.LAUNCHER" />
39+
<action android:name="android.intent.action.MAIN"/>
40+
<category android:name="android.intent.category.LAUNCHER"/>
6741
</intent-filter>
6842
</activity-alias>
6943

70-
<activity
71-
android:excludeFromRecents="true"
72-
android:name=".WizardActivity"
73-
android:screenOrientation="portrait" />
74-
<activity
75-
android:excludeFromRecents="true"
76-
android:name=".WizardModalActivity"
77-
android:screenOrientation="portrait"
78-
android:theme="@style/Theme.Transparent" />
79-
<activity
80-
android:excludeFromRecents="true"
81-
android:launchMode="singleTask"
82-
android:name=".CalculatorActivity"
83-
android:screenOrientation="portrait" />
84-
<activity
85-
android:excludeFromRecents="true"
86-
android:name=".LoginActivity"
87-
android:noHistory="true"
88-
android:screenOrientation="portrait" />
89-
<activity
90-
android:excludeFromRecents="true"
91-
android:name=".MainActivity"
92-
android:screenOrientation="portrait" />
93-
<activity
94-
android:excludeFromRecents="true"
95-
android:name=".MainModalActivity"
96-
android:screenOrientation="portrait"
97-
android:theme="@style/Theme.Transparent" />
44+
<activity android:excludeFromRecents="true" android:name=".WizardActivity" android:screenOrientation="portrait"/>
45+
<activity android:excludeFromRecents="true" android:name=".WizardModalActivity" android:screenOrientation="portrait" android:theme="@style/Theme.Transparent"/>
46+
<activity android:excludeFromRecents="true" android:launchMode="singleTask" android:name=".CalculatorActivity" android:screenOrientation="portrait"/>
47+
<activity android:excludeFromRecents="true" android:name=".LoginActivity" android:noHistory="true" android:screenOrientation="portrait"/>
48+
<activity android:excludeFromRecents="true" android:name=".MainActivity" android:screenOrientation="portrait"/>
49+
<activity android:excludeFromRecents="true" android:name=".MainModalActivity" android:screenOrientation="portrait" android:theme="@style/Theme.Transparent"/>
9850

99-
<service android:name=".trigger.HardwareTriggerService" />
51+
<service android:name=".trigger.HardwareTriggerService"/>
10052

101-
<receiver
102-
android:enabled="true"
103-
android:exported="false"
104-
android:name=".trigger.BootReceiver">
53+
<receiver android:enabled="true" android:exported="false" android:name=".trigger.BootReceiver">
10554
<intent-filter>
106-
<action android:name="android.intent.action.BOOT_COMPLETED" />
55+
<action android:name="android.intent.action.BOOT_COMPLETED"/>
10756
</intent-filter>
10857
</receiver>
10958

110-
<receiver
111-
android:enabled="true"
112-
android:exported="false"
113-
android:name=".location.LocationUpdateReceiver">
59+
<receiver android:enabled="true" android:exported="false" android:name=".location.LocationUpdateReceiver">
11460
<intent-filter>
115-
<action android:name="org.iilab.pb.LOCATION_UPDATE_ACTION" />
61+
<action android:name="org.iilab.pb.LOCATION_UPDATE_ACTION"/>
11662
</intent-filter>
11763
</receiver>
11864

119-
<receiver
120-
android:enabled="true"
121-
android:exported="false"
122-
android:name=".alert.AlarmReceiver">
65+
<receiver android:enabled="true" android:exported="false" android:name=".alert.AlarmReceiver">
12366
<intent-filter>
124-
<action android:name="org.iilab.pb.SEND_ALERT_ACTION" />
67+
<action android:name="org.iilab.pb.SEND_ALERT_ACTION"/>
12568
</intent-filter>
12669
<intent-filter>
127-
<action android:name="org.iilab.pb.SEND_ALERT_ACTION_SINGLE" />
70+
<action android:name="org.iilab.pb.SEND_ALERT_ACTION_SINGLE"/>
12871
</intent-filter>
12972
</receiver>
13073

pom.xml

Lines changed: 8 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@
242242

243243
<profiles>
244244
<profile>
245-
<id>sign</id>
245+
<id>presign</id>
246246
<!-- via this activation the profile is automatically used when the release
247247
is done with the maven release plugin -->
248248
<activation>
@@ -253,38 +253,6 @@
253253
</activation>
254254
<build>
255255
<plugins>
256-
<plugin>
257-
<groupId>org.apache.maven.plugins</groupId>
258-
<artifactId>maven-jarsigner-plugin</artifactId>
259-
<version>1.3.2</version>
260-
<executions>
261-
<execution>
262-
<id>signing</id>
263-
<goals>
264-
<goal>sign</goal>
265-
<goal>verify</goal>
266-
</goals>
267-
<phase>package</phase>
268-
<inherited>true</inherited>
269-
<configuration>
270-
<removeExistingSignatures>true</removeExistingSignatures>
271-
<archiveDirectory />
272-
<includes>
273-
<include>${project.build.directory}/${project.artifactId}.apk</include>
274-
</includes>
275-
<verbose>true</verbose>
276-
<keystore></keystore>
277-
<storepass></storepass>
278-
<keypass></keypass>
279-
<alias>pb</alias>
280-
<arguments>
281-
<argument>-sigalg</argument><argument>MD5withRSA</argument>
282-
<argument>-digestalg</argument><argument>SHA1</argument>
283-
</arguments>
284-
</configuration>
285-
</execution>
286-
</executions>
287-
</plugin>
288256
<plugin>
289257
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
290258
<artifactId>android-maven-plugin</artifactId>
@@ -294,104 +262,13 @@
294262
<sign>
295263
<debug>false</debug>
296264
</sign>
297-
<zipalign>
298-
<skip>false</skip>
299-
<verbose>true</verbose>
300-
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk>
301-
<outputApk>${project.build.directory}/${project.artifactId}-signed-aligned.apk</outputApk>
302-
</zipalign>
303265
<manifest>
304266
<debuggable>false</debuggable>
305-
<!--<versionCodeAutoIncrement>true</versionCodeAutoIncrement>-->
267+
<versionCodeAutoIncrement>true</versionCodeAutoIncrement>
306268
</manifest>
307269
<!-- Change to true to skip Proguard -->
308270
<proguard>
309-
<skip>true</skip>
310-
<config>proguard-project.txt</config>
311-
</proguard>
312-
</configuration>
313-
<executions>
314-
<execution>
315-
<id>manifestUpdate</id>
316-
<phase>process-resources</phase>
317-
<goals>
318-
<goal>manifest-update</goal>
319-
</goals>
320-
</execution>
321-
<execution>
322-
<id>alignApk</id>
323-
<phase>package</phase>
324-
<goals>
325-
<goal>zipalign</goal>
326-
</goals>
327-
</execution>
328-
</executions>
329-
</plugin>
330-
<plugin>
331-
<groupId>org.codehaus.mojo</groupId>
332-
<artifactId>build-helper-maven-plugin</artifactId>
333-
<version>1.9</version>
334-
<configuration>
335-
<artifacts>
336-
<artifact>
337-
<file>${project.build.directory}/${project.artifactId}-signed-aligned.apk</file>
338-
<type>apk</type>
339-
<classifier>signed-aligned</classifier>
340-
</artifact>
341-
<!--<artifact>-->
342-
<!--<file>${project.build.directory}/proguard/mapping.txt</file>-->
343-
<!--<type>map</type>-->
344-
<!--<classifier>release</classifier>-->
345-
<!--</artifact>-->
346-
</artifacts>
347-
</configuration>
348-
<executions>
349-
<execution>
350-
<id>attach-signed-aligned</id>
351-
<phase>package</phase>
352-
<goals>
353-
<goal>attach-artifact</goal>
354-
</goals>
355-
</execution>
356-
</executions>
357-
</plugin>
358-
</plugins>
359-
</build>
360-
</profile>
361-
<profile>
362-
<id>postsign</id>
363-
<!-- via this activation the profile is automatically used when the release
364-
is done with the maven release plugin -->
365-
<activation>
366-
<property>
367-
<name>performRelease</name>
368-
<value>true</value>
369-
</property>
370-
</activation>
371-
<build>
372-
<plugins>
373-
<plugin>
374-
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
375-
<artifactId>android-maven-plugin</artifactId>
376-
<inherited>true</inherited>
377-
<configuration>
378-
<release>true</release>
379-
<sign>
380-
<debug>false</debug>
381-
</sign>
382-
<zipalign>
383271
<skip>false</skip>
384-
<verbose>true</verbose>
385-
<inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk>
386-
<outputApk>${project.build.directory}/${project.artifactId}-signed-aligned.apk</outputApk>
387-
</zipalign>
388-
<manifest>
389-
<debuggable>false</debuggable>
390-
<!--<versionCodeAutoIncrement>true</versionCodeAutoIncrement>-->
391-
</manifest>
392-
<!-- Change to true to skip Proguard -->
393-
<proguard>
394-
<skip>true</skip>
395272
<config>proguard-project.txt</config>
396273
</proguard>
397274
</configuration>
@@ -402,6 +279,12 @@
402279
<goals>
403280
<goal>manifest-update</goal>
404281
</goals>
282+
<configuration>
283+
<manifest>
284+
<versionName></versionName>
285+
<versionCodeAutoIncrement>false</versionCodeAutoIncrement>
286+
</manifest>
287+
</configuration>
405288
</execution>
406289
<execution>
407290
<id>alignApk</id>
@@ -412,33 +295,6 @@
412295
</execution>
413296
</executions>
414297
</plugin>
415-
<plugin>
416-
<groupId>org.codehaus.mojo</groupId>
417-
<artifactId>build-helper-maven-plugin</artifactId>
418-
<configuration>
419-
<artifacts>
420-
<artifact>
421-
<file>${project.build.directory}/${project.artifactId}-signed-aligned.apk</file>
422-
<type>apk</type>
423-
<classifier>signed-aligned</classifier>
424-
</artifact>
425-
<!--<artifact>-->
426-
<!--<file>${project.build.directory}/proguard/mapping.txt</file>-->
427-
<!--<type>map</type>-->
428-
<!--<classifier>release</classifier>-->
429-
<!--</artifact>-->
430-
</artifacts>
431-
</configuration>
432-
<executions>
433-
<execution>
434-
<id>attach-signed-aligned</id>
435-
<phase>package</phase>
436-
<goals>
437-
<goal>attach-artifact</goal>
438-
</goals>
439-
</execution>
440-
</executions>
441-
</plugin>
442298
</plugins>
443299
</build>
444300
</profile>

proguard-project.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
-dontobfuscate
2323
-forceprocessing
2424
-optimizationpasses 5
25-
25+
-dontwarn android.support.v4.view.**
26+
-keep class android.support.v4.** { *; }
2627
-keep class * extends android.app.Activity
2728
-assumenosideeffects class android.util.Log {
2829
public static *** d(...);

0 commit comments

Comments
 (0)