For some reason, after going through Phonegap's non-inclusive instructions (it doesn't even mention setting up ANT, or the headaches with Ant and JDK), this doesn't work at all:
package com.HealthTrustSoftware.AndroidTemplate3;
import android.app.Activity;
import android.os.Bundle;
import org.apache.cordova.*;
public class AndroidTemplate3 extends DroidGap
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
It gives 5 errors referencing the fact that org.apache.cordova can't be resolved. I'm entirely sure what to do at this point. Please help. This is after 3 hours of trying to get the sdk working and finally being able to open a project within eclipse. After following the steps on their documentation, I am left with a wasted 3 hours unless I can figure this out.
I just ran into the same problem. Following what was written in here, I finally made it work.
After you download cordova from phonegap github page, you will find cordova-2.2.0.jar and cordova-2.2.0.js in lib/android folder. After running "./create ...", copy cordova-2.2.0.jar into your projects libs folder and cordova-2.2.0.js into your www folder. Then import the project into eclipse and it should work.
I had to go to "Project -> Properties -> Android" and select a newer SDK (I selected the latest one available on the list) and than run the "Project -> Clean" as well.
In addition to copying cordova-2.2.0.jar from the phonegapp download to the libs folder of the project I had to manually add it to the projects libraries.
Procedure: Project -> properties -> Java Build Path -> Libraries -> Add JARs... Then select the libs from the project itself
Android studio: File -> Invalidate cache / Restart. Worked for me...
I initially got around this using one of the solutions posted above: about downloading the phonegap from github and pasting in the cordova-2.2.0.jar and cordova-2.2.0.js files into the generated directories.
After fiddling around with the path and environment variables these files are already in place (project/libs/cordova-2.2.0.jar and project/assets/www/cordova-2.2.0.js) now for me after running the "create" command on command line.
I am using the ANT that came bundled with Eclipse so my PATH variable includes:
C:\Program Files\Eclipse\plugins\org.apache.ant_1.8.3.v20120321-1730\bin;
and I added an environment variable for ANT_HOME of: C:\Program Files\Eclipse\plugins\org.apache.ant_1.8.3.v20120321-1730
I tested adding \bin or removing it to both the PATH and environment variable for ANT_HOME and this was the winning combination.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With