Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin is not defined when the app is built on PhoneGap Build #411

Closed
svarc opened this issue Feb 21, 2015 · 46 comments
Closed

Plugin is not defined when the app is built on PhoneGap Build #411

svarc opened this issue Feb 21, 2015 · 46 comments

Comments

@svarc
Copy link

svarc commented Feb 21, 2015

Hello there.
I have seen many issues reported for this same problem but none of them solves or suits the issue i encounter.

I installed the plugin automatically and when i type "phonegap plugin list" i get this result:
android.support.v4 21.0.1 "Android Support v4"
com.google.playservices 21.0.0 "Google Play Services for Android"
plugin.google.maps 1.2.4 "phonegap-googlemaps-plugin"
plugin.http.request 1.0.0 "phonegap-http-request"

This is how i call the map:
var map;
var div = document.getElementById("map_canvas");
map = plugin.google.maps.Map.getMap(div);

I get this error:
ReferenceError: plugin is not defined
map = plugin.google.maps.Map.getMap(div);

The app is compiling without error, the map div (map_canvas) is shown but the map is blank no buttons no nothing.
Anyone have any idea about how to fix this?
Thanks in advance and best wishes.

@wf9a5m75
Copy link
Member

Do you use Android phone or emulator?
And does it have Google Play Services?

@svarc
Copy link
Author

svarc commented Feb 21, 2015

i am using android 4.4.2 phone (Lenovo S820) yes it have google play services.

@wf9a5m75
Copy link
Member

Ok, is there any error message in logcat?

@wf9a5m75
Copy link
Member

Could you show me the whole logcat log?

@svarc
Copy link
Author

svarc commented Feb 21, 2015

"adb logcat" gives me result:
'abd' is not recognized as an internal or external command, operable program or batch file.

i have android platform-tools and tools added in Environment Variables but...
i am new to android development so i dont know how to handle this. sorry for being pain in the a**.
i am using windows 7

@wf9a5m75
Copy link
Member

@svarc
Copy link
Author

svarc commented Feb 21, 2015

thanks for the reply, its too late here i will have to read and research tomorrow.
i will let you know what i will find out. thanks for the fast response.

@svarc
Copy link
Author

svarc commented Feb 22, 2015

ok finally i managed to get the log.
for those who run into the same problem here is how to get the log:
first of all go to (on your phone) settings -> developer options and check USB debugging and Stay awake.
connect the USB cable from the PC to your phone and in the phone select connect as usb device and click enable usb.
go to "Android\android-sdk\platform-tools" in command prompt where your Android SDK is installed and execute this command "adb devices" the result of the command should be something like
List of devices attached
0123456789ABCDEF device
if instead "device" it says "offline" then you should disconnect and reconnect your phone.
if there is no device displayed then you done something wrong with the settings.
next go to "Android\android-sdk\tools" and start "ddms.bat" which will start Dalvik Debug Monitor.
next go to your project folder thru command prompt and execute this command:
phonegap run android --device
the application will be started on your phone and the log messages will start showing in the Dalvik Debug Monitor, you can then easy save the log messages to file from there.

ok now back to the issue, here is my log file (i will work on my filtering skills next, so sorry for the long log): http://www.fun-kids-games.biz/test/log.txt

@wf9a5m75
Copy link
Member

Thanks, @svarc
I checked your log, but it seems it doesn't have any related messages from plugin, that's really weird.
Please send me your apk file to my email address : wf9a5m75@gmail.com

@svarc
Copy link
Author

svarc commented Feb 22, 2015

ok i will send you the apk and the whole source of my project. will reach you in few seconds.
thanks for your help.

@wf9a5m75
Copy link
Member

@svarc
This plugin does not support PhoneGap Build, yet.

@svarc
Copy link
Author

svarc commented Feb 22, 2015

oh well :( then i wasted few days for nothing it seems.
thanks for your help, i really appreciate that. i am really sorry for taking your time.
thanks again and best wishes.

@wf9a5m75
Copy link
Member

Sorry, I'm planing to support Phonegap Build, but I don't have enough time for it currently.

@MichaelGooden
Copy link

Sorry to interrupt, but I use this plugin with Phonegap Build just fine :)

In my config.xml:

  <gap:plugin name="plugin.google.maps" source="plugins.cordova.io" version="~1.2.4">
    <param name="API_KEY_FOR_ANDROID" value="xyz" />
    <param name="API_KEY_FOR_IOS" value="123" />
  </gap:plugin>

Works on both Android and iOS. :)

@wf9a5m75 wf9a5m75 reopened this Feb 23, 2015
@wf9a5m75
Copy link
Member

Thanks good information, @MichaelGooden
I haven't tested PhoneGap Build yet.
Would you write a tutorial page for PhoneGap Build?

@wf9a5m75
Copy link
Member

@wf9a5m75 wf9a5m75 changed the title Plugin is not defined Plugin is not defined when the app is built on PhoneGap Build Feb 23, 2015
@Axel-CH
Copy link

Axel-CH commented Feb 26, 2015

Hello, I am trying to integrate the module in my application but I have exactly the same problem as @svarc .(ReferenceError: plugin is not defined). So I have two questions.
-I Have read previously that the module is not yet compatible with "phonegap build". How should I build my application to obtain an apk?
-I Tried configuring config.xml, as indicated by @MichaelGooden but it still does not work. Apparently the same problem.
Thank you in advance.

@MichaelGooden
Copy link

Please view your app on PhoneGap Build, and go to the "Plugins" tab on your app (Next to "Builds" tab). Do you see plugin.google.maps under the "Installed Plugins" header?

@Axel-CH
Copy link

Axel-CH commented Feb 26, 2015

Hi thank you for your response,
-I'm sorry but i'm a little bit confused when you talk about "PhoneGap Build". Usually i use the command line in order to build my app with this command "phonegap build android" . So, when you talk about PhoneGap Build, it is a reference to "Adobe® PhoneGap™ Build cloud service".
-When i lanch "phonegap plugin list" in my console i see this list:

android.support.v4 21.0.1 "Android Support v4"
com.google.playservices 21.0.0 "Google Play Services for Android"
com.phonegap.plugins.PushPlugin 2.4.0 "PushPlugin"
com.plugin.datepicker 0.4.0 "DatePicker"
org.apache.cordova.device 0.2.13-dev "Device"
org.apache.cordova.file 1.3.2-dev "File"
org.apache.cordova.file-transfer 0.4.6 "File Transfer"
org.apache.cordova.geolocation 0.3.12 "Geolocation"
org.apache.cordova.network-information 0.2.12 "Network Information"
plugin.google.maps 1.2.4 "phonegap-googlemaps-plugin"
plugin.http.request 1.0.4 "phonegap-http-request"

So, i the google map plugin are in the list , i hope that i responded to your question.
Thank you

@MichaelGooden
Copy link

Yes, I was referring to the "Adobe® PhoneGap™ Build cloud service". This issue is also specifically about that. If you use my code in your config.xml it will only work if you are using the PhoneGap Build service.

This issue will not resolve your problems. Follow all the instructions in the wiki, and if you are still having problems open a new issue :)

@Axel-CH
Copy link

Axel-CH commented Feb 26, 2015

Thank you very much ;-) i'll try tomorow.

@wf9a5m75
Copy link
Member

@MichaelGooden 👍

@svarc
Copy link
Author

svarc commented Feb 26, 2015

Thanks @MichaelGooden and @wf9a5m75 for your help. i still havent tried what you said but i will do it in the next few days and post the results here.
@Axel-CH i found out something which might help in some way. when building your app use this command: phonegap -d build android > build.log
this will save all the build messages to a file "build.log" (which might be useful for debugging)in the same path from where you execute the command. same works for cordova too you just need to replace phonegap with cordova in the command.

@Axel-CH
Copy link

Axel-CH commented Feb 26, 2015

Hi, finally the map is working ^^ . I had a SHA1 key mismatch. this link helped me : https://developers.google.com/games/services/android/troubleshooting
(now i have a css issue with my framework, so i'll chek the forum for similar issue)
Thank you guys ! @MichaelGooden @sangariv @svarc

@wf9a5m75
Copy link
Member

wf9a5m75 commented Mar 1, 2015

Congrats, @Axel-CH

@svarc Have you tested ?

@wf9a5m75
Copy link
Member

wf9a5m75 commented Mar 8, 2015

I close this issue at once.
If @svarc has any updates, please just post here. I will open this issue again.

@paganm
Copy link

paganm commented May 26, 2015

I had problem with Phonegap Build Service. I used the solution as @MichaelGooden metioned above. Android apk was running perfect but in ios i received the message "Api key is not setted. Please replace 'API_KEY_FOR_IOS' in the platforms/ios/.../...Info.plist with your API key."

For some reason, API_KEY_FOR_IOS value was ignored.

I used the solution

<gap:config-file platform="ios" parent="Google Maps API Key" mode="replace">      
    <string>xxx</string>
</gap:config-file>

https://stackoverflow.com/questions/30435391/plugin-plugin-google-maps-using-phonegap-build-service-doesnt-work-on-ios

@Menusito
Copy link

hello, good day, im trying to implement this plugin on my phonegap build app but when I put the follow code the compiler fails:

<gap:plugin name="plugin.google.maps" source="plugins.cordova.io" version="1.2.4">
    <param name="API_KEY_FOR_ANDROID" value="here-my-api-key" />
</gap:plugin>

and the compiler display this:
http://coderbeat.com/uploads/log

any documentation how to use on phonegap build or has an example?

@paganm
Copy link

paganm commented Jun 26, 2015

Can you try the latest version 1.2.5 first?

@Menusito
Copy link

hi, i detect the problem, this plugin is not working with the last version of "Phonegap Build" cli-5.1.1 Android 4.0.2, if I use the old version 3.7 compile OK. I dont know if is a bug of cloud service or of the plugin.

@paganm
Copy link

paganm commented Jun 26, 2015

#516

@Menusito
Copy link

thank you! working good with @Nipher version.

@prasoon0304
Copy link

i have used the plugin and tried to build through Phonegap build.Map is just displayed as GREY area .
in config file i have given under param name the value of android and ios. but it shows grey. why does it shows like that?

@Leomhl
Copy link

Leomhl commented Jul 7, 2015

The plugin works only with wifi. How to use with 3G?

@prasoon0304
Copy link

It works with all network.2G,3G,Wifi. You need to give permission to access
your network.

On Tue, Jul 7, 2015 at 8:41 AM, Leomhl notifications@github.com wrote:

The plugin works only with wifi. How to use with 3G?


Reply to this email directly or view it on GitHub
#411 (comment)
.

Thanks and Regards,

Prasoon P

@Leomhl
Copy link

Leomhl commented Jul 7, 2015

How? It does not work without wi fi. With 3G turned it asks to enable wi fi.

@erasmo-marin
Copy link

@007pRASoon did you solve this?
I have this problem, and sometimes it works if I open an app with geolocation permissions first (ie waze), so, I think it's a problem with the plugin activating geolocation.

I added this to config.xml with no success:

<feature name="http://api.phonegap.com/1.0/geolocation"/>

pd: I'm using phonegap build service

@grtapps
Copy link

grtapps commented Sep 11, 2015

@erasmo-marin the url in the name attribute isn't even working though.

If you're using the phonegap build cloud services, use it this way.

<gap:plugin name="org.apache.cordova.geolocation" version="0.3.10" />

@davidluthiers
Copy link

@MichaelGooden your solution doesn't work anymore, plugins.cordova.io just got deprecated and can't be used.

I tried any other combination, from the one PhonegapBuild offers in his Plugin page (why it's still there? It doesn't load!) to the ones on the npm and the most promising seems this one: https://www.npmjs.com/package/cordova-plugin-googlemaps , that would translate into this on config.xml:

plugin name="plugin.google.maps" source="plugins.cordova.io" version="~1.2.4

But this plugin on npmjs doesn't seem to have any version below 1.3.0 and the ones above require some gradle configuration which I couldn't set properly (the prefence called "android-minSdkVersion" doesn't do anything), probably requires an AndroidManifest tweak.

I'm really puzzled about the state of this, isn't anyone using google map on phonegap build?

@lengoyvaerts
Copy link

I tried installing it with Phonegap Build today and got the following error:

<gap:plugin name="cordova-plugin-googlemaps" source="npm">
    <param name="API_KEY_FOR_ANDROID" value="XXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
    <param name="API_KEY_FOR_IOS" value="XXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
</gap:plugin>

untitled

This is the page the error links to but I don't see anything to fix it:
http://docs.build.phonegap.com/en_US/support_failed-builds.md.html#gradle_required

Adding preference name="android-build-tool" value="gradle" gave the following error (although shouldn't be required because from cli-5.1.1 onwards, gradle should be the default build):
untitled

@MilestoneCMS
Copy link

@lengoyvaerts I have no problem with "Oh geez. Your build failed ...". In my case, the building process works.
Fortunately PhoneGap Build resolved the issue:
https://twitter.com/PhoneGapBuild/status/649051981936365568

@davidluthiers
Copy link

@MilestoneCMS Yes, I found that gradle solution today on Twitter too :D but my problem is that I have to use a cordova version below 4, because of Drupalgap requiring it, so I can't use the last plugin with the gradle fix. I also found a previous version of the same plugin (forked) so it could work with Phonegap 3.7.0, but then I have the "Oh geez". If anyone is interested I opened a thread in the Phonegap forum:
http://community.phonegap.com/nitobi/topics/cant-build-with-google-maps-plugin

@joaoibsilva
Copy link

Hello
When building with PGB cli 5.2 using this plugin:
gap:plugin name="cordova-plugin-googlemaps" source="npm" version="1.3.4"
param name="API_KEY_FOR_ANDROID" value="My key"
param name="API_KEY_FOR_IOS" value="My other key"
gap:plugin
i get the following error
erro1
I have checked and the most updated version of this plugin is 1.3.4
Any thoughts would be much appreciatted.

@trknov
Copy link

trknov commented Jan 8, 2016

image

@mogiman
Copy link

mogiman commented Jan 17, 2016

Hi, I am using the phonegap google map plugin that you have mentioned, I use the online phonegap to build my apk

Just wondering where My config.xml should sit, in the root directory, res/xml/config.xml, www/config.xml, or root directory.

where should My index.xml sit in the root directory or www/index.html or root directory where .cordova.CORDOVA file should sit, I have in the same directory as my index.html,

and where the following files should sit. I have them in my root directory.

- AndroidManifest.xml
- package.json
- plugin.xml

also if I could get a copy of someone's index.html for code for the google maps plugin

At the moment I am getting a blank screen, but the google logo appears in the lower left hand corner.
The only reason why I get the blank google screen with the logo even showing is because I have

< script type="text/javascript" src="cordova.js">< /script>

in my index.html and the ".corodva.CORDOVA" file sitting in the same directory which is the www directory.

If I dont have this line of code I dont even get a blank google map screen, nothing appears at all

If I could get some answers on this from someone who has the plugin working that would be great.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests