MobileChromeApps / chrome-app-developer-tool

Mirror of Apache Cordova app harness
Other
202 stars 33 forks source link

Cordova build error on FileTransfer plugin #28

Open FreakTheMighty opened 10 years ago

FreakTheMighty commented 10 years ago

I'm trying to build the CADT from source.

./createproject.sh ChromeAppDevTool
cd ChromeAppDevTools
cordova build android

The build fails while compiling the file transfer plugin. Removing the plugin allows the build to complete, but not surprisingly prevents CADT from running properly.

BUILD FAILED
/adt-bundle/sdk/tools/ant/build.xml:720: The following error occurred while executing this line:/adt-bundle/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

 Total time: 4 seconds

 /private/tmp/chrome-app-developer- tool/ChromeAppDevTool/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
 Error code 1 for command: ant with args: debug,-f,/private/tmp/chrome-app-developer- tool/ChromeAppDevTool/platforms/android/build.xml,-Dsdk.dir=/adt-bundle/sdk
 Error: /tmp/chrome-app-developer-tool/ChromeAppDevTool/platforms/android/cordova/run: Command  failed with exit code 8
     at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova- lib/src/cordova/superspawn.js:131:23) 
     at ChildProcess.emit (events.js:98:17)
     at maybeClose (child_process.js:755:16)
     at Process.ChildProcess._handle.onexit (child_process.js:822:5)
FreakTheMighty commented 10 years ago

Adding the actual traceback:

-compile:
    [javac] Compiling 6 source files to /private/tmp/chrome-app-developer-tool/ChromeAppDevTool/platforms/android/bin/classes
    [javac] /private/tmp/chrome-app-developer-tool/ChromeAppDevTool/platforms/android/src/org/apache/cordova/filetransfer/FileTransfer.java:798: cannot find symbol
    [javac] symbol  : variable pluginManager
    [javac] location: interface org.apache.cordova.CordovaWebView
    [javac]                     FileUtils filePlugin = (FileUtils)webView.pluginManager.getPlugin("File");
    [javac]                                                              ^
    [javac] Note: /private/tmp/chrome-app-developer-tool/ChromeAppDevTool/platforms/android/src/org/apache/cordova/filetransfer/FileTransfer.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] 1 error
FreakTheMighty commented 10 years ago

I removed the the org.apache.cordova.file-transfer and org.apache.cordova.media-capture then reinstalled them from their respective apache git repos. This allowed me to compile successfully, but resulted in this error upon launch of CADT.

Uncaught Error: Error calling method on NPObject. cordova.js:924 androidExec cordova.js:924 module.exports.bootstrap cordova.js:1469 (anonymous function) cordova.js:1218 build cordova.js:53 require cordova.js:68 (anonymous function) cordova.js:1877 (anonymous function)

clelland commented 10 years ago

Sorry to hear that this has given you so much grief. This sounds like it's all related to the Android 4.0.x branch of Cordova, which we're now using in CADT (but which I don't see mentioned at all in the docs.)

Can you try to clone cordova-android from the source repo, and check out the 4.0.x branch? When you run createproject.sh, you'll need to specify that you want cordova-android from a specific location, like this:

export ANDROID_PATH=<path-to-cordova-android>
export PLUGIN_SEARCH_PATH=<path-to-cordova-plugins>
export PLATFORMS=android
./createproject.sh ChromeAppDevTool

That's what I've been using to compile it; hopefully it works for you.

agrieve commented 10 years ago

If you're using the latest version of the createproject.sh script, ANDROID_PATH doesn't do anything anymore. It instead uses the copy of cordova-android from within node_modules/cca/cordova/cordova-android.

I think more likely the plugin problem is due to the published version of file-transfer plugin being incompatible, and instead needing the version from master. To get this, clone the file-transfer repo, and use export PLUGIN_SEARCH_PATH=<path-to-file-cloned-plugin> to tell the script where to find it.

clelland commented 10 years ago

Well, this is what happens when I go away for a week ;)

The JS error:

Uncaught Error: Error calling method on NPObject. cordova.js:924

is something that I've seen when using a version of Cordova-JS that is incompatible with Cordova-Android, since we dropped the location-change bridge mode, I think. Does our node_modules version of Cordova-Android include the correct JS snapshot?

agrieve commented 10 years ago

Certainly hope so! It's what we're using for CCA itself.

On Wed, Aug 6, 2014 at 11:36 AM, Ian Clelland notifications@github.com wrote:

Well, this is what happens when I go away for a week ;)

The JS error:

Uncaught Error: Error calling method on NPObject. cordova.js:924

is something that I've seen when using a version of Cordova-JS that is incompatible with Cordova-Android, since we dropped the location-change bridge mode, I think. Does our node_modules version of Cordova-Android include the correct JS snapshot?

— Reply to this email directly or view it on GitHub https://github.com/MobileChromeApps/chrome-app-developer-tool/issues/28#issuecomment-51352148 .

mmocny commented 10 years ago

Is the issue here that you have to have an npm linked version of cca in chrome-app-developer-tool?

With the release of 0.3.0 late friday, perhaps the issues goes away if you re-run npm install?

mmocny commented 10 years ago

Just downgraded to cca 0.2.2 and fails to build for android, but succeeds with 0.3.0.

It didn't look like the same error, but I haven't been digging into it.

FreakTheMighty commented 10 years ago

I'm not sure if the npm install resolved to different versions this time, but like @mmocny said, with cca 0.3.0 the build completed without any changes to the installed plugins.

Unfortunately I'm still getting the error:

Uncaught Error: Error calling method on NPObject

This is the same state that I found after manually installing the master branches of the media-capture and file-transfer plugins.

mmocny commented 10 years ago

Just to be 100% sure, did you remove the old version of the plugin before installing from repo?

Earlier this week I attempted to "upgrade" a plugin in-place (cca plugin add foo when foo was already installed). Since this isn't currently supported by cordova-cli, it failed -- but annoyingly the version number in cca plugin ls was bumped up to the version I attempted to install. Probably some metadata was updated and not rolled back when the install failed.

So, its a long shot, but may you please confirm that the content of the plugin actually matches the latest version?

Thanks!

FreakTheMighty commented 10 years ago

I did do the remove before adding, but that was on a previous attempt. This time I didn't need to install from master to get it to compile.

I can try again, double check, and report back.

Out of curiosity, does anyone have a working build? If so, it would be helpful if you posted the apk. On Aug 7, 2014 4:17 AM, "Michal Mocny" notifications@github.com wrote:

Just to be 100% sure, did you remove the old version of the plugin before installing from repo?

Earlier this week I attempted to "upgrade" a plugin in-place (cca plugin add foo when foo was already installed). Since this isn't currently supported by cordova-cli, it failed -- but annoyingly the version number in cca plugin ls was bumped up to the version I attempted to install. Probably some metadata was updated and not rolled back when the install failed.

So, its a long shot, but may you please confirm that the content of the plugin actually matches the latest version?

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/MobileChromeApps/chrome-app-developer-tool/issues/28#issuecomment-51458978 .

agrieve commented 10 years ago

I played around with this today. The problem is that the plugins used by default are too old. This should be fixed in the next few days as there is a cordova plugin release going on right now.

There are pre-built APKs here: https://github.com/MobileChromeApps/chrome-app-developer-tool/releases

FreakTheMighty commented 10 years ago

The latest APK doesn't have the plugins that I need. I'll just have to wait until the next release.

On Thu, Aug 7, 2014 at 12:27 PM, agrieve notifications@github.com wrote:

I played around with this today. The problem is that the plugins used by default are too old. This should be fixed in the next few days as there is a cordova plugin release going on right now.

There are pre-built APKs here: https://github.com/MobileChromeApps/chrome-app-developer-tool/releases

— Reply to this email directly or view it on GitHub https://github.com/MobileChromeApps/chrome-app-developer-tool/issues/28#issuecomment-51519680 .

Jesse Vander Does 401-226-8251 | jvanderdoes@gmail.com

ghost commented 10 years ago

Now, building CADT from Source works, however, still I have the error in the Chrome Dev Console:

Uncaught Error: Error calling method on NPObject. cordova.js:924

Any ideas about what it causes? Thanks :)

ghost commented 10 years ago

This error: Uncaught Error: Error calling method on NPObject. cordova.js:924 disappeared when I deleted attaching cordova.js: <script src="cordova.js"></script>

felquis commented 9 years ago

I have this error too, but with all my plugins, keyboard (from Ionic), camera.

screen shot 2014-10-24 at 15 41 50 screen shot 2014-10-24 at 15 42 03

felquis commented 9 years ago

I found what is the problem.

The first problem is that GitHub search is not so good than google, site:github.com/MobileChromeApps/chrome-app-developer-tool/ NPObject

The issue (in my case) is the CCA include cordova.js automatically for me. When I add it in my project, things go wrong and any native function doesn't works.

I found it here https://github.com/MobileChromeApps/mobile-chrome-apps/issues/317 and here https://github.com/MobileChromeApps/chrome-app-developer-tool/issues/33

Thank you @mmocny :)