CordovaActivity cannot be resolved to type in Phonegap 3.4

Hi, I am working on PhoneGap through the command line interface.

I can create a project and run the android emulator from the command line in Windows 7.

Since I imported and copied the project into my workspace in eclipse, it shows some errors in the main class, which extends CordovaActivity .

Mistake:

 "CordovaActivity cannot be resolved to a type". 

What should I do?

+7
android cordova
source share
5 answers

For those who do not want to use it from the command line, just add an external cordova-android library project to solve this problem.

Follow these steps:

1- Download Cordoba android-mail from here https://github.com/apache/cordova-android .

2- Remove the zip anywhere on your PC. Go to the frame folder.

3 Import the extracted zip folder / framework into your eclipse as an existing project, which will lead to the Cordoba project (library) in your workspace.

4- Now right click on your application project -> Properties -> Android. In the "Library" section, select "Add" and select the "Cordoba" project (library).

5 Finally add import org.apache.cordova; to use the CordovaActivity extension.

+12
source share

click on 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 source path.

+7
source share

I was able to get rid of the error by clearing the project:

From the menu: Project> Clean ...

Mac OS X 10.10, Eclipse Luna and Phonebook 3.6.0-0.21.18

+3
source share

Add the cordova jar to your project, and then in the Activity that extends CordovaActivity add this line to import cordova classes

 import org.apache.cordova.*; 
0
source share

I decided that way.

  • Download cordova-android-master
  • Extract and goto file directory
  • Open a command prompt and run the ant jar command
  • Go to the framework directory again and
  • file copy cordova-4.1.0-dev.jar
  • Add this jar file to the build cordova project path in eclipse.

This allowed me all the errors.

0
source share

All Articles