mapsplugin / cordova-plugin-googlemaps

Google Maps plugin for Cordova
Apache License 2.0
1.66k stars 913 forks source link

cca project fails to compile #302

Closed instaplacecyprus closed 8 years ago

instaplacecyprus commented 9 years ago

When adding this plugin to my project that uses cca (chrome mobile apps) it fails to compile

wf9a5m75 commented 9 years ago

CCA switches to Chromium engine from WebView. But Chromium can not change the background color as transparent. So you can not use it right now.

(I have never tested, but old CCA might work with this plugin)

wf9a5m75 commented 9 years ago

And because of CCA uses chromium, this plugin's code does not match (because this plugin aims to WebView), that's why the building was failed.

instaplacecyprus commented 9 years ago

What will it take for this to be fixed?

wf9a5m75 commented 9 years ago

Currently there is no way to fix it.

instaplacecyprus commented 9 years ago

What if placement of the map was optional? So for chromeview it would work only when placed on top but we would still have all the updates instead of using the old version

hirbod commented 9 years ago

As I can see, this bug seems to be fixed in chromium: https://codereview.chromium.org/368273008

https://code.google.com/p/chromium/issues/detail?id=391462

But I' not 100% sure.

wf9a5m75 commented 9 years ago

Nice :+1:

wf9a5m75 commented 9 years ago

Unfortunately I don't have enough knowledge to apply this patch for CrossWalk (cca uses CrossWalk internally).

I sent a message to Crosswalk project. Please join here. https://twitter.com/wf9a5m75/status/535157393731371008

wf9a5m75 commented 9 years ago

https://twitter.com/wf9a5m75/status/536953876272779264

paishin commented 9 years ago

CocoonJs released a new version of its WebView+ for Android a few days ago that was supposed to have the transparency problem resolved.

Ive tried to experiment a bit with it, the project now compiles fine but will only show a blank screen when you run it on a device. I did not add any project files, just created a new project and added the google maps plugin without altering the www folder.

wf9a5m75 commented 9 years ago

Could you show me the screen capture, @paishin ?

paishin commented 9 years ago

Sure, here is a screenshot what it shows without the plugin added:

GitHub Logo

And heres what i get once I add the google maps plugin:

GitHub Logo

wf9a5m75 commented 9 years ago

@paishin I see. I'd like to read the log of cca, but where can I read the article about "the transparency problem resolved" you mentioned?

bFlood commented 9 years ago

fwiw - it looks like the crosswalk team is beginning to work on this issue, hopefully it will get resolved soon https://crosswalk-project.org/jira/browse/XWALK-3308

bFlood commented 9 years ago

looks like its fixed in chromium/crosswalk https://github.com/crosswalk-project/crosswalk/pull/2857

wf9a5m75 commented 9 years ago

Oh, thank you for letting me know.

wf9a5m75 commented 9 years ago

Crosswalk Cordova Android(ARM) ver 10.39.235.15

$> cd crosswalk-cordova-10.39.235.15-arm
$> /bin/create ~/Desktop/issue_302 com.example.googlemap MainActivity
Running: android update lib-project --path "/Users/wf9a5m75/Downloads/crosswalk-cordova-10.39.235.15-arm/framework/xwalk_core_library" --target "android-19"
Updated project.properties
Updated local.properties
build.xml: Found version-tag: custom. File will not be updated.
Added file /Users/wf9a5m75/Downloads/crosswalk-cordova-10.39.235.15-arm/framework/xwalk_core_library/proguard-project.txt

Creating Cordova project for the Android platform:
    Path: ../../Desktop/issue_302
    Package: com.example.googlemap
    Name: MainActivity
    Android target: android-19
Copying template files...
Running: android update lib-project -p "../../Desktop/issue_302/CordovaLib" --target android-19
Project successfully created.
Updated project.properties
Updated local.properties
No project name specified, using project folder name 'CordovaLib'.
If you wish to change it, edit the first line of build.xml.
Added file ../../Desktop/issue_302/CordovaLib/build.xml
Added file ../../Desktop/issue_302/CordovaLib/proguard-project.txt

$> cd ~/Desktop/issue_302/

$> plugman install --platform android --project . --plugin https://github.com/wf9a5m75/phonegap-googlemaps-plugin#test --variable API_KEY_FOR_ANDROID=...
Fetching plugin "https://github.com/wf9a5m75/phonegap-googlemaps-plugin" via git clone
Plugin "https://github.com/wf9a5m75/phonegap-googlemaps-plugin" checked out to git ref "test".
Installing "plugin.google.maps" for android
Fetching plugin "plugin.http.request" via plugin registry
Installing "plugin.http.request" for android
Fetching plugin "https://github.com/wf9a5m75/google-play-services" via git clone
Plugin "https://github.com/wf9a5m75/google-play-services" checked out to git ref "v22".
Installing "com.google.playservices" for android
Updated local.properties
No project name specified, using project folder name 'google-play-services_lib'.
If you wish to change it, edit the first line of build.xml.
Added file /Users/wf9a5m75/Desktop/issue_302/com.google.playservices/google-play-services_lib/build.xml
Added file /Users/wf9a5m75/Desktop/issue_302/com.google.playservices/google-play-services_lib/proguard-project.txt
Fetching plugin "android.support.v4" via plugin registry
Installing "android.support.v4" for android

             In order to run this plugin, you need to obtain Google Maps API key for Android.
             Visit to https://github.com/wf9a5m75/phonegap-googlemaps-plugin/wiki/Installation

             Please confirm what this version is updated at
             https://github.com/wf9a5m75/phonegap-googlemaps-plugin/wiki/Release-Notes

$> vim src/plugin/google/maps/GoogleMaps.java
// Comment out 794 - 814
https://github.com/wf9a5m75/phonegap-googlemaps-plugin/blob/test/src/android/plugin/google/maps/GoogleMaps.java#L794-L814

$> vim assets/www/index.html 

Eclipse -> "run as Android Application"

device-2015-02-23-200340

wf9a5m75 commented 9 years ago

Crosswalk Cordova Android(ARM) ver11.40.277.1

$> cd crosswalk-cordova-11.40.277.1-arm

$> ./bin/create ~/Desktop/issue_302_v11 com.example.googlemap issue_302_v11
Running: android update lib-project --path "/Users/wf9a5m75/Downloads/crosswalk-cordova-11.40.277.1-arm/framework/xwalk_core_library" --target "android-21"
Updated project.properties
Updated local.properties
build.xml: Found version-tag: custom. File will not be updated.
Updated file /Users/wf9a5m75/Downloads/crosswalk-cordova-11.40.277.1-arm/framework/xwalk_core_library/proguard-project.txt

Creating Cordova project for the Android platform:
    Path: ../../Desktop/issue_302_v11
    Package: com.example.googlemap
    Name: issue_302_v11
    Android target: android-21
Copying template files...
Running: android update lib-project -p "../../Desktop/issue_302_v11/CordovaLib" --target android-21
Project successfully created.
Updated project.properties
Updated local.properties
No project name specified, using project folder name 'CordovaLib'.
If you wish to change it, edit the first line of build.xml.
Added file ../../Desktop/issue_302_v11/CordovaLib/build.xml
Added file ../../Desktop/issue_302_v11/CordovaLib/proguard-project.txt

$> cd ~/Desktop/issue_302_v11/

$> plugman install --platform android --project . --plugin https://github.com/wf9a5m75/phonegap-googlemaps-plugin#test --variable API_KEY_FOR_ANDROID=...
Fetching plugin "https://github.com/wf9a5m75/phonegap-googlemaps-plugin" via git clone
Plugin "https://github.com/wf9a5m75/phonegap-googlemaps-plugin" checked out to git ref "test".
Installing "plugin.google.maps" for android
Fetching plugin "plugin.http.request" via plugin registry
Installing "plugin.http.request" for android
Fetching plugin "https://github.com/wf9a5m75/google-play-services" via git clone
Plugin "https://github.com/wf9a5m75/google-play-services" checked out to git ref "v22".
Installing "com.google.playservices" for android
Updated local.properties
No project name specified, using project folder name 'google-play-services_lib'.
If you wish to change it, edit the first line of build.xml.
Added file /Users/wf9a5m75/Desktop/issue_302_v11/com.google.playservices/google-play-services_lib/build.xml
Added file /Users/wf9a5m75/Desktop/issue_302_v11/com.google.playservices/google-play-services_lib/proguard-project.txt
Fetching plugin "android.support.v4" via plugin registry
Installing "android.support.v4" for android

             In order to run this plugin, you need to obtain Google Maps API key for Android.
             Visit to https://github.com/wf9a5m75/phonegap-googlemaps-plugin/wiki/Installation

             Please confirm what this version is updated at
             https://github.com/wf9a5m75/phonegap-googlemaps-plugin/wiki/Release-Notes

$> vim src/plugin/google/maps/GoogleMaps.java
// Comment out 794 - 814
https://github.com/wf9a5m75/phonegap-googlemaps-plugin/blob/test/src/android/plugin/google/maps/GoogleMaps.java#L794-L814

$> vim assets/www/index.html 

Eclipse -> "run as Android Application"

device-2015-02-23-213023

wf9a5m75 commented 9 years ago

Crosswalk Cordova Android(ARM) ver12.40.278.0

$> cd crosswalk-cordova-12.40.278.0-arm

$> ./bin/create ~/Desktop/issue_302_v12 com.example.googlemap issue_302_v12
Running: android update lib-project --path "/Users/wf9a5m75/Downloads/crosswalk-cordova-12.40.278.0-arm/framework/xwalk_core_library" --target "android-21"
Updated project.properties
Updated local.properties
build.xml: Found version-tag: custom. File will not be updated.
Added file /Users/wf9a5m75/Downloads/crosswalk-cordova-12.40.278.0-arm/framework/xwalk_core_library/proguard-project.txt

Creating Cordova project for the Android platform:
    Path: ../../Desktop/issue_302_v12
    Package: com.example.googlemap
    Name: issue_302_v12
    Android target: android-21
Copying template files...
Running: android update lib-project -p "../../Desktop/issue_302_v12/CordovaLib" --target android-21
Project successfully created.
Updated project.properties
Updated local.properties
No project name specified, using project folder name 'CordovaLib'.
If you wish to change it, edit the first line of build.xml.
Added file ../../Desktop/issue_302_v12/CordovaLib/build.xml
Added file ../../Desktop/issue_302_v12/CordovaLib/proguard-project.txt

$> cd ~/Desktop/issue_302_v12/

$> plugman install --platform android --project . --plugin https://github.com/wf9a5m75/phonegap-googlemaps-plugin#test --variable API_KEY_FOR_ANDROID=...
Fetching plugin "https://github.com/wf9a5m75/phonegap-googlemaps-plugin" via git clone
Plugin "https://github.com/wf9a5m75/phonegap-googlemaps-plugin" checked out to git ref "test".
Installing "plugin.google.maps" for android
Fetching plugin "plugin.http.request" via plugin registry
npm http GET http://registry.cordova.io/plugin.http.request
npm http 304 http://registry.cordova.io/plugin.http.request
Installing "plugin.http.request" for android
Fetching plugin "https://github.com/wf9a5m75/google-play-services" via git clone
Plugin "https://github.com/wf9a5m75/google-play-services" checked out to git ref "v22".
Installing "com.google.playservices" for android
Fetching plugin "android.support.v4" via plugin registry
npm http GET http://registry.cordova.io/android.support.v4
npm http 304 http://registry.cordova.io/android.support.v4
Installing "android.support.v4" for android

             In order to run this plugin, you need to obtain Google Maps API key for Android.
             Visit to https://github.com/wf9a5m75/phonegap-googlemaps-plugin/wiki/Installation

             Please confirm what this version is updated at
             https://github.com/wf9a5m75/phonegap-googlemaps-plugin/wiki/Release-Notes

$> vim src/plugin/google/maps/GoogleMaps.java
// Comment out 794 - 814
https://github.com/wf9a5m75/phonegap-googlemaps-plugin/blob/test/src/android/plugin/google/maps/GoogleMaps.java#L794-L814

$> vim assets/www/index.html 

Eclipse -> "run as Android Application"

v12

wf9a5m75 commented 9 years ago

Hmm, I read the comments and logs, but I can't figure out how to set the background color as transparent.

wf9a5m75 commented 9 years ago

@bFlood Do you know how to do that?

gustavohenke commented 9 years ago

Hey @wf9a5m75, see https://github.com/crosswalk-project/crosswalk/compare/25917addda6907b9f6e4606a6ebf3ded42bcc39a...crosswalk-12

Seems like the patch has landed only in 12.41.296.1

wf9a5m75 commented 9 years ago

Ok, I will try it later.

wf9a5m75 commented 9 years ago

https://github.com/crosswalk-project/crosswalk/pull/2857#issuecomment-75902864

telemakhos commented 9 years ago

I reckon this should be working for this version already...

https://download.01.org/crosswalk/releases/crosswalk/android/canary/13.41.310.0/arm/

wf9a5m75 commented 9 years ago

I'm not sure, but it seems the crosswalk-12 branch is not merged to the master branch. screen shot 2015-02-28 at 9 34 05 am

telemakhos commented 9 years ago

Oops, I missed that, my bad... The guy from crosswalk said that we should wait for the next canary version and 2 canary releases have been launched since he told you, but it seems it hasn't been merged... we'll have to wait then.

telemakhos commented 9 years ago

@wf9a5m75 I've just double-checked and the changes are in fact already in master... =)

https://github.com/crosswalk-project/crosswalk/blob/master/runtime/android/core_internal/src/org/xwalk/core/internal/XWalkContent.java#L429-L450

So the canary release I linked should implement the patch. Could you test if the transparency fix is working?

wf9a5m75 commented 9 years ago

Thank, but I couldn't built crosswalk from github. They uses multiple repositories for crosswalk. So I've been waiting new canary version.

telemakhos commented 9 years ago

I guess this is what you need... It's the new canary version

https://download.01.org/crosswalk/releases/crosswalk/android/canary/13.41.310.0/arm/crosswalk-cordova-13.41.310.0-arm.zip

wf9a5m75 commented 9 years ago

I'm on a business trip currently. I appreciate if you test it instead of me.

JcDenton86 commented 9 years ago

Hello, Building using the canary version above, returned some errors coming from the xwalk_core_library but I managed to overcome them and build successful. I added the plugin and tried to build using the test branch and play-services 22 but I get these errors coming from the maps plugin.

[javac] Compiling 22 source files to C:\Users\admin\Desktop\project-Crosswalk\platforms\android\ant-build\classes
    [javac] C:\Users\admin\Desktop\project-Crosswalk\platforms\android\src\plugin\google\maps\GoogleMaps.java:797: error: cannot find symbol
    [javac]     this.webView.showCustomView(dummyLayout, new WebChromeClient.CustomViewCallback() {
    [javac]                 ^
    [javac]   symbol:   method showCustomView(FrameLayout,<anonymous CustomViewCallback>)
    [javac]   location: variable webView of type CordovaWebView
    [javac] Note: C:\Users\admin\Desktop\project-Crosswalk\platforms\android\src\plugin\google\maps\GoogleMaps.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: C:\Users\admin\Desktop\project-Crosswalk\platforms
\android\src\plugin\http\request\HttpRequest.java uses unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 1 error

BUILD FAILED

Did someone else try it?

telemakhos commented 9 years ago

Hi @JcDenton86, I also tested canary 13.41.310.0 against the phonegap-googlemaps-plugin#test branch (Google Play Services 22). I built it with the Ionic CLI (you've got first to modify the ionic npm package and include the latest canary builds), and it compiles perfectly, no errors... but the map wasn't showing up (blank screen). I left it at that point cos I had to move forward to other tasks but I'll get back to this issue towards the end of the week.

JcDenton86 commented 9 years ago

Unfortunately I am not using Ionic but Onsen UI. I' ll check it again though.

wf9a5m75 commented 9 years ago

Regarding of this graph, I think crosswalk-12 is not merged into crosswalk-13 (master branch).

telemakhos commented 9 years ago

Look at the file XWalkContent.java in crosswalk-12 and the same file in master. They're the same, both include the patch... at least here in GitHub. If they're building the canary releases from another source, then I don't know. But the changes are certainly in both branches. Maybe the commit has been cherry-pick'ed and not merged and that's why the branch doesn't show as "merged" in that graph?

wf9a5m75 commented 9 years ago

I don't have enough time to test for this issue, I appreciate if you help. I think you just need to modify the pluginInitialize in GoogleMaps.java if the crosswalk supports the background transparent correctly.

JcDenton86 commented 9 years ago

I built successful the app and works much better, but I get blank map (black screen) when the map is loaded. That was happening before when I first used this plugin and the cause had to do with the transparency I think. I could solve it by inspecting the app in chrome. Now I can not inspect, because the version of chromium(37) is older than the one in crosswalk (41).. Is there any way to inspect the app when using crosswalk? Ok yesterday chrome did not update, today did..

JcDenton86 commented 9 years ago

In the inspection I see that all of my DOM elements are getting transparent (divs and pages background) so I believe the black screen is crosswalk that is not getting transparent..

paishin commented 9 years ago

That is the same problem i used to have in older versions of the plugin before it started crushing on compilation. I believe that the ptoblem is unrelated to the transparency issue. Even if chrome view did not get transparent you should still be able to see your app since map is placed underneath it, not over it.

JcDenton86 commented 9 years ago

@paishin , I can see my app and the html that I am placing above the map-page (buttons etc). Building the app without Crosswalk I can see the map too. Using Crosswalk the map-page becomes transparent (as it should - like the version without Crosswalk) but the background stays black (which in default Cordova the map shows up instead). Just like the screenshot in wf9a5m75's comment. I have a working Cordova application, but I would like to move to Crosswalk for performance and Android compatibility purposes.

telemakhos commented 9 years ago

@JcDenton86 I think we all want to move to crosswalk. All the plugin devs are in a rush trying to make them compatible with xwalk since it's the future and also gets rid of Android fragmentation problem. Tomorrow and this w/e I'll look into this bug more deeply, but I'm not a java guy so....

JcDenton86 commented 9 years ago

-- it's the future / gets rid of Android fragmentation problem -- That's true. I' ll try to take a look on that too in the next days. I am mostly in to Java but there should be a thorough check in the code. My main job and PhD deadlines making time not my ally here (as for the most of us).

hirbod commented 9 years ago

Like me, I can't wait to move to Crosswalk. Crossing Fingers somebody figure out when and how to make this work :). It'll be the first thing to switch, when it's ready.

michahell commented 9 years ago

+1 to get this working ! Right now, having a fallback default google maps V3 javascript map until this gets sorted out :/ Using Ionic and got build errors related to this issue when using the cordova crosswalk plugin. definitely sticking to crosswalk though! Down with default webView fragmentation :)

hirbod commented 9 years ago

@wf9a5m75 and everybody:

https://crosswalk-project.org/blog/crosswalk-12-beta.html Crosswalk-12-beta has support for transparent background. Now we need to check if

a) this plugin does set the background correctly to transparent b) make some tests to confirm if everything works

I'm not familiar with Crosswalk right now, so please, someone need to test this for us. Thanks

https://download.01.org/crosswalk/releases/crosswalk/android/beta/

wf9a5m75 commented 9 years ago

I tested version 12.41.296.5, but the background transparent does not work. iseu_302

TranceLove commented 9 years ago

I tried master branch with crosswalk-cordova-12.41.296.4-arm in an ionic project. It works correctly on a Sony Xperia Ion (LT28i) running 4.0.4.

On Android emulator running 4.4 + Google API 19 I also ended up with a black screen.

However it crashed on my OnePlus One running slimsaber (custom rom, 4.4). Not going to blame the plugin here as I'm not using official rom, and Crosswalk migration is not (yet) urgent to me for the time being.

If you like the details, here's what logcat said when the app crashed.

E/qdmemalloc(  741): ion: Failed to map memory in the client: Out of memory
E/qdgralloc(  741): Could not mmap handle 0x91ecad58, fd=306 (Out of memory)
E/qdgralloc(  741): gralloc_register_buffer: gralloc_map failed
W/GraphicBufferMapper(  741): registerBuffer(0x91ecad58) failed -12 (Out of memory)
E/GraphicBuffer(  741): unflatten: registerBuffer failed: Out of memory (-12)
W/Adreno-EGLSUB(  741): <DequeueBuffer:606>: dequeue native buffer fail: Success, buffer=0xae9f2498, handle=0x0
W/Adreno-EGL(  741): <qeglDrvAPI_eglSwapBuffers:3699>: EGL_BAD_SURFACE
E/chromium(  741): [ERROR:gles2_cmd_decoder.cc(9842)] Context lost because SwapBuffers failed.
E/chromium(  741): [ERROR:gles2_cmd_decoder.cc(4028)] Error: 5 for Command kSwapBuffers
E/chromium(  741): [ERROR:gles2_cmd_decoder.cc(3200)]   GLES2DecoderImpl: Context lost during MakeCurrent.
E/chromium(  741): [ERROR:gles2_cmd_decoder.cc(3200)]   GLES2DecoderImpl: Context lost during MakeCurrent.
W/Adreno-GSL(  741): <sharedmem_gpumem_alloc_id:1489>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
E/Adreno-GSL(  741): <ioctl_kgsl_sharedmem_alloc:1590>: ioctl_kgsl_sharedmem_alloc: FATAL ERROR : (null)
I/ActivityManager(  912): Process xxx.xxx.xxx.xxx (pid 741) has died.
JcDenton86 commented 9 years ago

Build with Crosswalk 13.41.309 which is after “2015.02.23.” as mentioned here. Still black screen.

image

wf9a5m75 commented 9 years ago

https://github.com/wf9a5m75/phonegap-googlemaps-plugin/issues/302#issuecomment-76992335