cordova-plugin-googlemaps icon indicating copy to clipboard operation
cordova-plugin-googlemaps copied to clipboard

Compile error: cannot find symbol

Open newbananaclub opened this issue 11 years ago • 34 comments

Hi everyone,

I am building an Ionic app and tried to implement this plugin into my app. I have followed the tutorial on https://github.com/wf9a5m75/phonegap-googlemaps-plugin/wiki/Tutorial-for-Mac and it works great on iOS. However when I try to compile and run on Android, I get the following error: screen shot 2015-04-26 at 10 20 24

I googled the problem and didn't have any progress, I tried the following steps and still no luck:

cordova plugim rm plugin.google.maps
cordova plugin rm com.google.playservices
cordova plugin add https://github.com/wf9a5m75/google-play-services#v23
cordova plugin add plugin.google.maps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"

Here is my list of plugins:

com.google.playservices 23.0.0 "Google Play Services for Android"
com.googlemaps.ios 1.9.2 "Google Map iOS SDK for Cordova"
com.ionic.keyboard 1.0.4 "Keyboard"
org.apache.cordova.console 0.2.13 "Console"
org.apache.cordova.device 0.3.0 "Device"
plugin.google.maps 1.2.5 "phonegap-googlemaps-plugin"
plugin.http.request 1.0.4 "phonegap-http-request"

Any help is much appreciated!

newbananaclub avatar Apr 26 '15 02:04 newbananaclub

Did you install cordova 4.0? I think it is not compatible yet

hirbod avatar Apr 26 '15 02:04 hirbod

Hi Hirbod,

Thanks for the prompt reply!

I just checked and I am using Cordova 5.0, does that mean I will have to wait for the plugin to update?

Thanks!

(I have multiple github accounts if it's causing any confusion)

colloquet avatar Apr 26 '15 02:04 colloquet

Yes, as far as I know, the plugin does not work on the Cordova android 4.0 platform

hirbod avatar Apr 26 '15 03:04 hirbod

Right, Thanks very much!

colloquet avatar Apr 26 '15 03:04 colloquet

I had this error but it is fixed on the test branch. To use it you need to run these commands:

cordova plugin rm plugin.google.maps
cordova plugin add https://github.com/wf9a5m75/phonegap-googlemaps-plugin@test --variable API_KEY_FOR_ANDROID="<put your API key in here>"

jskrzypek avatar Apr 26 '15 11:04 jskrzypek

Never mind about that, it built successfully only because it wasn't actually grabbing the plugin since I was using @test instead of #test. I'm getting the same error.

jskrzypek avatar Apr 26 '15 11:04 jskrzypek

Guess we will have to wait until it updates :(

Sent from my iPhone

On 26 Apr 2015, at 19:41, Joshua Skrzypek [email protected] wrote:

Never mind about that, it built successfully only because it wasn't actually grabbing the plugin since I was using @test instead of #test. I'm getting the same error.

— Reply to this email directly or view it on GitHub.

newbananaclub avatar Apr 26 '15 12:04 newbananaclub

Yup. I tried digging into the native code, definitely not my bailiwick, but that was a headache and a half and went nowhere. My suggesstion is if you need this plugin stick to cordova 4.x for now

@wf9a5m75 do you have any idea of when this might be available to use for cordova 5.0.0? Thanks!

jskrzypek avatar Apr 26 '15 17:04 jskrzypek

I'm also running Cordova 5.0.0 with android project 4 and require an update ASAP.

leomylonas avatar Apr 27 '15 06:04 leomylonas

There a many changes currently, and @wf9a5m75 is very busy at the moment. We need to be patient right now till he find the time to upgrade the plugin for compatibillity

hirbod avatar Apr 27 '15 13:04 hirbod

Hey guys lets help @wf9a5m75 with the update, is an Open Source project, he doesn't need to have all the responsibility to update it.

The ScrollEvent is deprecated, see here: https://github.com/apache/cordova-android/commit/581252febc2ca8c2ecbe7077047a34aae0ab25b5

webView.getParent() maybe this help, is from AppGyver about this plugin too. https://github.com/AppGyver/steroids/issues/588 CordovaWebView in Android v4 is an implementation file, and the implementation is in CordovaWebViewImp and it doesn't extend WebView anymore so the getParent method is not available. But they are using it like: engine.getView().getParent();. engine is https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java that is working as a glue between the real WebView, the getView() method returns the webView instance.

I think that probably the other methods are the same because the WebView methods are not available anymore directly in CordovaWebView. Hope this help.

leandroz avatar Apr 27 '15 22:04 leandroz

Hey @leandroz I'm totally on board with working to make the changes you suggest. Have you opened a fork for the issue? I'm happy to help work on it though I don't have too much spare time.

I think I have working code to do the job the ScrollEvent was doing, though maybe if we don't actually have a webView in CordovaWebView, ViewTreeObserver might not work correctly...

Basically it's like this:

    final ViewTreeObserver.OnScrollChangedListener scrollListener = new ViewTreeObserver.OnScrollChangedListener() {
      // @Override
      public void onScrollChanged(int l, int t, int oldl, int oldt) {

        if (mPluginLayout != null) {
          mPluginLayout.scrollTo(oldl, oldt);
          if (mapDivLayoutJSON != null) {
            try {
              float divW = contentToView(mapDivLayoutJSON.getLong("width"));
              float divH = contentToView(mapDivLayoutJSON.getLong("height"));
              float divLeft = contentToView(mapDivLayoutJSON.getLong("left"));
              float divTop = contentToView(mapDivLayoutJSON.getLong("top"));

              mPluginLayout.setDrawingRect(
                  divLeft,
                  divTop - oldt, 
                  divLeft + divW, 
                  divTop + divH - oldt);
            } catch (JSONException e) {
              e.printStackTrace();
            }
          }
        }
      }
    };

Also I couldn't figure out where to stick that piece of code...

jskrzypek avatar Apr 29 '15 16:04 jskrzypek

Hello to everybody, I've the same issue. I have few questions: How can I downgrade to Apache Cordova 4.x? I'm using Ionic framework, are they incompatibilities to do the downgrade? Are there future plans to upgrade this plugin?

Thanks in advance, sorry to bother you.

Davide95 avatar May 06 '15 14:05 Davide95

Hi @Davide95, downgrading is very simple using npm. Simply run the command in your shell:

npm install -g [email protected]

Then if you have projects that have been upgraded to use [email protected]—the new, as-yet-incompatible android version—navigate to their root project directories where the www is located and run

cordova platform update [email protected]

jskrzypek avatar May 10 '15 12:05 jskrzypek

Hi everyone, has there been any progress on updating this issue for cordova 5.0.0 ? Thanks

teuteuguy avatar May 18 '15 07:05 teuteuguy

Hi, there is this but I've never tried it Let me know if it works :)

Davide95 avatar May 18 '15 13:05 Davide95

Hi Davide95,

Yup, it works. I manage to build the app, and run it on Android.

I cannot say if there are any side-effects because this is the first time we are running this on Android, and also we are still in the testing phase of using this plugin.

For now, I'll simply state that it works.

What would be the next steps for getting this merged ?

Thanks

teuteuguy avatar May 19 '15 02:05 teuteuguy

Downgraded :( +1 for this issue

dortzur avatar May 20 '15 07:05 dortzur

The problem appears only when it is built for android? Or iOs has the same problem?

Davide95 avatar May 25 '15 17:05 Davide95

Android when bumped to version 4.0 iOS doesn't have this but they didn't bump to version 4.0 yet.

dortzur avatar May 25 '15 17:05 dortzur