PDA

View Full Version : مبتدی : عدم اجرای گوگل مپ



adlin2000
شنبه 26 مرداد 1392, 16:34 عصر
سلام
برنامه گوگل مپ (Google Map v2) آقای کمالان (http://www.kamalan.com/?p=1839)را تو اکلیپس اجرا کردم (با تغییرات جزئی) اما متاسفانه خطا میده . فایل log خطا (http://s1.picofile.com/file/7896924729/log.txt.html)

و اینم سورس برنامه (http://s4.picofile.com/file/7897020214/Test.zip.html)

و خطای برنامه :


08-17 10:50:26.331: D/dalvikvm(8860): Late-enabling CheckJNI
08-17 10:50:26.331: D/dalvikvm(8860): Try to disable coredump for pid 8860
08-17 10:50:26.421: D/MainActivity(8860): ***************************
08-17 10:50:26.421: D/MainActivity(8860): *** Application started ***
08-17 10:50:26.421: D/MainActivity(8860): ***************************
08-17 10:50:26.481: W/dalvikvm(8860): VFY: unable to resolve static field 1232 (MapAttrs) in Lcom/google/android/gms/R$styleable;
08-17 10:50:26.481: D/dalvikvm(8860): VFY: replacing opcode 0x62 at 0x000e
08-17 10:50:26.491: D/AndroidRuntime(8860): Shutting down VM
08-17 10:50:26.491: W/dalvikvm(8860): threadid=1: thread exiting with uncaught exception (group=0x418d37d0)
08-17 10:50:26.491: E/AndroidRuntime(8860): FATAL EXCEPTION: main
08-17 10:50:26.491: E/AndroidRuntime(8860): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
08-17 10:50:26.491: E/AndroidRuntime(8860): at com.google.android.gms.maps.GoogleMapOptions.creat eFromAttributes(Unknown Source)
08-17 10:50:26.491: E/AndroidRuntime(8860): at com.google.android.gms.maps.SupportMapFragment.onI nflate(Unknown Source)
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.support.v4.app.FragmentActivity.onCreateVi ew(FragmentActivity.java:284)
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.view.LayoutInflater.createViewFromTag(Layo utInflater.java:676)
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.view.LayoutInflater.rInflate(LayoutInflate r.java:746)
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.view.LayoutInflater.inflate(LayoutInflater .java:489)
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.view.LayoutInflater.inflate(LayoutInflater .java:396)
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.view.LayoutInflater.inflate(LayoutInflater .java:352)
08-17 10:50:26.491: E/AndroidRuntime(8860): at com.android.internal.policy.impl.PhoneWindow.setCo ntentView(PhoneWindow.java:257)
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.app.Activity.setContentView(Activity.java: 1867)
08-17 10:50:26.491: E/AndroidRuntime(8860): at com.example.test.MainActivity.onCreate(MainActivit y.java:29)
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.app.Activity.performCreate(Activity.java:5 008)
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.app.Instrumentation.callActivityOnCreate(I nstrumentation.java:1079)
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.app.ActivityThread.performLaunchActivity(A ctivityThread.java:2024)
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.app.ActivityThread.handleLaunchActivity(Ac tivityThread.java:2085)
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.app.ActivityThread.access$600(ActivityThre ad.java:130)
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.app.ActivityThread$H.handleMessage(Activit yThread.java:1196)
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.os.Handler.dispatchMessage(Handler.java:99 )
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.os.Looper.loop(Looper.java:137)
08-17 10:50:26.491: E/AndroidRuntime(8860): at android.app.ActivityThread.main(ActivityThread.jav a:4747)
08-17 10:50:26.491: E/AndroidRuntime(8860): at java.lang.reflect.Method.invokeNative(Native Method)
08-17 10:50:26.491: E/AndroidRuntime(8860): at java.lang.reflect.Method.invoke(Method.java:511)
08-17 10:50:26.491: E/AndroidRuntime(8860): at com.android.internal.os.ZygoteInit$MethodAndArgsCa ller.run(ZygoteInit.java:786)
08-17 10:50:26.491: E/AndroidRuntime(8860): at com.android.internal.os.ZygoteInit.main(ZygoteInit .java:553)
08-17 10:50:26.491: E/AndroidRuntime(8860): at dalvik.system.NativeStart.main(Native Method)
08-17 10:55:26.541: I/Process(8860): Sending signal. PID: 8860 SIG: 9
08-17 11:04:12.001: I/Process(9157): Sending signal. PID: 9157 SIG: 9


فایل MainActivity



package com.example.test;


import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUt il;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;

public class MainActivity extends FragmentActivity {

private static final String TAG = "MainActivity";
private static final LatLng LATLNG_IRAN = new LatLng(32.379961, 54.005356);

private GoogleMap googleMap;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Log.d(TAG, "***************************");
Log.d(TAG, "*** Application started ***");
Log.d(TAG, "***************************");

setContentView(R.layout.activity_main);

// Check that Google Play Services is available on the device at runtime to protect against error cases
if(!isGooglePlayServicesAvailable())
return;

googleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id. map)).getMap();
if(googleMap == null) {
Log.e(TAG, "googleMap should not be null");
return;
}

// Move camera on top of IRAN
googleMap.moveCamera(CameraUpdateFactory.newLatLng Zoom(LATLNG_IRAN, 4));

Log.i(TAG, "View created");
}
private boolean isGooglePlayServicesAvailable() {
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailab le(getApplicationContext());
if(status == ConnectionResult.SUCCESS) {
//Success! Do what you want
Log.i(TAG, "Google Play Services are Available");
return true;
}

Log.e(TAG, "Google Play Services are not Available");
return false;
}
}



فایل xml :


<?xml version="1.0" encoding="utf-8"?>

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


فایل AndroidManifest


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<permission android:name="com.example.test.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.example.test.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_G SERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.test.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyAd4x7xWIVzPTIzwT5HRn7JUl98Y65qloc"/>
</application>

</manifest>


فایل های jar که به برنامه اضافه کردم :
android-support-v4.jar
google-play-services.jar
google-play-services_lib.jar