mapsplugin / cordova-plugin-googlemaps

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

Bug on Android Build #606

Closed rqsakai closed 9 years ago

rqsakai commented 9 years ago

Hi guys,

I'm having an issue with android compilation after the googlemaps plugin install (IOS works like a charm).

Here follows the errors:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find any version that matches com.google.android.gms:play-services-maps:+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-maps/maven-metadata.xml
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-maps/
         file:/Users/sakai/sdks/android/extras/android/m2repository/com/google/android/gms/play-services-maps/maven-metadata.xml
         file:/Users/sakai/sdks/android/extras/android/m2repository/com/google/android/gms/play-services-maps/
         file:/Users/sakai/sdks/android/extras/google/m2repository/com/google/android/gms/play-services-maps/maven-metadata.xml
         file:/Users/sakai/sdks/android/extras/google/m2repository/com/google/android/gms/play-services-maps/
     Required by:
         :android:unspecified
   > Could not find any version that matches com.google.android.gms:play-services-location:+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-location/maven-metadata.xml
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-location/
         file:/Users/sakai/sdks/android/extras/android/m2repository/com/google/android/gms/play-services-location/maven-metadata.xml
         file:/Users/sakai/sdks/android/extras/android/m2repository/com/google/android/gms/play-services-location/
         file:/Users/sakai/sdks/android/extras/google/m2repository/com/google/android/gms/play-services-location/maven-metadata.xml
         file:/Users/sakai/sdks/android/extras/google/m2repository/com/google/android/gms/play-services-location/
     Required by:
         :android:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 24.079 secs

/Users/sakai/mobile/cupomap/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: /Users/sakai/mobile/cupomap/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/sakai/mobile/cupomap/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/sakai/mobile/cupomap/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /Users/sakai/mobile/cupomap/platforms/android/cordova/build: Command failed with exit code 8
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

I tried to find the files and they don't exist only these ones:

/Users/sakai/sdks/android/extras/google/m2repository/com/google/android/gms/play-services
/Users/sakai/sdks/android/extras/google/m2repository/com/google/android/gms/play-services-wearable

I installed all the recommended SDK's on this Git tutorials.

Cordova plugins

Rauls-MacBook-Pro:cupomap sakai$ cordova plugin ls
com.googlemaps.ios 1.9.2 "Google Map iOS SDK for Cordova"
cordova-plugin-console 1.0.1 "Console"
cordova-plugin-device 1.0.1 "Device"
cordova-plugin-device-motion 1.1.1 "Device Motion"
cordova-plugin-device-orientation 1.0.1 "Device Orientation"
cordova-plugin-dialogs 1.1.1 "Notification"
cordova-plugin-geolocation 1.0.1 "Geolocation"
cordova-plugin-splashscreen 2.1.0 "Splashscreen"
cordova-plugin-statusbar 1.0.1 "StatusBar"
cordova-plugin-whitelist 1.0.0 "Whitelist"
phonegap-plugin-push 1.2.2 "PushPlugin"
plugin.google.maps 1.2.9 "phonegap-googlemaps-plugin"
plugin.http.request 1.0.4 "phonegap-http-request"

XML CONFIG FILE

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.grouptools.cupomap" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>CupoMap</name>
    <description>Economize seu suado dinheiro com os melhores descontos na tela do seu celular.</description>
    <author email="contato@grouptools.com.br" href="http://grouptools.com.br">Grouptools</author>
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" version="1" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
    <platform name="android">
        <icon src="res/icons/ldpi.png" density="ldpi" />
        <icon src="res/icons/mdpi.png" density="mdpi" />
        <icon src="res/icons/hdpi.png" density="hdpi" />
        <icon src="res/icons/xhdpi.png" density="xhdpi" />
    </platform>

    <platform name="ios">
              <!-- iOS 8.0+ -->
              <!-- iPhone 6 Plus  -->
              <icon src="res/icons/icon-60@3x.png" width="180" height="180" />
              <!-- iOS 7.0+ -->
              <!-- iPhone / iPod Touch  -->
              <icon src="res/icons/icon-60.png" width="60" height="60" />
              <icon src="res/icons/icon-60@2x.png" width="120" height="120" />
              <!-- iPad -->
              <icon src="res/icons/icon-76.png" width="76" height="76" />
              <icon src="res/icons/icon-76@2x.png" width="152" height="152" />
              <!-- iOS 6.1 -->
              <!-- Spotlight Icon -->
              <icon src="res/icons/icon-40.png" width="40" height="40" />
              <icon src="res/icons/icon-40@2x.png" width="80" height="80" />
              <!-- iPhone / iPod Touch -->
              <icon src="res/icons/icon.png" width="57" height="57" />
              <icon src="res/icons/icon@2x.png" width="114" height="114" />
              <!-- iPad -->
              <icon src="res/icons/icon-72.png" width="72" height="72" />
              <icon src="res/icons/icon-72@2x.png" width="144" height="144" />
              <!-- iPhone Spotlight and Settings Icon -->
              <icon src="res/icons/icon-small.png" width="29" height="29" />
              <icon src="res/icons/icon-small@2x.png" width="58" height="58" />
              <!-- iPad Spotlight and Settings Icon -->
              <icon src="res/icons/icon-50.png" width="50" height="50" />
              <icon src="res/icons/icon-50@2x.png" width="100" height="100" />
     </platform>

    <access origin="*" />
    <access origin="*.google.com"/>
    <access origin="*.googleapis.com"/>
    <preference name="fullscreen" value="true" />
    <preference name="Orientation" value="portrait-only" />
    <preference name="DisallowOverscroll" value="true"/>
    <preference name="BackgroundColor" value="0xff0000ff"/>
    <preference name="SplashScreen" value="screen" />
    <preference name="SplashScreenDelay" value="3000" />
    <preference name="StatusBarOverlaysWebView" value="true" />

    <feature name="Device">
        <param name="ios-package" value="CDVDevice" />
        <param name="android-package" value="org.apache.cordova.device.Device" />
    </feature>
    <feature name="Geolocation">
        <param name="ios-package" value="CDVLocation" />
        <param name="android-package" value="org.apache.cordova.geolocation.Geolocation" />
    </feature>
    <feature name="Console">
        <param name="ios-package" value="CDVLogger" />
        <param name="android-package" value="org.apache.cordova.console.Console" />
    </feature>
    <feature name="Notification">
        <param name="ios-package" value="CDVNotification"/>
        <param name="android-package" value="org.apache.cordova.dialogs.Notification" />
    </feature>
    <feature name="SplashScreen">
        <param name="ios-package" value="CDVSplashScreen" />
        <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
    </feature>
    <feature name="StatusBar">
        <param name="ios-package" value="CDVStatusBar" onload="true" />
        <param name="android-package" value="org.apache.cordova.statusbar.StatusBar" />
    </feature>
    <feature name="Compass">
        <param name="ios-package" value="CDVCompass"/>
        <param name="android-package" value="org.apache.cordova.deviceorientation.CompassListener"/>
    </feature>
    <feature name="Accelerometer">
        <param name="ios-package" value="CDVAccelerometer"/>
        <param name="android-package" value="org.apache.cordova.devicemotion.AccelListener"/>
    </feature>
    <feature name="PushNotification">
        <param name="ios-package" value="PushPlugin"/>
        <param name="android-package" value="com.adobe.phonegap.push.PushPlugin"/>
    </feature>
    <feature name="GoogleMaps">
        <param name="ios-package" value="GoogleMaps" />
        <param name="android-package" value="plugin.google.maps.GoogleMaps" />
    </feature>
</widget>

I appreciate any help

hirbod commented 9 years ago

check if minSdk is set to 14 and that you're on the newest Cordova and Android-Cordova

hirbod commented 9 years ago

Try to set

        <preference name="android-minSdkVersion" value="14" />

or

        <preference name="android-minSdkVersion" value="16" />

inside your config.xml (inside of <platform name="android">)

rqsakai commented 9 years ago

Thanks Hirbod but it didn't work.

Also i checked the AndroidManifest.xml file and we have this:

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" />
hirbod commented 9 years ago

output

> cordova platform -v

and

> cordova platform version
hirbod commented 9 years ago

If the problem persists, please double check inside of your SDK Manager, that you have playservices installed for all the SDKs.

hirbod commented 9 years ago

bildschirmfoto 2015-09-08 um 18 34 21

rqsakai commented 9 years ago

Here it follows:

Rauls-MacBook-Pro:cupomap sakai$ cordova platform -v

5.2.0

The sdks

image

celron commented 9 years ago

I had the same problem when I updated to Cordova 5. It turns out that you also need a few more. I believe it's the Google Play services and Google Repository

image

hirbod commented 9 years ago

I'm sorry, I can't reproduce any of your bugs. Please double check Cordova-Android Platform version. (currently 4.1.1)

rqsakai commented 9 years ago

Guys, i

For the SDK's i've just double checked and is installed as recommended.

image

Rauls-MacBook-Pro:cupomap sakai$ cordova platforms ls
Installed platforms: android 4.1.1, ios 3.9.1
Available platforms: amazon-fireos, blackberry10, browser, firefoxos, webos
celron commented 9 years ago

I'm at a loss as to what can be wrong. You're problem is that the gradle build cannot find the files. Based on other postings here and here it is the Android installation.

Perhaps you can try to reinstall the Google Library since that is the complaint, as the first posting

I've discovered the error had to do with google repo after all. The install contained an error. I >uninstalled and reinstalled it again. It worked – GuruYaya Jun 20 at 16:36

indicates that solve their problem"

rqsakai commented 9 years ago

Rebuilt it.

Delete EVERY SDK and reinstalled it, but still gt the same error:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
   > Could not find any version that matches com.google.android.gms:play-services-maps:+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-maps/maven-metadata.xml
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-maps/
         file:/Users/sakai/sdks/android/extras/android/m2repository/com/google/android/gms/play-services-maps/maven-metadata.xml
         file:/Users/sakai/sdks/android/extras/android/m2repository/com/google/android/gms/play-services-maps/
         file:/Users/sakai/sdks/android/extras/google/m2repository/com/google/android/gms/play-services-maps/maven-metadata.xml
         file:/Users/sakai/sdks/android/extras/google/m2repository/com/google/android/gms/play-services-maps/
     Required by:
         :android:unspecified
   > Could not find any version that matches com.google.android.gms:play-services-location:+.
     Searched in the following locations:
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-location/maven-metadata.xml
         https://repo1.maven.org/maven2/com/google/android/gms/play-services-location/
         file:/Users/sakai/sdks/android/extras/android/m2repository/com/google/android/gms/play-services-location/maven-metadata.xml
         file:/Users/sakai/sdks/android/extras/android/m2repository/com/google/android/gms/play-services-location/
         file:/Users/sakai/sdks/android/extras/google/m2repository/com/google/android/gms/play-services-location/maven-metadata.xml
         file:/Users/sakai/sdks/android/extras/google/m2repository/com/google/android/gms/play-services-location/
     Required by:
         :android:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 19.493 secs

/Users/sakai/mobile/cupomap/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: /Users/sakai/mobile/cupomap/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/sakai/mobile/cupomap/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/sakai/mobile/cupomap/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /Users/sakai/mobile/cupomap/platforms/android/cordova/build: Command failed with exit code 8
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)
rqsakai commented 9 years ago

Fixed this bug, It was the sdk path was wrong after i upgraded the android studio

hirbod commented 9 years ago

Perfect. For all others: also check that you have "Google Repository" installed.

hirbod commented 9 years ago

It's also important to install the Android Support Repository, Library, Play Services and Google Repository.