Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slim down the android app #46

Merged
merged 2 commits into from
Jun 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,34 +41,6 @@ Installation is now complete. You can view the current state of the application

$ ionic emulate ios --target="iPhone-6"


#### Temporary workaround *for android only* ####
Unfortunately, `ionic state` does not store plugin version numbers, and
versions of crosswalk > 16 are so large that the generated APK is too big
and needs `multi-dex` support.
https://developer.android.com/studio/build/multidex.html#mdex-gradle

It looks like multi-dex is a pain, and is complicated to use with cordova since
it requires a modification to the AndroidManifest.xml to use a different
activity.

```
In your manifest add the MultiDexApplication class from the multidex support library to the application element.
```

It seems like it would be a Good Thing to trim down the app anyway instead of
using multi-dex, since that will also help with memory usage and with load
times. But for now, the workaround is to force the use of the older and smaller
crosswalk version.

So before we build the android version, we need to do
```
$ cordova plugin remove cordova-plugin-crosswalk-webview
$ cordova plugin add cordova-plugin-crosswalk-webview@1.5.0
```

This does NOT affect iOS.

Troubleshooting
---

Expand Down
12 changes: 12 additions & 0 deletions bin/sign_and_align_keys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@ if [[ $# -eq 0 ]]; then
exit 1
fi

# Sign and release arm7
cp platforms/android/build/outputs/apk/android-armv7-release-unsigned.apk platforms/android/build/outputs/apk/android-armv7-release-signed-unaligned.apk
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/Safety_Infrastructure/MovesConnect/production.keystore ./platforms/android/build/outputs/apk/android-armv7-release-signed-unaligned.apk androidproductionkey
~/Library/Android/sdk/build-tools/22.0.1/zipalign -v 4 platforms/android/build/outputs/apk/android-armv7-release-signed-unaligned.apk emission-armv7-build-$1.apk

# Sign and release x86
cp platforms/android/build/outputs/apk/android-x86-release-unsigned.apk platforms/android/build/outputs/apk/android-x86-release-signed-unaligned.apk
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/Safety_Infrastructure/MovesConnect/production.keystore ./platforms/android/build/outputs/apk/android-x86-release-signed-unaligned.apk androidproductionkey
~/Library/Android/sdk/build-tools/22.0.1/zipalign -v 4 platforms/android/build/outputs/apk/android-x86-release-signed-unaligned.apk emission-x86-build-$1.apk

# Remove the plugin, sign and release general
ionic plugin remove cordova-plugin-crosswalk-webview
ionic build android --release -- --minSdkVersion=21
cp platforms/android/build/outputs/apk/android-release-unsigned.apk platforms/android/build/outputs/apk/android-L+-release-signed-unaligned.apk
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/Safety_Infrastructure/MovesConnect/production.keystore ./platforms/android/build/outputs/apk/android-L+-release-signed-unaligned.apk androidproductionkey
~/Library/Android/sdk/build-tools/22.0.1/zipalign -v 4 platforms/android/build/outputs/apk/android-L+-release-signed-unaligned.apk emission-L+-build-$1.apk

# Re-add the plugin
ionic plugin add cordova-plugin-crosswalk-webview --variable XWALK_MODE="lite"
8 changes: 4 additions & 4 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
<preference name="BackupWebStorage" value="none"/>
<preference name="SplashScreen" value="screen"/>
<preference name="SplashScreenDelay" value="3000"/>
<preference name="xwalkVersion" value="16+"/>
<preference name="xwalkCommandLine" value="--disable-pull-to-refresh-effect"/>
<preference name="xwalkMode" value="embedded"/>
<preference name="xwalkMultipleApk" value="true"/>
<preference name="xwalkVersion" value="xwalk_core_library_canary:17+" />
<preference name="xwalkCommandLine" value="--disable-pull-to-refresh-effect" />
<preference name="xwalkMode" value="lite" />
<preference name="xwalkMultipleApk" value="true" />
<feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar"/>
</feature>
Expand Down