Monday, January 9, 2012

"Project has no default.properties file! Edit the project properties to set one."error on adding existing phonegap project into workspace

I was facing the this issue  when i tried to add an existing Phonegap project into another workspace.
Reason:
Android Tools automatically generate the file default.properties which tells about target API level.
But when the project is added into the another workspace this file does not gets created.
Resolution:
Create a properties file default.properties directly under the Phonegap project directory.
Mention the target API level in it.
(ex: If the target API that you want to use is 8,then add the following code in the default.properties file)
 target=android-8

Tuesday, January 3, 2012

How to resolve Conversion to Dalvik format failed with error 1 in Phonegap project?



Project shows this error because the phonegap jar (phonegap-1.0.0rc2.jar) /any other jar  file is not stored in the proper folder in the project setup.
I have created a Lib folder under src folder and placed the phonegap  jar into it and added the jar to buildpath which resulted in the error.


Resolution:
1) Remove the Phonegap jar/any other jar from the build path.
In the eclipse select project -> Properties ->Java Build Path.Select the tab libraries.Then select the phonegap jar and remove it.
2) Add the lib folder directly under the project(i.e not under any folders in project) and
 place the phonegap jar under it. Add the phonegap jar  to build path.
Then Clean and build the project.



Sample Exception stracktrace
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/phonegap/AccelListener;
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at com.android.dx.command.dexer.Main.processClass(Main.java:486)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at com.android.dx.command.dexer.Main.access$400(Main.java:67)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at com.android.dx.command.dexer.Main.processOne(Main.java:418)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at com.android.dx.command.dexer.Main.run(Main.java:206)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at java.lang.reflect.Method.invoke(Unknown Source)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:179)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:585)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:490)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[2012-01-03 18:57:54 - MedicalSalesManApplication] Dx 1 error; aborting
[2012-01-03 18:57:54 - MedicalSalesManApplication] Conversion to Dalvik format failed with error 1
[2012-01-03 18:58:45 - MedicalSalesManApplication] Dx

Resolve "Target runtime Apache Tomcat v6.0 is not defined." error

Go to window ->preferences ->Server->Runtime environments . add server Apache Tomcat v6.0 Mention the directory where apache-toma...