Help with Cross Platform Mobile Project needed!


#1

Hi all, I would be grateful if anyone on forum could possibly help with a project I’m finding really difficult to do, because of various issues with SDK files installed and also that I find developing ionic apps difficult in that I haven’t a background and this project is tough for me. Basically I am required to develop an app, like shopping tracker, etc, but one which has camera and sms functionality - so for example if someone was using a shopping app, they could take a photo or an item, or sms someone. The app should also allow for data to be retained when user exists app, so when they start app again, previous data is still there. The app should have tabs and sidemenu. I’ve created the app on desktop, using ionic start myapp but I can’t build the apk file - as seems problem with invalid java and it’s taken days to try to find out what exactly issue is. If anyone can help, I have a tight deadline for this and need to get it done very soon. Thanks…


#2

What is the error with ionic build android ?


#3

Hi, thanks for replying. This is the error code I get when I input ionic build android. I’ve checked the java path and it’s set to home and I created also an androiid_home path too, but makes no difference. When I input ‘ionic add platform android’ it comes back saying ‘bower’ is installed but am not sure the platform is correctly set up.

cmd error message:

C:\Users\Owner\My Documents\PROJECT
APP\project>ionic build android

Running command: cmd “/s /c
”“C:\Users\Owner\My Documents\platforms\android\cordova\build.bat”""

[Error: Failed to run “java -version”,
make sure that you have a JDK installed.

You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.

Your JAVA_HOME is invalid: C:\ProgramFiles\Java\jdk1.7.0_75

ERROR building one of the platforms: Error: cmd:
Command failed with exit code 2

You may not have the required environment or OS
to build this project

Error: cmd: Command failed with exit code 2


#4

This is a problem with your JDK install.
Have you installed the Java Development Kit ?
You will need it to build your app for android.

If you already have it installed, check if there is “java.exe” at C:\ProgramFiles\Java\jdk1.7.0_75 on your machine.


#5

Hi thanks, yes I searched for java.exe and got following message:-

c:\ProgramData\Oracle\Java\Javpath\java.exe - does not exist! However, this is confusing as I have JDK 8 update 91 (build 1.8.0_91-b14) installed. Would you have any idea why this is happening, and that there is no java.exe file?

Also, if I can’t resolve this and create an apk file, I will just have to submit whatever I can for project, which will be the www. files. Would you or anyone else on the forum know how I should program the www files, so that it has camera and sms functionality. I have the following cordova links, but unsure where these go - I assume on index.html page but don’t know how I need to link up with other pages. Also if I want to create an app that retains user data, would I need to use a script in javascript file for that? The whole thing is a bit difficult for me, as I’ve run into such problems. I assume I would use the tabs template to create the app on ionic but how could I create an with both tabs and side menu? Sorry for so many queries.

Camera - http://ngcordova.com/docs/plugins/camera/

SMS - http://ngcordova.com/docs/plugins/sms/


#6

Camera and sms are cordova plugin. They’re not all available with www files, if they work, you don’t have to modify your www files.
To use www files, just run it with : ionic serve

If you have JDK 8 installed, try updating your environnement variable JAVA_HOME from

C:\ProgramFiles\Java\jdk1.7.0_75
to C:\ProgramFiles\Java\jdk1.8.0_91 (or another one who is present on your machine)


#7

Hi, thanks for that. I checked and on c:\program files - it wasn’t the same java version which is installed, so I changed the path to:-

C:\Program Files\jdk1.8.0_91_75;%JAVA_HOME%\bin, which is what is installed. However, not sure if I I’ve done this correctly, and will check later. Do I need the ‘bin’ also? I think I read this somewhere else that bin should be added at end. I will test it later. Thanks for all your help.


#8

I think what I posted above may be incorrect also, so when I’ve more time later, I will check it again. Thanks again.


#9

Hello, I spent hours and hours checking out what might be the issue with ionic build, and realised there is NO java.exe or javaw.exe file installed. I checked my java version is 1.8.0_91. Java ™ SE Runtime environment <build 1.8.0_91_b14>.
Java Hotspot client VM <build 25.91-b14, mixed mode, sharing>.

What should I do if there is no java.exe or javaw.exe file. There is javws.exe.

Thanks in advance for help. It’s really hard to do anything for this project with these issues. I appreciate any help.