Problem exporting the apk

380 views
Skip to first unread message

Simone Manduchi

unread,
Apr 16, 2014, 4:04:43 PM4/16/14
to phon...@googlegroups.com
Hi everyone.
I'm new to phonegap.

I created the environment

> phonegap create 0SC  -n MYname -i com.example.0SC
and the first strange thing is that remains "Helloworld"
I've set JAVA_HOME in cmd and build android in "0SC"

Well, after this, I went to eclipse and I've imported the existing project ( strange the new project names are: HelloWorld and HelloWorld-Cordovalib (and not myname))
anyway I've edited Helloworld-->www-->index.html but when I try to export the APK (and I must disable Auto Building, otherwise I would receive conversion to dalvik format failed with error 1) the APK is created but it is the base version (Helloworld and default index)

Why?

Thank you very much,

sayap biru

unread,
Apr 17, 2014, 3:41:55 AM4/17/14
to phon...@googlegroups.com

dalvik format failed with error : Clean Project and rebuild it

strange the new project names are: HelloWorld and HelloWorld-Cordovalib (and not myname) : before you build first go to www/config.xml...change to whatever name u want then build....when u imported to eclipse it will change to ur name define in config.xml

Simone Manduchi

unread,
Apr 18, 2014, 4:49:54 AM4/18/14
to phon...@googlegroups.com
Obviously I tried.
I tried to edit the config.xml file but without any result, moreover why does not the app change (after I change the index.html file)?
I think there might be some error in the install, so I've restored the system and I'm following this guide: http://codingsquare.blogspot.in/2013/08/creating-cordova-3-android-project.html

but when I run cordova -d platform add android
it gives me this error: Command finished with error code ENOENT

I think that the problem may be linked with JAVA PATH or ANT.
Because if I run "java" or "ant" I got no results.

My system vars are:
ANDROID_HOME C:\Users\Fregior\Desktop\adt-bundle-windows-x86-20140321\sdk\
ANT_HOME C:\Users\Fregior\Desktop\Downloads\ant
JAVA_HOME C:\Program Files\Java\jdk1.8.0\

Path: C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\nodejs\;%JAVA_HOME%\bin;%ANT_HOME%\bin;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;

I tryed to run set JAVA_HOME=C:\Program Files\Java\jdk1.8.0 and set ANT_HOME=C:\Users\Fregior\Desktop\Downloads\ant
but nothing happened.

I don't wanna try any weird operation, I think it's better to ask you
Thank you very much for your help.

Rahul

unread,
Apr 19, 2014, 5:35:05 AM4/19/14
to phon...@googlegroups.com
Check the contents in assets www folder. The contents of the app are displayed from the assets www folder, not the root www folder. 
When you uses the phonegap command line utility it copies the content form root www folder to assets www folder.

Also for create the project, you have to pass the third argument which is the application name -

phonegap create OSC com.example.OSC OSC

Also if you want to change the application name and you are using Eclipse, when you forget to add the third parameter, then you can do so in the Strings.xml file which is present in res->values folder.

Simone Manduchi

unread,
Apr 19, 2014, 9:22:36 AM4/19/14
to phon...@googlegroups.com
Thanks. I'll follow your advices (anyway, my command was "create OSC com.example.OSC OSC)
but first of all I must reinstall everything and I have not resolved the previous problem: <<Command finished with error code ENOENT>> and I'd like to avoid operations of which I'm not sure so I asked you.

Thank you very much for your help!
I really appreciate it

sayap biru

unread,
Apr 20, 2014, 9:44:16 PM4/20/14
to phon...@googlegroups.com
 
ok...could you please run this first : npm cache clean
and try again.....

Ok my experience if u run phonegap create OSC com.example.OSC OSC
Before add platform android go to www/config.xml,replace HelloWorld.
then run phonegap install android or phonegap build android.
Using phonegap command u dont have to add platform android. -will give u error.

if you run using cordova create OSC com.example.OSC OSC. You dont need to edit anything.

From what i see...i dont know why using phonegap command it does not compile properly in xml.But if you use cordova command, you dont have problem....

Simone Manduchi

unread,
Apr 21, 2014, 1:53:57 PM4/21/14
to phon...@googlegroups.com
Thanks again for your reply.
I'm using cordova (there isn't any difference with phonegap, is it?) and this is the error I recieve:
http://www.hosting.universalsite.org/image-cmd-0B46_53555ACE.jpg

I think it might be "ant" the problem but I can't understand where I'm wrong.

Thanks!

Rahul

unread,
Apr 21, 2014, 2:47:19 PM4/21/14
to phon...@googlegroups.com
have you added the ant bin directory in your Path variable?
Message has been deleted

Simone Manduchi

unread,
Apr 21, 2014, 3:23:18 PM4/21/14
to phon...@googlegroups.com
Yes in system variables I have:
ANT_HOME => C:\Users\Fregior\Desktop\Downloads\ant
and Path => C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\nodejs\;%JAVA_HOME%\bin;%ANT_HOME%\bin;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;


Is here anything wrong? 
Thanks

Mobile Development

unread,
Apr 21, 2014, 3:27:44 PM4/21/14
to phon...@googlegroups.com
What about user variable? In the command prompt where you are running the cordova command what path does it show? You can see it using this command => echo %PATH%

Simone Manduchi

unread,
Apr 21, 2014, 3:53:50 PM4/21/14
to phon...@googlegroups.com

Mobile Development

unread,
Apr 21, 2014, 4:18:24 PM4/21/14
to phon...@googlegroups.com
Ok, You can try this. Uninstall the Java, reboot the machine. This should remove all the Java path from the system. Now re install the Java, but this time do not install the public JRE which is shown during the installation along with the JDK.​ It will automatically add the path, if not add it manually. But try to run the java command in command prompt before adding the path.

Simone Manduchi

unread,
Apr 22, 2014, 4:14:22 AM4/22/14
to phon...@googlegroups.com
Ok, thanks but I'm afraid it has not solved the problem:

Thanks for your help! Again

Mobile Development

unread,
Apr 22, 2014, 5:03:54 AM4/22/14
to phon...@googlegroups.com
1) Go to your users directory and delete folder with the name .android and .cordova.
2) Now open your command prompt and type android and press enter. It should open the Android SDK manger and command should not 
given any error in the prompt.
3) Now close the SDK manager. Clear the npm cache  and install the cordova again.
   
   npm cache clean

   npm install cordova -g  

  After that close the CMD prompt and open it again.  

4) create your project again with the following command

   cordova create OSC com.example.OSC OSC

5) Now cd to your project directory and run this command without " -d "-
    
    cordova platform add android

Message has been deleted

Simone Manduchi

unread,
Apr 22, 2014, 11:42:20 AM4/22/14
to phon...@googlegroups.com
 
Thanks i follow your points and I receive an error (about Java) in the last one
I really can't understand why Java gives me this kind of problems:

C:\Users\Fregior>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.8.0_05

C:\Users\Fregior>java -version
"java" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch. 

C:\Users\Fregior>echo %Path%
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Wi
ndows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Pr
ogram Files (x86)\Windows Live\Shared;C:\Program Files\nodejs\;C:\Program Files\
Java\jdk1.8.0\bin;C:\Users\Fregior\Desktop\Downloads\ant\bin;C:\Users\Fregior\De
sktop\adt-bundle-windows-x86-20140321\sdk\\platform-tools;C:\Users\Fregior\Deskt
op\adt-bundle-windows-x86-20140321\sdk\\tools;C:\Users\Fregior\AppData\Roaming\n
pm;
 
It my var systems my Path is:
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\nodejs\;%JAVA_HOME%\bin;%ANT_HOME%\bin;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;

and JAVA_HOME C:\Program Files\Java\jdk1.8.0_05

I can't figure it out

Simone Manduchi

unread,
Apr 22, 2014, 11:43:05 AM4/22/14
to phon...@googlegroups.com
P.S.: This is the error
C:\Users\Fregior\OSC>cordova platform add android
Downloading cordova library for android...
Download complete
Creating android project...

C:\Users\Fregior\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:126
                    throw e;
                          ^
Error: Failed to run 'java -version', make sure your java environment is set up
including JDK and JRE.
Your JAVA_HOME variable is C:\Program Files\Java\jdk1.8.0_05
Error: Command failed: "java" non ´┐¢ riconosciuto come comando interno o estern
o,
 un programma eseguibile o un file batch.

    at C:\Users\Fregior\.cordova\lib\android\cordova\3.4.0\bin\lib\check_reqs.js
:62:22
    at ChildProcess.exithandler (child_process.js:641:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Socket.<anonymous> (child_process.js:956:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:465:12)
Error: C:\Users\Fregior\.cordova\lib\android\cordova\3.4.0\bin\create.bat: Comma
nd failed with exit code 8
    at ChildProcess.whenDone (C:\Users\Fregior\AppData\Roaming\npm\node_modules\
cordova\src\superspawn.js:126:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Process.ChildProcess._handle.onexit (child_process.js:810:5) 

Mobile Development

unread,
Apr 22, 2014, 12:47:28 PM4/22/14
to phon...@googlegroups.com
Run the CMD prompt as administrator and run the commands again.


--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
---
You received this message because you are subscribed to a topic in the Google Groups "phonegap" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/phonegap/8zHQTwLpULE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to phonegap+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Best Regards,

Rahul


Application Nexus Webservices Pvt. Ltd.
101-105, Center One,
Next to Ashoka Buildcon,
Ashoka Marg, Nasik - 422 011
Maharashtra. INDIA

Mobile: +91-9665993073
http://www.applicationnexus.com 


DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.

It shall not attach any liability on the originator or Application Nexus or its affiliates. Any  views or opinions presented in this email are solely those of the author and may not necessarily reflect the opinions of Application Nexus or its affiliates. 

Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any mail and attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

sadiq Mo

unread,
Apr 23, 2014, 3:55:54 AM4/23/14
to phon...@googlegroups.com

Hi Rahul,

I would like to know if you could help me develop a functionality on phonegap application. Please send me an email sadi...@gmail.com or skype sadiqsadiq199.
We can arrange everything later.


Regards Sadiq

Simone Manduchi

unread,
Apr 23, 2014, 4:41:14 AM4/23/14
to phon...@googlegroups.com
Thanks. It worked.
Last question (I hope)
I edited OSC -> WWW -> Index.html from eclipse
I've changed <p class="event received">Device is Ready</p> in <p class="event received">Mytext</p>
after this I've saved the file and I've exported the apk.
Why (if I install the apk on my device) is it shown "Device is Ready"?

Thanks again.
You are very kind.


On Tuesday, April 22, 2014 6:47:28 PM UTC+2, Rahul wrote:

rahul

unread,
Apr 23, 2014, 6:42:50 AM4/23/14
to phon...@googlegroups.com
Are you using a Eclipse IDE or building from the command line?

Simone Manduchi

unread,
Apr 23, 2014, 7:29:36 AM4/23/14
to phon...@googlegroups.com
I'm using Eclipse

rahul

unread,
Apr 23, 2014, 11:42:11 AM4/23/14
to phon...@googlegroups.com
The www folder in the root of your project is used when you are using the CLI, so when you are using the IDEs, in this case,you have to modify the files present in platforms\android\assets\www directory. But note this, whenever you run the build or prepare command, the contents of www folder inside the assets folder gets overwritten by the contents of www folder present in the root of your project.

Simone Manduchi

unread,
Apr 23, 2014, 12:46:30 PM4/23/14
to phon...@googlegroups.com
Mmmh... Could you repeat? I've not understood at all
1) If I edit the index.html file in OSC->www given that I have the Auto Build shouldn't I export the updated apk?
2) I've edited the file in platforms\android\assets\www but when I try to export the apk I receive the following error: conversion to dalvik format failed error 1

I run Eclipse, I import the OSC project... after this what should I do?

Mobile Development

unread,
Apr 23, 2014, 1:19:00 PM4/23/14
to phon...@googlegroups.com
If you are building the app from IDE, then you have to modify the www folder present inside the platforms/android/assets directory. 
Just clean your projects and the dalvik format error will be gone. Also if your testing the app, you can also the run the project as Android application, instead of exporting the APK.

The file present in the root www folder is used only when your building and running the app from the phonegap command line.
Just remember if you build your project using the phonegap command line utility instead of IDE. The content of www directory present in the platforms\android\asssets\ folder will be overwritten by the content of root www directory.

Message has been deleted

Simone Manduchi

unread,
Apr 23, 2014, 1:50:49 PM4/23/14
to phon...@googlegroups.com
<<If you are building the app from IDE, then you have to modify the www folder present inside the platforms/android/assets directory. >>
Ok, so I'll work on that directory.

<<Just clean your projects and the dalvik format error will be gone. Also if your testing the app, you can also the run the project as Android application, instead of exporting the APK.>>
I have cleaned it but I'm still having the dalvik problem (should I disable the auto building?)

Moreover if I run the simulator (http://www.hosting.universalsite.org/image-dispo-22B6_5357FD59.png) I do not have my app... why? 
Reply all
Reply to author
Forward
0 new messages