0

I am working on Googl Maps API v2 in android.

MapExample.java code

 public class MapExample extends FragmentActivity {  
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);             
}

main.xml code

<fragment
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    class="com.google.android.gms.maps.SupportMapFragment" />

Manifest file code

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<uses-feature android:glEsVersion="0x00020000" 
                android:required="true" />

<permission
    android:name="com.example.android.mapexample.permission.MAPS_RECEIVE"
    android:protectionLevel="signature"/>

                                                                                                                                                                                                                                                                         <uses_permission                                                                                 android:name="com.example.android.mapexample.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission  android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />    
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />




<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="My API_KEY"/>

    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


</application>

I am running this code in Emulator It shows a message in emulator and warning in LogCat

Message: Google Play Service,which some of your applications rely on,is not supprted by your device.Please contact the manufacturer for assistance with ok button. Warning: Google Play Signature not valid.

when ever click on that button I get errors

03-02 13:17:30.746: D/AndroidRuntime(905): Shutting down VM
03-02 13:17:30.746: W/dalvikvm(905): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
03-02 13:17:30.776: E/AndroidRuntime(905): FATAL EXCEPTION: main
03-02 13:17:30.776: E/AndroidRuntime(905): java.lang.NullPointerException
03-02 13:17:30.776: E/AndroidRuntime(905):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1409)
03-02 13:17:30.776: E/AndroidRuntime(905):  at android.app.Activity.startActivityForResult(Activity.java:3351)
03-02 13:17:30.776: E/AndroidRuntime(905):  at android.app.Activity.startActivityForResult(Activity.java:3312)
03-02 13:17:30.776: E/AndroidRuntime(905):  at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817)
03-02 13:17:30.776: E/AndroidRuntime(905):  at android.app.Activity.startActivity(Activity.java:3522)
03-02 13:17:30.776: E/AndroidRuntime(905):  at android.app.Activity.startActivity(Activity.java:3490)
03-02 13:17:30.776: E/AndroidRuntime(905):  at com.google.android.gms.internal.e$2.onClick(Unknown Source)
03-02 13:17:30.776: E/AndroidRuntime(905):  at android.view.View.performClick(View.java:4084)
03-02 13:17:30.776: E/AndroidRuntime(905):  at android.view.View$PerformClick.run(View.java:16966)
03-02 13:17:30.776: E/AndroidRuntime(905):  at android.os.Handler.handleCallback(Handler.java:615)
03-02 13:17:30.776: E/AndroidRuntime(905):  at android.os.Handler.dispatchMessage(Handler.java:92)
03-02 13:17:30.776: E/AndroidRuntime(905):  at android.os.Looper.loop(Looper.java:137)
03-02 13:17:30.776: E/AndroidRuntime(905):  at android.app.ActivityThread.main(ActivityThread.java:4745)
03-02 13:17:30.776: E/AndroidRuntime(905):  at java.lang.reflect.Method.invokeNative(Native Method)
03-02 13:17:30.776: E/AndroidRuntime(905):  at java.lang.reflect.Method.invoke(Method.java:511)
03-02 13:17:30.776: E/AndroidRuntime(905):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-02 13:17:30.776: E/AndroidRuntime(905):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-02 13:17:30.776: E/AndroidRuntime(905):  at dalvik.system.NativeStart.main(Native Method)

How can I fix this?

unkulunkulu
  • 11,576
  • 2
  • 31
  • 49
rajeshkolli
  • 11
  • 1
  • 4

4 Answers4

3

On one of the post here on stack overflow I have stumbled upon a file set of 2 files:

com.android.vending.apk

and:

com.google.android.gms.apk

here are the links I have saved for my self:

http://www.filedropper.com/comandroidvending-1

http://www.filedropper.com/comgoogleandroidgms-1

or:

https://www.dropbox.com/s/u3blse4z3l2et96/com.google.android.gms-6413100ccfca460007fdc988b1363db8.apk

https://www.dropbox.com/s/8jiban3pq2cgkvo/com.android.vending-108b71f4793186b8fd1768a9cd19bbd5.apk

try both i don't remember which one is working, but one certainly does.

what you should do is to create an AVD with the following properties:

enter image description here

start it, and when it has finished booting, open command prompt and head to the folder were those two files are located and install them to the avd using the install command,

example:

c:\Users\Downloads\adb install com.android.vending.apk

after you have install both files and received a Success massage, restart the emulator and try to run you map application in this AVD, it should work now.

UPDATE:

This are the files that are used by me and work on 2 of my work stations with the configuration shown in the screen shot, please try them and tell me what you think.

http://www.mediafire.com/download.php?pxpjfkveemq29qk

http://www.mediafire.com/download.php?zn8wna5wf4ek5le

Emil Adz
  • 40,709
  • 36
  • 140
  • 187
  • Ok,thanks.But i am using this both apk in my emulater shows one message called "This app won't run unless you update Google Play services" with Update Button.After clicking Update button it shows one warring in Logcat "Google Play services out of date. Requires 3025100 but found 2012110"......... – rajeshkolli Mar 04 '13 at 10:11
  • please see updated answer, I have uploaded for you my two working apk files that are working for me right now. – Emil Adz Mar 04 '13 at 10:24
  • I am using those update Apk files,that files are not working for me.still i am getting same warning. – rajeshkolli Mar 04 '13 at 11:40
  • have you tried to create a clean AVD with the configurations as in the picture? and install it on it? please describe the steps you take. – Emil Adz Mar 04 '13 at 12:19
  • It still show same Warning.What is the problem in my emulator.I am using Linux Os,Here i am taking above fig properties to create avd. Installing apks files trough Terminal commands are adb install required_file.apk, adb install required_file.apk. – rajeshkolli Mar 04 '13 at 12:55
  • Sorry, man.... have no idea if this works for Linux. but this is defiantly working for me on Win7. – Emil Adz Mar 04 '13 at 12:55
  • But it works on my mobile. Ok,thanks.If you have got any idea Please help me. – rajeshkolli Mar 04 '13 at 12:58
1

As the error message says, you need Google Play Services, which isn't available on the emulator (and on devices that don't have the Google Play Store - such as Amazon Kindle). You have to test on a phone, but there are some hacks as well.

f2prateek
  • 2,034
  • 2
  • 20
  • 26
0

According to Android offical documenatoon you can not test google maps v2 on your emulator,you would require an android device with google play installed in it...

Karan_Rana
  • 2,813
  • 2
  • 26
  • 35
0

I've created a (German) description how to get it working:

http://linuxchef.blogspot.de/2013/05/google-maps-api-v2-im-android-emulator.html

You basically need an emulator with at least API level 9 and no Google APIs. Then you'll have to get the APKs from a rooted device:

adb -d pull /data/app/com.android.vending-2.apk adb -d pull /data/app/com.google.android.gms-2.apk

and install them in the emulator:

adb -e install com.android.vending-2.apk adb -e install com.google.android.gms-2.apk

You can even run the native Google Maps App, if you have an emulator with at least API level 14 and additionally install com.google.android.apps.maps-1.apk

Have fun.

Kurt Huwig
  • 983
  • 11
  • 11