Reputation: 1690
So I have installed crosswalk plugin and everything went fine while developing. Then we gave our app build (apk in android) for some users to test before releasing it and we get the error message: "requires the crosswalk project service to work please install it from the app store, then restart"
We noticed this might be an error only for Android below 4.2, so is there any workaround/solution for this?
Upvotes: 1
Views: 4513
Reputation: 25359
A step by step tutorial of how to build ionic apps for android with and without crosswalk.
To generate a release build for Android, first go to ionic app root directory.
Then we can use the following cordova terminal command:
#Generates the *-unsigned.apk file
cordova build --release android
Go to directory platforms/android/build/outputs/apk
, where we can find our generated unsigned APK file.
Very important: if the past command generates more than 1 apks, use the one that contains arm
in its name for example: android-armv7-release-unsigned.apk
.
Generate private key using the keytool command that comes with the JDK. If this tool isn't found, refer to the installation guide (If this command doesn't work on windows make it on linux or a mac and pass *.keystore file through dropbox):
#This generates key.keystore file
keytool -genkey -v -keystore key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
To sign the unsigned APK, run the jarsigner tool which is also included in the JDK. The jarsigner signs the unsigned.apk file (If jarsigner isn't recognize as command just add it to environment vars PATH, usually the file is where the java bin are):
#Remember to rename key.keystore and unsigned.apk by whatever this files are named in your system
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore key.keystore unsigned.apk alias_name
Finally, we need to run the zip align tool to optimize the APK (If zipalign is not recognize try adding it to environment vars PATH for windows; usually the zipalign tool can be found in your/path/to/Android/sdk/build-tools/VERSION/zipalign
)
#If the zipalign isn't recognize try ./zipalign for gitbash or unix based systems
zipalign -v 4 unsigned.apk YouAppName.apk
On Android, the app depends on the Crosswalk browser, and you must have in linked an installed before buiding, after generating the platform files
You'll need to add the corresponding ios platform and install plugins
# ionic platform add android
Add the crosswalk plugin and required dependencies
# ionic browser add crosswalk
Remember to test the app in the simulator on in GenyMotion before building
# ionic run android
Go to the key store directory in the APP root
To generate a release build for Android, first go to ionic app root directory .
Then we can use the following cordova terminal command:
#Generates the *-unsigned.apk file
cordova build --release android
Go to directory platforms/android/build/outputs/apk
, where we can find our generated unsigned APK file.
Very important: if the past command generates more than 1 apks, use the one that contains arm
in its name for example: android-armv7-release-unsigned.apk
, unless you are building for x86 devices.
A valid key for signing the APP is already generated and available in toe android keystore directory in the project root.
To sign the unsigned APK, run the jarsigner tool which is also included in the JDK. The jarsigner signs the unsigned.apk file (If jarsigner isn't recognize as command just add it to environment vars PATH, usually the file is where the java bin are):
#CD to the keystore directory
cd android-keystore
# Sign the generated apk
#Remember to rename unsigned.apk by whatever this files are named in your system
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore key.keystore ../APP/platforms/android/build/outputs/apk/unsigned.apk azanglogold
Finally, we need to run the zip align tool to optimize the APK (If zipalign is not recognize try adding it to environment vars PATH for windows; usually the zipalign tool can be found in your/path/to/Android/sdk/build-tools/VERSION/zipalign
)
# If the zipalign isn't recognize try ./zipalign for gitbash or unix based systems
# Remember to rename unsigned.apk by whatever this files are named in your system
zipalign -v 4 ../APP/platforms/android/build/outputs/apk/unsigned.apk AZSeguros.apk
I had this same error a long time ago. When your doing your build for the apk release for android follow this instructions this will fixed the problem (notice point 3, that is the particular one with the solution):
To generate a release build for Android, first go to ionic app root directory.
Then we can use the following cordova terminal command:
#Generates the *-unsigned.apk file
cordova build --release android
Go to directory platforms/android/build/outputs/apk
, where we can find our generated unsigned APK file.
Very important: if the past command generates more than 1 apks, use the one that contains arm
in its name for example: android-armv7-release-unsigned.apk
.
Generate private key using the keytool command that comes with the JDK. If this tool isn't found, refer to the installation guide (If this command doesn't work on windows make it on linux or a mac and pass *.keystore file through dropbox):
#This generates key.keystore file
keytool -genkey -v -keystore key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
To sign the unsigned APK, run the jarsigner tool which is also included in the JDK. The jarsigner signs the unsigned.apk file (If jarsigner isn't recognize as command just add it to environment vars PATH, usually the file is where the java bin are):
#Remember to rename key.keystore and unsigned.apk by whatever this files are named in your system
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore key.keystore unsigned.apk alias_name
Finally, we need to run the zip align tool to optimize the APK (If zipalign is not recognize try adding it to environment vars PATH for windows; usually the zipalign tool can be found in your/path/to/Android/sdk/build-tools/VERSION/zipalign
)
#If the zipalign isn't recognize try ./zipalign for gitbash or unix based systems
zipalign -v 4 unsigned.apk YouAppName.apk
Upvotes: 3
Reputation: 31
On which devices you get the error message and do you use the sqlite plugin?
There is a known problem with the cordova and sqlite-plugin on x86 64bit devices (e.g. Samsung Galaxy S6). You can find the solution for this problem here: https://github.com/litehelpers/Cordova-sqlite-storage/issues/336
Upvotes: 0