Hi I am working on PhoneGap
through a command line interface.
I am able to create a project, and run an android emulator from the command prompt in Windows 7.
Since I imported and copied the project into my workspace in eclipse, it is showing some errors in the main class which extends CordovaActivity
.
The error is:
"CordovaActivity cannot be resolved to a type".
What should I do?
For those who don't want to use it from command line just add an external library cordova-android project to resolve this issue.
Follow these steps:
1- Download Cordova android zip from here https://github.com/apache/cordova-android.
2- Extract zip anywhere on your PC. Go inside framework folder.
3- Import this extracted zip folder/framework in your eclipse as an existing project which will result in Cordova project(library) in your workspace.
4- Now right click on your app project -> Properties -> Android. In the Library section choose 'Add' and select Cordova project(library).
5- Finally add import org.apache.cordova; to use extend CordovaActivity.
click the project and select Properties -> Java Build Path -> Source and Add Folder to include the CordovaLib\src folder.
(or)
if you have appname-CordovaLib as an existing project; You can add it to the sourcepath.
I was able to get rid of the error by cleaning the project:
From the menu: Project > Clean...
Mac OS X 10.10, Eclipse Luna, and phonegap 3.6.0-0.21.18
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