package com.google.android.maps does not exist And

2020-07-10 10:40发布

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!!

There are all a knock on of this:

package com.google.maps does not exist.

I have selected a target google api:

Target SDK

I've included the jar files as dependencies as follows:

dependencies

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

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/

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

2条回答
冷血范
2楼-- · 2020-07-10 11:34

Add the following code to build.gradle file

dependencies {
...
compile 'com.google.android.gms:play-services-base:7.3.0'
compile 'com.google.android.gms:play-services-location:7.3.0'
...
}
查看更多
ゆ 、 Hurt°
3楼-- · 2020-07-10 11:35

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

查看更多
登录 后发表回答