PGB Pinch Zoom plugin fails to compile with CLI-5.2.0

  • 1
  • Problem
  • Updated 4 years ago
Using PhoneGap Build, with 3.7.0, I was able to successfully use

gap:plugin name="com.kumbe.phonegap.zoom.zoomcontrol"

in the config.xml. However, after switching over to CLI-5.2.0, everything is working (after adding the new whitelistplugin)... except for pinch-zoom.

Here's the list of plugins I am using:

"com.kumbe.phonegap.zoom.zoomcontrol@0..." for android
"com.indigoway.cordova.whitelist.White..." for android
"org.apache.cordova.file@1.3.3" for android
"org.apache.cordova.camera@0.3.6" for android
"org.apache.cordova.geolocation@0.3.12" for android

and here's the tail end of the PhoneGap Build logfile... (note: everything up to this point looks good...)
----------------------------
-compile:
[javac] Compiling 20 source files to /project/bin/classes
[javac] /project/src/com/kumbe/phonegap/zoom/ZoomControl/ZoomControl.java:22: error: incompatible types
[javac] final WebView webView = this.webView;
[javac] ^
[javac] required: WebView
[javac] found: CordovaWebView
[javac] /project/src/com/kumbe/phonegap/zoom/ZoomControl/ZoomControl.java:51: error: incompatible types
[javac] final WebView webView = this.webView;
[javac] ^
[javac] required: WebView
[javac] found: CordovaWebView
[javac] /project/src/com/kumbe/phonegap/zoom/ZoomControl/ZoomControl.java:69: error: incompatible types
[javac] final WebView webView = this.webView;
[javac] ^
[javac] required: WebView
[javac] found: CordovaWebView
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: /project/src/org/apache/cordova/file/ContentFilesystem.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 3 errors

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

Total time: 5 seconds

/project/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: ant with args: debug,-f,/project/build.xml
----------------------------

I don't have a local SDK set up to build from sources, so I am relying upon the online PhoneGap Build plugin library for ready-to-use solutions. As noted above, this plugin DID compile (and function in the app) when using 3.7.0, but NOT with CLI-5.2.0.

I've commented out this plugin for now, so that I can continue development using CLI-5.2.0 on PhoneGap Build. But I miss pinch zooming my app... and sometimes I really need to zoom in to see tiny fonts with my old eyes!

Please advise.

much thanks in advance,

-e
Photo of Eric Shulman

Eric Shulman

  • 2 Posts
  • 0 Reply Likes

Posted 4 years ago

  • 1
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Do you really need a plugin for that? Can't you set the 'meta viewport' element to "user-scalable=yes"?
Photo of Eric Shulman

Eric Shulman

  • 2 Posts
  • 0 Reply Likes
While the meta viewport definition is required for pinch zoom, it is apparently *not enough*... at least... when using PhoneGap Build.

I am already defining the meta viewport element in the head of my document:

<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, minimum-scale=1, maximum-scale=8, user-scalable=1">

(I also tried with user-scalable="yes"... either seems acceptable)

However, in order to get the pinch zoom to actually function in the app, I need to invoke three functions to initialize the interface, in addition to the viewport configuration above.

Using the API provided by the PinchZoom plugin, I do the following

cordova.plugins.ZoomControl.ZoomControl("true");
// enabling built in zoom control
cordova.plugins.ZoomControl.setBuiltInZoomControls("true");
// enabling display zoom control
cordova.plugins.ZoomControl.setDisplayZoomControls("true");

As I understand it, PhoneGap Build doesn't make these functions available by default, so the plugin is needed to wrap these functions and provide access.

The problem is that the plugin fails to compile. To work around this, I've commented out the plugin in the config.xml and the corresponding JS code in my document (since the plugin API isn't being included). I left the meta viewport definition in place, in hopes that would be sufficient... but, as noted, without the initialization functions, this doesn't actually enable pinch zoom.

If there is another way to invoke the pinchzoom init functions for a PhoneGap Build app, without needing a plugin to expose the API, that would be great!

thanks for any help,
-e
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Eric,
Have you tried cli-5.1.1
Jesse
Photo of Stephen Acosta

Stephen Acosta

  • 2 Posts
  • 0 Reply Likes
Any resolution to this topic? I need to use a pinch to zoom plugin for cli-5.2.0. What plugin should I use?
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Stephen,
Since you have zero (0) posts, it would be best if you started a new thread.
Please let us know
- is this your first hybrid app?
- are you using Desktop App?
- are you using CLI, Build, or SDK? Please do not assume the answer, please read the link.

Thanks
Jesse
Photo of Stephen Acosta

Stephen Acosta

  • 2 Posts
  • 0 Reply Likes
ok, will do.