mapsplugin / cordova-plugin-googlemaps

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

Android build failure #1208

Closed Ross-Rawlins closed 7 years ago

Ross-Rawlins commented 7 years ago

Below is the log when I run android build.

error: cannot access AbstractSafeParcelable Builder builder = LatLngBounds.builder(); ^ class file for com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable not found Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error

FAILURE: Build failed with an exception.

Fayozjon commented 7 years ago

try to reinstall plugin, remove it and add again

Ross-Rawlins commented 7 years ago

I have doe this a few times. and its still producing this error

starostin commented 7 years ago

I have the same issue

Ross-Rawlins commented 7 years ago

Glad I am not the only one

TomDemulierChevret commented 7 years ago

Same issue here (both from npm and github repo).

zwacky commented 7 years ago

having this issue as well. using github repo directly.

TomDemulierChevret commented 7 years ago

The build doesn't fail if you downgrade to 1.3.9.

zwacky commented 7 years ago

@TomDemulierChevret so you mean:

ionic plugin add https://github.com/phonegap-googlemaps-plugin/cordova-plugin-googlemaps#1.3.9 --variable [...]

?

wf9a5m75 commented 7 years ago

@Ross-Rawlins @zwacky Do you install the map plugin into a new project? I STRONGLY recommend you should try this plugin WITHOUT other plugins at the first.

zwacky commented 7 years ago

I'll try my snippet for 1.3.9 in 2 hours and report back. maybe only the upstream build is broken.

TomDemulierChevret commented 7 years ago

@zwacky I used npm as the source (cordova-plugin-googlemaps) but yeah github should work too.

My build with Android works fine with 1.3.9 but this downgrade broke my iOS build wich was working fine before (both with 1.4.0 and whichever version was on githhub 2 weeks ago).

TomDemulierChevret commented 7 years ago

Ok, the version 1.3.9 on npm seem's to be broken for iOS, but not the one on github. Builds on both platform seem's to be working with : https://github.com/mapsplugin/cordova-plugin-googlemaps#1.3.9

wf9a5m75 commented 7 years ago

Npm is already 1.4.0 https://www.npmjs.com/package/cordova-plugin-googlemaps

Ross-Rawlins commented 7 years ago

I installed the plugin first by itself but as soon as I added other plugins it breaks. This means this plugin is only good by itself which makes no sense.

I have done a clean install. I have removed the plugin and re added it. I have removed and re added platforms. I have reset my plugins state. I first had a build issue on IOS now its android. The android break came on the last commit.

@TomDemulierChevret can you confirm you got it working both for 1.3.9 but you had to download it yourself and not install through npm.

wf9a5m75 commented 7 years ago

@Ross-Rawlins Forget about 1.3.9. It's no more supported.

And please create a new project, don't use your project at first.

$> cordova create HelloWorld
$> cd HelloWorld
$> cordova platform add platform android ios
$> cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="..." --variable API_KEY_FOR_IOS="..."

Edit www/index.html https://github.com/mapsplugin/cordova-plugin-googlemaps/wiki/Tutorial-for-Mac#6-change-the-wwwindexhtml

$> cordova run android (or iOS)
zwacky commented 7 years ago

@wf9a5m75 that's not going to be a solution to start afresh for lots of devs out there. me included :S

yeah, I'm getting force closes upon startup when using the 1.3.9 plugin version. but I can't build it with the master version.

wf9a5m75 commented 7 years ago

@zwacky The point is you should separate the problem. This plugin implementation is very special. And other plugins may affect to this plugin (frequently occur).

That's why you should create a clean project and test it before using your application.

Ross-Rawlins commented 7 years ago

I have tried the solution of a new priject and it will work until you re add a plugin. This plugin doesnt seem isolated. @wf9a5m75 I need a build to work and I can address teh supported stuff later. Does 1.3.9 work can I build both ios and android?

wf9a5m75 commented 7 years ago

No more support for 1.3.9

Use 1.4.0 (npm and github are the same)

Ross-Rawlins commented 7 years ago

@wf9a5m75 BUT 1.4.0 does not build on android. so is there a plan it fix this so that you can run another plugin on the same app??

Ross-Rawlins commented 7 years ago

why have you hard coded your plugin play services to 9.8.0

Ross-Rawlins commented 7 years ago

https://github.com/mapsplugin/cordova-plugin-googlemaps/blob/master/plugin.xml#L49

can and swap out this to have a + and it solves the build issue

pke commented 7 years ago

Yes, the problem is the GMS pinning in https://github.com/mapsplugin/cordova-plugin-googlemaps/blob/044067265ede42f2d9c2d6db530ad44eab0e37e9/plugin.xml#L48 f

Why was that done? No plugin is supposed to do that. If the mapstyles introduced in 04406726 requires 9.8.0 then write that in the README and not pin the version.

wf9a5m75 commented 7 years ago

The reason is if your environment's google play services library is old, but specify '+', some building tool does not update. It's gonna be another building error.

I don't support the compatibility with another plugin. You should modify the plugin version by yourself in local.

wf9a5m75 commented 7 years ago

The google play services is already 10.0.1 But the PhoneGap Build does not catch up quickly. The 9.8.0 is the version which is the most cloud building services are able to build this plugin, and including tje styles feaature.

wf9a5m75 commented 7 years ago

If you think this is problem, you can fork or git clone , then modify the version. (This is open source) I don't revert the plugin.xml

Pushplaybang commented 7 years ago

@wf9a5m75 @pke surely you can see that you've broken the ability for a number of people to build this plugin, and provided no recourse or documentation about how or why.

zwacky commented 7 years ago

@Pushplaybang hey there, let's concentrate on fixing this together rather than pointing fingers.

fmendoza commented 7 years ago

Same here. Any workaround or solution to this issue?

wf9a5m75 commented 7 years ago

Read here https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/1200#issuecomment-263515708

fmendoza commented 7 years ago

Thank you. In my case I edited the plugin.xml from AdMob, LocationRequest and Google Analytics plugins and now everything is working great again. Not ideal, but it solves the issue.

pke commented 7 years ago

You should just edit this plugins xml and remove the version pinning. It's bad style anyway. This makes updating all the other plugins you mentioned much easier because the adhere to cooperative style of plugins. With each update of those plugins you would have to update their local plugin.xml

christocracy commented 7 years ago

If i had a dollar every time some 3rd-party plugin PINNED their play-services dependencies at some particular version, breaking my plugins...

You cannot dictate the play-services version that all other plugins must use.

<framework src="com.google.android.gms:play-services-location:9.8.0" />

You must do this

<framework src="com.google.android.gms:play-services-location:+" />
zwacky commented 7 years ago

any downsides upon unpinning the version? otherwise see referenced PR.

wf9a5m75 commented 7 years ago

Read here what the risk of specifying the latest version. http://blog.danlew.net/2015/09/09/dont-use-dynamic-versions-for-your-dependencies/

I don't mind if you modify the plugin.xml in your local or the forked repo.

christocracy commented 7 years ago

It's the application's responsibility to pin a particular version -- NOT a dependency.

A dependency cannot dictate to the app and all other dependencies which particular version of some shared dependency is to be used.

pke commented 7 years ago

And since the pinned 9.8.0 is obviously not working well with other dependencies the article @wf9a5m75 mentioned is rendered wrong.

@christocracy How would we pin the version in the cordova app?

christocracy commented 7 years ago

I've never tried it but I'd start with platforms/android/build.gradle

wf9a5m75 commented 7 years ago

@christocracy Are you able to response all build issues and detect the version numbers for this plugin? Building success, bud the plugin crashes for some reason? Do you inspect all claims? Probably not, and you don't want to do that.

Even for me, that's really difficult. The app developers typically don't want to share their app code, does not provide enough log, knowledge level might be less...etc. But in the past three years, I faces couple of times, the google play services latest version leads to this type of issues. And specifying + means some building environments omit the update of the library. It leads to this type of issue also.

For example, the styled map type with this plugin requires at least 9.8.0 of the Google Play Services. But specifying +, some environment does not update the library if there is the google play services little older version. Then build would be success, but the app crashes.

Who is going to inspect this error? Probably not.


Building error (with conflict) is easy. Just modify the plugin.xml by hand in their local.


The same reason, this plugin also specify the particular version. (But more strongly) https://github.com/fechanique/cordova-plugin-fcm/blob/master/src/android/FCMPlugin.gradle

wf9a5m75 commented 7 years ago

I know you guys what you mean, but you guys also must understand my concern. Then finding the solution for both that is acceptable.

christocracy commented 7 years ago

I don't actually use this plugin. Two of my customers of do. They're posting issues on my repos because this plugin is conflicting with mine.

Over at NativeScript, here's what the nativescript-google-maps plugin does:

Way smarter. Let the application provide that property. Dependencies have no right to dictate the version of such a widely used dependency such as play-services. This is the responsibility of the app.

dependencies {
    def googlePlayServicesVersion = project.hasProperty('googlePlayServicesVersion') ? project.googlePlayServicesVersion : '+'
    compile "com.google.android.gms:play-services-maps:$googlePlayServicesVersion"
}
wf9a5m75 commented 7 years ago
dependencies {
    def googlePlayServicesVersion = project.hasProperty('googlePlayServicesVersion') ? project.googlePlayServicesVersion : '+'
    compile "com.google.android.gms:play-services-maps:$googlePlayServicesVersion"
}

Thanks. This idea is better, but I need to test with well-known build environments. At least, the intel XDK fails specifying +.


And I don't know why your plugin conflict with this plugin (this is just curiosity) It seems you implement the google maps native sdks by yourself. Your plugin does not use this plugin internally.

christocracy commented 7 years ago

Intel XDK is a piece of junk stuck on Cordova 3.x. I suspect that service no longer employs a full-time engineering team. Why would you worry about supporting them? I refuse to.

My plugin cordova-background-geolocation-lt is a geolocation plugin. It spits out locations. It doesn't rely upon any particular UI component (or Cordova: react-native-background-geolocation, nativescript-background-geolocation).

But it does require com.google.android.gms:play-services-location

wf9a5m75 commented 7 years ago

Thanks, I see, your plugin just obtaining the location, and the app developers use this plugin for UI. That's interesting.


Anyway, I will test with something based on the suggested idea. If I confirm with no problem, change the plugin.xml.

hugomosh commented 7 years ago

So... , I am using both googleplus and google maps in an ionic2 project. I had the problem and pinning the plugin.xml of the googleplus and removing and adding the platform android fixed the problem. But what should I expect. Doing this for all my devs? or I see a fix comming?

P.d Thank you, I love the plugin and all the work you put in to it. Hope to contribute one day that I understand this trivialities : P

Fayozjon commented 7 years ago

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 12.502 secs

Error: cmd: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.

Fayozjon commented 7 years ago

p.s. I guess its because FCM plugin using 9.2.0 version

Fayozjon commented 7 years ago

If im trying to build via 9.2.0 im getting such error

 symbol: class MapStyleOptions
:\newapp\MyApteka\platforms\android\src\plugin\google\maps\GoogleMaps.java:638: error: cannot find symbol
               map.setMinZoomPreference((float)zoom.getDouble("minZoom"));
                  ^
 symbol:   method setMinZoomPreference(float)
 location: variable map of type GoogleMap
:\newapp\MyApteka\platforms\android\src\plugin\google\maps\GoogleMaps.java:641: error: cannot find symbol
               map.setMaxZoomPreference((float)zoom.getDouble("maxZoom"));
                  ^
 symbol:   method setMaxZoomPreference(float)
 location: variable map of type GoogleMap
:\newapp\MyApteka\platforms\android\src\plugin\google\maps\PluginMap.java:91: error: cannot find symbol
     MapStyleOptions styleOptions = new MapStyleOptions(styles);
     ^
 symbol:   class MapStyleOptions
 location: class PluginMap
:\newapp\MyApteka\platforms\android\src\plugin\google\maps\PluginMap.java:91: error: cannot find symbol
     MapStyleOptions styleOptions = new MapStyleOptions(styles);
                                        ^
 symbol:   class MapStyleOptions
 location: class PluginMap
:\newapp\MyApteka\platforms\android\src\plugin\google\maps\PluginMap.java:182: error: cannot find symbol
         map.setMinZoomPreference((float)zoom.getDouble("minZoom"));
            ^
 symbol:   method setMinZoomPreference(float)
 location: variable map of type GoogleMap
:\newapp\MyApteka\platforms\android\src\plugin\google\maps\PluginMap.java:185: error: cannot find symbol
         map.setMaxZoomPreference((float)zoom.getDouble("maxZoom"));
            ^
 symbol:   method setMaxZoomPreference(float)
 location: variable map of type GoogleMap
ote: Some input files use or override a deprecated API.
ote: Recompile with -Xlint:deprecation for details.
ote: E:\newapp\MyApteka\platforms\android\src\org\apache\cordova\file\AssetFilesystem.java uses unchecked or unsafe operations.
ote: Recompile with -Xlint:unchecked for details.
Fayozjon commented 7 years ago

@wf9a5m75 After building success im not able to run app. It crashes. Says Application cannot be loaded.. Logcat at attachments. App id is samapteka.uz logcat.txt

bilalsoomro commented 7 years ago

+1

Facing the same error...

error: cannot access AbstractSafeParcelable Builder builder = LatLngBounds.builder(); ^