在android studio中添加两个库

在android studio中添加两个库,android,google-maps,android-studio,Android,Google Maps,Android Studio,我的应用程序在Android Studio中运行良好,但当我添加谷歌地图库时,显示了一个错误 package com.iremember.kiet; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.google.android.

我的应用程序在Android Studio中运行良好,但当我添加谷歌地图库时,显示了一个错误

package com.iremember.kiet;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.gms.maps.GoogleMap; //no error
import info.androidhive.slidingmenu.R;// Cannot Resolve symbol R (when added library of google map)
build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 18
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "info.androidhive.slidingmenu"
        minSdkVersion 11
        targetSdkVersion 17
    }

    buildTypes {

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

dependencies {
    compile 'com.android.support:support-v4:18.0.0'
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.google.android.gms:play-services:6.5.87'
}
添加google lib后出现错误“无法解析符号R”(可选但有帮助): 这是Java而不是CC++,请停止尝试记忆导入

您正在使用基于Intellij的Android Studio,请打开优化导入:

步骤2: 同步并清理项目

步骤3: 毫无疑问,您需要瞄准最新的lib,从SDK管理器获取这些lib:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22 // <-- was 18
    buildToolsVersion "22.0.0" // <-- was 21.1.2

    defaultConfig {
        applicationId "info.androidhive.slidingmenu"
        minSdkVersion 11
        targetSdkVersion 22 // <-- was 17
    }

    buildTypes {
                 // <-- debug is debuggable by default
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:22.0.0' // <-- was 18
    compile 'com.android.support:appcompat-v7:22.0.0' // <-- was 21.0.3
    compile 'com.google.android.gms:play-services:6.5.87'
}
apply插件:“com.android.application”
安卓{

compileSdkVersion 22/我有一个相同的问题,请用
将项目与渐变文件同步”

你在问什么?发布你所有的代码。当我添加google lib时,显示101个错误导入com…R不工作,但导入com.google.android.gms.maps.GoogleMap;工作正常我已经在我的应用程序plz Help中做了很多工作。为什么要添加libs?你正在使用android Studio。发布你的代码并
build.gradle
。你需要e> 清理项目
,签出“清理我的项目”,但没有luck@bjiang