java - Error with import com.google.android.maps.* package from Eclipse to Android Studio -
hi guys have problem after exported project eclipse android studio have problem import com.google.android.maps.*
package, don't recognise it. tried lot of things found, doesn't work me.
touchedlocationoverlay.java
package util; import java.util.arraylist; import android.graphics.drawable.drawable; import android.os.bundle; import android.os.handler; import android.os.message; import com.google.android.maps.geopoint; import com.google.android.maps.itemizedoverlay; import com.google.android.maps.mapview; import com.google.android.maps.overlayitem; public class touchedlocationoverlay extends itemizedoverlay<overlayitem> { private arraylist<overlayitem> moverlays = new arraylist<overlayitem>(); private handler handler; public touchedlocationoverlay(drawable defaultmarker, handler h) { super(boundcenterbottom(defaultmarker)); // handler object instantiated in class mainactivity this.handler = h; } // executed, when populate() method called @override protected overlayitem createitem(int arg0) { return moverlays.get(arg0); } @override public int size() { return moverlays.size(); } public void addoverlay(overlayitem overlay) { moverlays.add(overlay); populate(); // invokes method createitem() } // method invoked, when user tap on map @override public boolean ontap(geopoint p, mapview map) { // creating message object send handler message message = new message(); // creating bundle object ot set in message object bundle data = new bundle(); // setting latitude in bundle object data.putint("latitude", p.getlatitudee6()); // setting longitude in bundle object data.putint("longitude", p.getlongitudee6()); // setting bundle object in message object message.setdata(data); // sending message object handler handler.sendmessage(message); return super.ontap(p, map); } }
gradle
apply plugin: 'com.android.application' dependencies { compile filetree(dir: 'libs', include: '*.jar') compile project(':google-play-services_lib') } android { compilesdkversion 18 buildtoolsversion "23.0.3" sourcesets { main { manifest.srcfile 'androidmanifest.xml' java.srcdirs = ['src'] resources.srcdirs = ['src'] aidl.srcdirs = ['src'] renderscript.srcdirs = ['src'] res.srcdirs = ['res'] assets.srcdirs = ['assets'] } // move tests tests/java, tests/res, etc... instrumenttest.setroot('tests') // move build types build-types/<type> // instance, build-types/debug/java, build-types/debug/androidmanifest.xml, ... // moves them out of them default location under src/<type>/... // conflict src/ being used main source set. // adding new build types or product flavors should accompanied // similar customization. debug.setroot('build-types/debug') release.setroot('build-types/release') } }
add line in dependencies
section of build.gradle
file:
compile 'com.google.android.gms:play-services:9.2.0'
you don't need add .jar
libs
folder.
more info setting google play services
Comments
Post a Comment