Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio: what compiler settings when including Google Maps

I created a new project in Android Studio and added a Google Maps activity.

I get these warnings:

warning: com/google/android/gms/maps/GoogleMap.class(com/google/android/gms/maps:GoogleMap.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: com/google/android/gms/maps/SupportMapFragment.class(com/google/android/gms/maps:SupportMapFragment.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: com/google/android/gms/maps/model/LatLng.class(com/google/android/gms/maps/model:LatLng.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: com/google/android/gms/maps/model/MarkerOptions.class(com/google/android/gms/maps/model:MarkerOptions.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: com/google/android/gms/maps/model/Marker.class(com/google/android/gms/maps/model:Marker.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.

My guess is that I have a JDK miss-match or something. I installed JDK 7, and when I do javac -version I see 1.7.0_65. I changed in Android Studio's preferences the Project bytecode version but that didn't change these warnings.

My build.gradle has this

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    // You must install or update the Google Repository through the SDK manager to use this dependency.
    compile 'com.google.android.gms:play-services:5.0.77'
    compile 'com.android.support:support-v13:18.0.+'
}

What do I need to do to fix these warnings, or should I ignore them in Android Studio?

like image 823
Jason Hocker Avatar asked Jul 17 '14 15:07

Jason Hocker


People also ask

Why Google Maps is not working in Android Studio?

Clear cache and data On your Android phone or tablet, open the Settings app. Tap Apps & notifications. Locate the Google Maps app from your list of downloaded apps. After you select the app, storage & cache options should be available.

Which compiler is used in Android Studio?

Gradle build system. Android Studio uses Gradle as the foundation of the build system, with more Android-specific capabilities provided by the Android plugin for Gradle.

What are the permissions required for setting up the Google Maps app in AndroidManifest XML file?

If your app needs to access the user's location, you need to request the location permission in your AndroidManifest. xml file. The options are ACCESS_FINE_LOCATION , which provides the precise user location, and ACCESS_COARSE_LOCATION , which is less precise.

Which permission you will specify for using Google Map?

Android offers two location permissions: ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION . The permission you choose determines the accuracy of the location returned by the API. android.

How to create Android Google Maps example projects?

Create Android Google Maps Example Projects. Create a new android studio project. Input new android project name and input project save location folder, click the Next button. In the next dialog, select the minimum SDK version then click the Next button.

How do I change the compiler settings in Android Studio?

Click File > Settings (on macOS, Android Studio > Preferences) to open the Settings dialog. In the left pane, expand Build, Execution, Deployment and then click Compiler.

How do I add Google Maps activity to Android Studio?

Open Android Studio, and click Create New Project in the Welcome to Android Studio window. In the New Project window, under the Phone and Tablet category, select the Google Maps Activity, and then click Next. Complete the Google Maps Activity form: Set Language to Java or Kotlin.

How to integrate Google Maps API in Android app?

Step 1: Create a New Android Project and name it GoogleMaps. Step 2: Now select Google Maps Activity and then click Next and finish. Step 3: Now open google_maps_api.xml (debug) in values folder Step 4: Here enter your Google Maps API key in place of YOUR_KEY_HERE.


1 Answers

"Major version" means Java version. Java 7 = 51, Java 6 = 50. The code is written for Java 7, and that is something that Android's dex supports. I am not sure what you are building with that is not set for Java 7, but that's the problem. The Maven build in the project works correctly. I don't see the error you mention, and it may be related to Java 6 vs 7 too.

like image 79
Loures Avatar answered Sep 30 '22 18:09

Loures