【问题标题】:Cannot resolve symbol 'maps'无法解析符号“地图”
【发布时间】:2018-03-28 05:38:27
【问题描述】:

我将 mixare 源代码导入 Android Studio 3.1,但在以下行中收到错误消息 Cannot resolve symbol 'maps'

import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;
import com.google.android.maps.Projection;

我看到了this page,但没有一个答案有帮助。我该如何解决这个问题?

build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion '27.0.3'

    defaultConfig {
        applicationId 'org.mixare'
        minSdkVersion 14
        targetSdkVersion 24
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    implementation project(':mixarelib')
    implementation 'com.google.android.gms:play-services-maps:12.0.0'
}

AndroidManifest.xml:

  <application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    tools:ignore="AllowBackup"
    tools:replace="android:label">
    <meta-data
      android:name="com.google.android.gms.version"
      android:value="@integer/google_play_services_version" />
    <meta-data
      android:name="com.google.android.maps.v2.API_KEY"
      android:value="(API KEY)" />

    <uses-library android:name="com.google.android.maps" />
...

【问题讨论】:

  • 正如我在您的 mixare 中看到的,它显示 Google API 级别 10,而您使用的是 12。尝试更改为版本 10。

标签: java android google-maps google-api


【解决方案1】:

我很容易解决这个问题。

转到设置|外观与行为 | Android SDK 并检查“显示包详细信息”。

选择 SDK 版本(我选择 7.0),勾选“Google APIs”并安装。不知道为什么7.1.1及以上版本不存在该选项。

并像这样配置 build.gradle

compileSdkVersion 'Google Inc.:Google APIs:24'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-01-10
    • 2021-12-22
    • 2018-11-11
    • 1970-01-01
    • 2016-05-03
    • 2018-10-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多