3

I have a similar problem to this:

CordovaActivity cannot be resolved to a type in Phonegap 3.4.

Means, in the main class, CordovaActivity cannot be resolved to a type.

However, I downloaded Cordova Android Zip from here (as explained in the comments): https://github.com/apache/cordova-android.

And included cordova-2.2.0.jar from ./lib/android to my build path.

The line:

import org.apache.cordova

works fine now, but still, it does not find any class called CordovaActivity for extension.

Which I prove by:

grep -r "CordovaActivity" *

on the unpacked cordova-2.2.0.jar folder.

What is wrong here?

enter image description here


besides that, there seems to be a package problem: the main java file is located in ./src/com/testapp/test2, in line 20 it says after I call cordova -d build:

package com.testapp.test;

with a red underline, that only disappears after I add src. before com.testsapp.test2. However, that gets crushed with every time I call cordova -d build. If I correct the path in the config.xml from

<widget id="com.testapp.test2" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

to

<widget id="src.com.testapp.test2" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

I will have a new package in my package explorer: src.src.com.testapp.test2, having the same problem.

That seems really weird.

Community
  • 1
  • 1
Lokomotywa
  • 2,624
  • 8
  • 44
  • 73

2 Answers2

4

So you are using Eclipse or Android Studio to build?

Anyway, you should add the Cordova module found in platforms/android/CordivaLib as a dependency to your project.

The way to do it for Eclipse is here >> http://red-folder.blogspot.de/2014/01/cordova-330-cordovalib-and-eclipse.html.

And the way to do it in Android Studio is here >> https://stackoverflow.com/a/19188384/1371913

Community
  • 1
  • 1
dalvallana
  • 469
  • 6
  • 13
2

I found this one in the web. It helped me: http://red-folder.blogspot.de/2014/01/cordova-330-cordovalib-and-eclipse.html

Lokomotywa
  • 2,624
  • 8
  • 44
  • 73