Apache Cordova CordovaActivity cannot be resolved
I have a similar question :
CordovaActivity cannot be resolved to a type in Phonegap 3.4 .
This means that in the main class, CordovaActivity
cannot resolve to a type.
However, I downloaded Cordova Android Zip from here (as mentioned in the review):
https://github.com/apache/cordova-android .
And included cordova-2.2.0.jar
from ./lib/android
in my build path.
Line:
import org.apache.cordova
Now works fine, but I still can’t find any class named CordovaActivity
to extend.
What I prove is:
grep -r "CordovaActivity" *
In the unzipped cordova-2.2.0.jar folder.
Is there something wrong here?
Other than that, there seems to be a package issue:
The main java file is located at ./src/com/testapp/test2
, and on line 20 it says after I called cordova -d build
:
package com.testapp.test;
With a red underline, it only disappears after I add src
. before com.testsapp.test2.
However, every time I call cordova -d build
, it crashes. If I correct the
path in 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 have a new package in my package explorer: src.src.com.testapp.test2
, having the same issue.
This looks really strange.
Solution
So are you building with Eclipse or Android Studio?
Anyway, you should add the Cordova module in platforms/android/CordivaLib
as a dependency of your project.
Eclipse’s method is here>> < a href="http://red-folder.blogspot.de/2014/01/cordova-330-cordovalib-and-eclipse.html" rel="noreferrer noopener nofollow" > http://red-folder.blogspot.de/2014/01/cordova-330-cordovalib-and-eclipse.html .