Java – how to link library projects in Android studio

I recently downloaded Android studio, and now I'm trying to build a project I used to use eclipse. The project also uses the Google map API

Import and store in the code I use it

import com.google.android.gms.location.LocationClient;

It shows my error:

Error:(40, 39) error: cannot find symbol class LocationClient

I have Google play services_ Lib code, I link the project as a library in eclipse, and it works normally

But I don't know how to do the same thing for Android studio. Please help

resolvent:

Especially for Google play service, first install "Google repository" in SDK manager

Then, add appropriate dependencies on dependency closures in com.google.android.gms: play services:

apply plugin: 'com.android.application'

dependencies {
  compile 'com.google.android.gms:play-services:6.1.71'
}

android {
 // your project configuration goes here
}

There is an updated version that provides more modular dependencies. You can explore it, but I will start from 6.1.71 and master the basic knowledge before you use the new version for optimization

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>