包 com.google.android.maps 不存在 Android Studio
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21892743/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
package com.google.android.maps does not exist Android Studio
提问by DJ-DOO
I've been working on a project which includes maps, however I made an error and I have had to create a new project. I have copied across all my classes, res folders, libraries etc. However now I am getting 101 ERRORS!!
我一直在做一个包含地图的项目,但是我犯了一个错误,我不得不创建一个新项目。我已经复制了我所有的类、res 文件夹、库等。但是现在我收到了 101 个错误!!
There are all a knock on of this:
这一切都有一个敲门声:
package com.google.maps does not exist.
包 com.google.maps 不存在。
I have selected a target google api:
我选择了一个目标 google api:
I've included the jar files as dependencies as follows:
我已将 jar 文件作为依赖项包含在内,如下所示:
It was working fine in my previous project but now that I have had to create a new project it doesn't work. I'm obviously omitting something but I can't think of what. I am using Android Studio and it is a gradle build
它在我以前的项目中运行良好,但现在我不得不创建一个新项目,它不起作用。我显然省略了一些东西,但我想不出是什么。我正在使用 Android Studio,它是一个 gradle 版本
If someone could help me I would really appreciate it because it is extremely frustrating...
如果有人可以帮助我,我会非常感激,因为这非常令人沮丧......
Oh and I have it declared in my manifest
哦,我在我的清单中声明了它
<uses-library android:name="com.google.android.maps" />
so please, if anyone has come across this before I'd appreciate it. I've already searched online and checked out this:
所以请,如果有人在我很感激之前遇到过这个。我已经在网上搜索并检查了这个:
http://code.davidjanes.com/blog/2009/11/13/18-hours-of-jar-hell-with-android-google-maps/
http://code.davidjanes.com/blog/2009/11/13/18-hours-of-jar-hell-with-android-google-maps/
although helpful it told me what I already knew...so please please help!!
虽然很有帮助,但它告诉了我我已经知道的事情……所以请帮忙!!
EDIT
编辑
Ok, I know what the problem is, I just don't know how to fix it. I am referencing maps.jar, however, in this project there is no maps.jar, in my previous project there was in the external library. The external library had Android 4.1.2 Google APIs and included there was maps.jar, however, I can't seem to create a project with the external library containing that, I don't know why. I have tried to change the build target by going file -> other setting -> default project structure and changing it there but it doesn't work...can anyone suggest what I might need to do to ensure if I create a project to have the Google APIs included in the external library? Or what changes I need to make to my current project
好的,我知道问题是什么,我只是不知道如何解决它。我引用的是maps.jar,但是,在这个项目中没有maps.jar,在我之前的项目中有在外部库中。外部库具有 Android 4.1.2 Google API 并包含 maps.jar,但是,我似乎无法使用包含该外部库的外部库创建项目,我不知道为什么。我试图通过转到文件 -> 其他设置 -> 默认项目结构并在那里更改它来更改构建目标,但它不起作用......任何人都可以建议我可能需要做什么来确保我创建一个项目外部库中是否包含 Google API?或者我需要对当前项目进行哪些更改
采纳答案by DJ-DOO
I followed this link, it showed me how to change the external library and now it works...thanks to those who helped
我点击了这个链接,它向我展示了如何更改外部库,现在它可以工作了......感谢那些提供帮助的人
Android Gradle How to build for Android Google APIs 4.2.2 not for Android 4.2.2
Android Gradle 如何为 Android Google APIs 4.2.2 构建而不是为 Android 4.2.2
回答by Sumukh Bhandarkar
Add the following code to build.gradlefile
将以下代码添加到build.gradle文件中
dependencies {
...
compile 'com.google.android.gms:play-services-base:7.3.0'
compile 'com.google.android.gms:play-services-location:7.3.0'
...
}