first of all i add android platform by writing command in cmd as cordova platform add android --save
but after successfull adding platform i build apk and when i open in smartphone it takes 20-25 sec to load
what should i do please suggest me i am beginner in ionic 2
When you build the app, remember to add --prod
at the end of the command. What command are you using to build?
i am writing only
cordova platform add android --save in cmd
That’s not building, that’s just adding the platform. How do you run the app on your device?
and after adding platform
i click on build app icon in android studio
@mich356c please suggest me
ionic cordova build android --prod
or run instead of build. If run doesn’t work, you need to find the apk file it says it created after running build.
1 Like
you mean after adding platform i have to run in cmd ionic cordova build android --prod ?
Build
ionic cordova build --release android
generate keytool
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
sign the jar
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore HelloWorld-release- unsigned.apk alias_name
zipalign
zipalign -v 4 HelloWorld-release-unsigned.apk HelloWorld.apk
ramon
September 20, 2017, 9:17am
10
Some usefull commands:
Create the project
ionic start myApp
Add platform
ionic cordova platform add android
Development build
ionic cordova build
Production build
ionic cordova build --prod
Run development version to device
ionic cordova run android --device
Run production version to device
ionic cordova run android --device --prod
Serve to browser
ionic serve
If you want to publish the app in Play Store, follow instructions wroted by @yuvanesh :
Build
ionic cordova build --release android
generate keytool
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
sign the jar
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore HelloWorld-release- unsigned.apk alias_name
zipalign
zipalign -v 4 HelloWorld-release-unsigned.apk HelloWorld.apk
1 Like
@mich356c
after running ionic cordova build android --prod
i got this error
Running command [15:17:21] lint finished in 2.58 s
× Running command - failed!
[ERROR] An error occurred while running cordova build android (exit code 1):
ANDROID_HOME=C:\Users\PC\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
Error: Could not find an installed version of Gradle either in Android
Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
after running ionic cordova build
i got this error
ANDROID_HOME=C:\Users\PC\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
Error: Could not find an installed version of Gradle either in Android
Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
Then you need to fix that first.
1 Like
i am beginner in ionic 2 mobile development
can you please give me suggestion that how to fix it ?
ramon
September 20, 2017, 10:42am
15
You already have the answer:
1 Like
i already installed android studio latest
Hi, @cooldp007
First you configure Android sdk in your system and update your Gradle
sudo apt-get install gradle
Hop, this will solve your issue
Thanks,
ANDROID_HOME=‘D:\Android\sdk’
JAVA_HOME=‘C:\Program Files\Java\jdk1.8.0_131’
@cooldp007
Could you update your Android SDK