I trying to publish my app but doesnt work
java version
huseyin-MacBook-Pro:city huseyinsolmaz$ java -version
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
huseyin-MacBook-Pro:city huseyinsolmaz$
ionic info
`
huseyin-MacBook-Pro:city huseyinsolmaz$ ionic info
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : not installed
Gulp CLI : CLI version 3.9.1 Local version 3.9.1
local packages:
Cordova Platforms : none
Ionic Framework : ionic1 1.3.3
System:
Node : v8.11.1
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.3 Build version 9E145
Environment Variables:
ANDROID_HOME : /Development/android-sdk/
Misc:
backend : pro
`
`
huseyin-MacBook-Pro:city huseyinsolmaz$ sudo ionic cordova build --release android
cordova platform add android --save
Using cordova-fetch for [email protected]
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: io.ionic.starter
Name: city
Activity: MainActivity
Android target: android-26
Subproject Path: CordovaLib
Subproject Path: app
Android project created with [email protected]
Android Studio project detected
Android Studio project detected
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Installing "cordova-plugin-whitelist" for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
Adding cordova-plugin-whitelist to package.json
Saved plugin info for "cordova-plugin-whitelist" to config.xml
Discovered plugin "cordova-plugin-device" in config.xml. Adding it to the project
Installing "cordova-plugin-device" for android
Adding cordova-plugin-device to package.json
Saved plugin info for "cordova-plugin-device" to config.xml
Discovered plugin "cordova-plugin-splashscreen" in config.xml. Adding it to the project
Installing "cordova-plugin-splashscreen" for android
Adding cordova-plugin-splashscreen to package.json
Saved plugin info for "cordova-plugin-splashscreen" to config.xml
Discovered plugin "cordova-plugin-ionic-webview" in config.xml. Adding it to the project
Installing "cordova-plugin-ionic-webview" for android
Adding cordova-plugin-ionic-webview to package.json
Saved plugin info for "cordova-plugin-ionic-webview" to config.xml
Discovered plugin "cordova-plugin-ionic-keyboard" in config.xml. Adding it to the project
Installing "cordova-plugin-ionic-keyboard" for android
Adding cordova-plugin-ionic-keyboard to package.json
Saved plugin info for "cordova-plugin-ionic-keyboard" to config.xml
Running command: /Users/huseyinsolmaz/Sites/city/hooks/after_prepare/010_add_platform_class.js /Users/huseyinsolmaz/Sites/city
--save flag or autosave detected
Saving android@~7.0.0 into config.xml file ...
cordova build android --release
Android Studio project detected
Running command: /Users/huseyinsolmaz/Sites/city/hooks/after_prepare/010_add_platform_class.js /Users/huseyinsolmaz/Sites/city
ANDROID_HOME=/usr/local/Caskroom/android-sdk/3859397
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home
(node:13133) UnhandledPromiseRejectionWarning: CordovaError: Requirements check failed for JDK 1.8 or greater
at /Users/huseyinsolmaz/Sites/city/platforms/android/cordova/lib/check_reqs.js:370:19
at _fulfilled (/Users/huseyinsolmaz/Sites/city/platforms/android/cordova/node_modules/q/q.js:854:54)
at self.promiseDispatch.done (/Users/huseyinsolmaz/Sites/city/platforms/android/cordova/node_modules/q/q.js:883:30)
at Promise.promise.promiseDispatch (/Users/huseyinsolmaz/Sites/city/platforms/android/cordova/node_modules/q/q.js:816:13)
at /Users/huseyinsolmaz/Sites/city/platforms/android/cordova/node_modules/q/q.js:624:44
at runSingle (/Users/huseyinsolmaz/Sites/city/platforms/android/cordova/node_modules/q/q.js:137:13)
at flush (/Users/huseyinsolmaz/Sites/city/platforms/android/cordova/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
(node:13133) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13133) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
`
@hsolmaz Looks like a JDK version mismatch:
Requirements check failed for JDK 1.8 or greater
@dwieeb looks like the version check breaks with new java 10 versioning:
/jdk-10.0.1.jdk is greater than 1.8
@ghenry22 Yeah, unfortunately it looks like Java 8 is going to be necessary for a while yet.
Cordova Android docs on JDK setup: https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#java-development-kit-jdk
Fixed I just do edit ~/.bash_profile
export ANDROID_HOME=/Development/android-sdk/
export PATH=${PATH}:/Development/android-sdk/platform-tools:/Development/android-sdk/tools
1.Remove all the Java related packages (Sun, Oracle, OpenJDK, IcedTea plugins, GIJ):
dpkg-query -W -f='${binary:Package}\n' | grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' -e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' -e '^java-common' | xargs sudo apt-get -y remove
sudo apt-get -y autoremove
2.Purge config files (careful. This command removed libsgutils2-2 and virtualbox config files too):
dpkg -l | grep ^rc | awk '{print($2)}' | xargs sudo apt-get -y purge
3.Remove Java config and cache directory:
sudo bash -c 'ls -d /home/*/.java' | xargs sudo rm -rf
4.Remove manually installed JVMs:
sudo rm -rf /usr/lib/jvm/*
5.Remove Java entries, if there is still any, from the alternatives:
for g in ControlPanel java java_vm javaws jcontrol jexec keytool mozilla-javaplugin.so orbd pack200 policytool rmid rmiregistry servertool tnameserv unpack200 appletviewer apt extcheck HtmlConverter idlj jar jarsigner javac javadoc javah javap jconsole jdb jhat jinfo jmap jps jrunscript jsadebugd jstack jstat jstatd native2ascii rmic schemagen serialver wsgen wsimport xjc xulrunner-1.9-javaplugin.so; do sudo update-alternatives --remove-all $g; done
6.Search for possible remaining Java directories:
sudo updatedb
sudo locate -b '\pack200'
7.Install JAVA-8-SDK
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get install oracle-java8-installer
8.Open sudo gedit ~/.bashrc and add these lines
export ANDROID_SDK_ROOT=/yourAndroidStudioPath/Android
export PATH=${PATH}:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export JRE_HOME=/usr/lib/jvm/java-8-oracle/jre
Try to run your ionic app again :)
Njoy!
I got this issue in Mac how to I resolve this. ?
I tried to enter this code step by step but its showing
error: failed to open package info file '/usr/local/var/lib/dpkg/status' for reading: No such file or directory
Please tell what to do for that.?
@Stradivario Helpful, but could you make sure it's clear that your instructions are for Ubuntu-like distros and maybe include the version of the OS?
@HariNarayanan777 I assume you just started running the commands in this comment. Mac does not use apt, dpkg, etc.
This error occurs when building Android projects for Cordova with Java 10. Cordova Android projects still require Java 8. The instructions for installing Java are different per OS.
Here are Cordova's official instructions: https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#java-development-kit-jdk
There are also plenty of online resources for installing Java 8. Just google something like "install java 8 mac os"
Thank you @dwieeb i solved this by deleting the java 10 and install the java 8 once again.. and i used brew to install the dpkg from the terminal.!
I tried @Stradivario solution, and it works perfectly! But is there a way to keep 2 or more Java versions on the same machine? For example, I need both 1.8 and 10+, the first is for building, and the second is for signing the build. The idea is to use 10+ version every time except the case, when we're building the .apk with Ionic (use 1.8 in this case). Is it possible?
I'm asking, because I already tried with two versions, selecting them with sudo update-alternatives --config java, but the build fails every time, when I have both versions installed, doesn't matter, which one is selected.
@commercialsuicide here are some more infos on how to install 1.8 on unbuntu, but keeping 10 the default....
http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html
1.Remove all the Java related packages (Sun, Oracle, OpenJDK, IcedTea plugins, GIJ):
dpkg-query -W -f='${binary:Package}\n' | grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' -e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' -e '^java-common' | xargs sudo apt-get -y remove sudo apt-get -y autoremove2.Purge config files (careful. This command removed libsgutils2-2 and virtualbox config files too):
dpkg -l | grep ^rc | awk '{print($2)}' | xargs sudo apt-get -y purge3.Remove Java config and cache directory:
sudo bash -c 'ls -d /home/*/.java' | xargs sudo rm -rf4.Remove manually installed JVMs:
sudo rm -rf /usr/lib/jvm/*5.Remove Java entries, if there is still any, from the alternatives:
for g in ControlPanel java java_vm javaws jcontrol jexec keytool mozilla-javaplugin.so orbd pack200 policytool rmid rmiregistry servertool tnameserv unpack200 appletviewer apt extcheck HtmlConverter idlj jar jarsigner javac javadoc javah javap jconsole jdb jhat jinfo jmap jps jrunscript jsadebugd jstack jstat jstatd native2ascii rmic schemagen serialver wsgen wsimport xjc xulrunner-1.9-javaplugin.so; do sudo update-alternatives --remove-all $g; done6.Search for possible remaining Java directories:
sudo updatedb sudo locate -b '\pack200'7.Install JAVA-8-SDK
sudo add-apt-repository ppa:webupd8team/java sudo apt-get install oracle-java8-installer8.Open sudo gedit ~/.bashrc and add these lines
export ANDROID_SDK_ROOT=/yourAndroidStudioPath/Android export PATH=${PATH}:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools export JAVA_HOME=/usr/lib/jvm/java-8-oracle export JRE_HOME=/usr/lib/jvm/java-8-oracle/jreTry to run your ionic app again :)
Njoy!
DUDE this is ore pure!, THANKS!!!
1.Remove all the Java related packages (Sun, Oracle, OpenJDK, IcedTea plugins, GIJ):
dpkg-query -W -f='${binary:Package}\n' | grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' -e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' -e '^java-common' | xargs sudo apt-get -y remove sudo apt-get -y autoremove2.Purge config files (careful. This command removed libsgutils2-2 and virtualbox config files too):
dpkg -l | grep ^rc | awk '{print($2)}' | xargs sudo apt-get -y purge3.Remove Java config and cache directory:
sudo bash -c 'ls -d /home/*/.java' | xargs sudo rm -rf4.Remove manually installed JVMs:
sudo rm -rf /usr/lib/jvm/*5.Remove Java entries, if there is still any, from the alternatives:
for g in ControlPanel java java_vm javaws jcontrol jexec keytool mozilla-javaplugin.so orbd pack200 policytool rmid rmiregistry servertool tnameserv unpack200 appletviewer apt extcheck HtmlConverter idlj jar jarsigner javac javadoc javah javap jconsole jdb jhat jinfo jmap jps jrunscript jsadebugd jstack jstat jstatd native2ascii rmic schemagen serialver wsgen wsimport xjc xulrunner-1.9-javaplugin.so; do sudo update-alternatives --remove-all $g; done6.Search for possible remaining Java directories:
sudo updatedb sudo locate -b '\pack200'7.Install JAVA-8-SDK
sudo add-apt-repository ppa:webupd8team/java sudo apt-get install oracle-java8-installer8.Open sudo gedit ~/.bashrc and add these lines
export ANDROID_SDK_ROOT=/yourAndroidStudioPath/Android export PATH=${PATH}:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools export JAVA_HOME=/usr/lib/jvm/java-8-oracle export JRE_HOME=/usr/lib/jvm/java-8-oracle/jreTry to run your ionic app again :)
Njoy!
Worked on my Ubuntu 18.04! Thanks man!
Same issue on Mac OS, solved by below code:
export JAVA_HOME=$(/usr/libexec/java_home -v1.8)
Im working on a MacOS Mojave. I wasn鈥檛 been able to build for android with ionic. What i had to do was the following:
First of all, i had two versions of java. I removed them both, like so:
cd /Library/Java/JavaVirtualMachines
sudo rm -rf jdk<version_number>.jdk
I then went over to https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html to download the jdk8 version, because ionic v3 apperently only supports this version.
After installing that i installed gradle because i didn't had it at that moment:
brew install gradle
An lastly i had to accept the License of the sdk, i could do it via the terminal like so:
~/Library/Android/sdk/tools/bin/sdkmanager --licenses and proceed the steps.
But i opened Android Studio, selected 'SDK manager' on the settings wheel at the bottom right corner and checked out the first three version of android (Android 9, 8.1, and 8.0). And proceeded the steps.
I restarted my terminal and ran the following command again:
ionic cordova build android
And it worked! Hope this'll help.
Really annoying that the docs haven't been updated to reflect this. It's easy to inform users of Ionic of the actual requirements, and most devs assume they should be using the latest dependencies. So this wastes the time of most new users.
This is noted in both Ionic docs and Cordova docs. Is there another place in the docs that we should highlight this?
In the deploying section here.
I fixed those up: https://github.com/ionic-team/ionic-legacy-docs/commit/63bdaa086de36a6e5136db53613e75268e004f07
Those are the old v3 docs, and they haven't been updated in months. If you choose to use Ionic 3, please be patient with issues you encounter along the way. All our attention is on Ionic 4 now. 馃槉 As always, PRs are welcome.
Thanks for the amazing response time! We are constrained to v3 by our client, but we are advocating for v4.
Thanks for the report! I encourage you to create issues in that repo if you find other things that may help others be faster and better. 馃槃
I am working to get those changes deployed.
I've faced this problem, but now fixed, this is how...
I think it just about JDK setting on your ubuntu, make sure you install version 1.8 (manually from tar.gz, because ppa still not work).
then don't forget to change default java & javac version into 1.8 with this
sudo update-alternatives --config javac
sudo update-alternatives --config java
How can i solve this?
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Failed to run "javac -version", make sure that you have a JDK version 8 installed.
You can get it from the following location:
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
How can i solve this?
Most helpful comment
1.Remove all the Java related packages (Sun, Oracle, OpenJDK, IcedTea plugins, GIJ):
2.Purge config files (careful. This command removed libsgutils2-2 and virtualbox config files too):
3.Remove Java config and cache directory:
4.Remove manually installed JVMs:
5.Remove Java entries, if there is still any, from the alternatives:
6.Search for possible remaining Java directories:
7.Install JAVA-8-SDK
8.Open sudo gedit ~/.bashrc and add these lines
Try to run your ionic app again :)
Njoy!