0

Android 용 Google지도 v2를 사용하는 프로젝트에서 작업 중이며 NoSuchFieldError을 얻는 동안 뿌리 인 HTC Desire HD에서 Google지도 조각을 인스턴스화합니다.Android 용 Google지도 API v2 - NoSuchFieldError

Afaik, Google Play 서비스가 기기에 설치되어 있지 않아도 (Google지도 v2를 사용하는 다른 애플리케이션이 작동 함에도 불구하고) 문제가 발생하지 않아야합니다.

Activity의 콘텐츠보기를 설정하기 전에 기기에 Google Play 서비스 라이브러리 (GooglePlayServicesUtil.isGooglePlayServicesAvailable)를 설치했는지 확인하려고했습니다.

또한, 다른 Android 휴대 전화에서 실행되며지도 조각이 성공적으로 확장되었습니다.

이 문제는 패키징 또는 배포 중에 Google Play 서비스 라이브러리 프로젝트가 내 프로젝트와 함께 포함되지 않은 것 같아서이 문제가 Eclipse에서 내 Android 프로젝트 설정으로 인해 발생한 것으로 의심됩니다.

일부 기기에서만 작동하고 다른 사용자는 NoSuchFieldError 예외를 던지는 사람이 Google지도에서이 문제를 해결 했습니까? 그렇다면이 문제를 해결하기 위해 무엇을 할 수 있습니까?

프로젝트 설정 및/또는 코드와 같은 자세한 정보가 필요하면 의견을 남겨주십시오.

감사합니다. activity_map.xml 레이아웃의

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

    checkForPlayServices(); 

    setContentView(R.layout.activity_map); 
    mapFragment = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map); 
    map = mapFragment.getMap(); 
    map.setMyLocationEnabled(true); 
    map.setInfoWindowAdapter(this); 
    map.setOnInfoWindowClickListener(this); 
} 

내용 :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context=".MapActivity" > 

    <ro.myapp.app.views.actionbar.ActionbarMap 
     android:id="@+id/actionBar" 
     android:layout_width="match_parent" 
     android:layout_height="@dimen/myapp_actionbar_height" /> 

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

</RelativeLayout> 
이 예외를 던지는 내 onCreate 방법은

{ CUSTOM_DATA: '', STACK_TRACE: 'java.lang.NoSuchFieldError: com.google.android.gms.R$string.common_google_play_services_unsupported_text\n\tat com.google.android.gms.common.GooglePlayServicesUtil.b(Unknown Source)\n\tat com.google.android.gms.internal.bb.a(Unknown Source)\n\tat com.google.android.gms.internal.bb.onCreateView(Unknown Source)\n\tat com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)\n\tat android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)\n\tat android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:884)\n\tat android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1066)\n\tat android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1168)\n\tat android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:280)\n\tat android.view.LayoutInflater.createViewFromTag(LayoutInflater.java)\n\tat android.view.LayoutInflater.rInflate(LayoutInflater.java)\n\tat android.view.LayoutInflater.inflate(LayoutInflater.java)\n\tat android.view.LayoutInflater.inflate(LayoutInflater.java)\n\tat android.view.LayoutInflater.inflate(LayoutInflater.java)\n\tat com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java)\n\tat android.app.Activity.setContentView(Activity.java)\n\tat ro.myapp.app.activities.MapActivity.onCreate(MapActivity.java:62)\n\tat android.app.Activity.performCreate(Activity.java)\n\tat android.app.Instrumentation.callActivityOnCreate(Instrumentation.java)\n\tat android.app.ActivityThread.performLaunchActivity(ActivityThread.java)\n\tat android.app.ActivityThread.handleLaunchActivity(ActivityThread.java)\n\tat android.app.ActivityThread.access$600(ActivityThread.java)\n\tat android.app.ActivityThread$H.handleMessage(ActivityThread.java)\n\tat android.os.Handler.dispatchMessage(Handler.java)\n\tat android.os.Looper.loop(Looper.java)\n\tat android.app.ActivityThread.main(ActivityThread.java)\n\tat java.lang.reflect.Method.invokeNative(Native Method)\n\tat java.lang.reflect.Method.invoke(Method.java)\n\tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)\n\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java)\n\tat dalvik.system.NativeStart.main(Native Method)\n', PHONE_MODEL: 'HTC Desire HD', ANDROID_VERSION: '4.0.4' }

입니다 :

이 JSON 형식으로 ACRA에서 스택 추적 보고서입니다

+0

오류가 발생하는 곳에서도 메소드를 게시 할 수 있습니까? – yams

+0

게시 됨. 그것에는 "특별한"것이 없습니다. 충돌을 일으키는 라인 # 62는'setContentView (R.layout.activity_map);'을 호출하는 라인이다. 또한 여기에 게시 된 코드에서 제거한'map.setOnInfoWindowClickListener (this); '뒤에 비동기 웹 요청을합니다. 'onCreate' 메쏘드는 다른 것이 없습니다.레이아웃에는 하나의 다른 뷰 (두 개의 ImageView와 TextView가있는'RelativeLayout')가 있습니다. –

+0

같은 클래스의 layout.xml 파일을 게시 할 수 있습니까? 아마 당신이 잘못된 이드를 사용하고있는 것 같습니다. 또는 layout.xml 파일에 MapFragment 대 SupportMapFragment가 있습니다. – yams

답변

2
java.lang.NoSuchFieldError: com.google.android.gms.R$string.common_google_play_services_unsupported_text 

은 문제가 정확히 무엇을 말한다.

는 값/strings.xml의 정의 된

<string name="common_google_play_services_unsupported_text">...</string> 

없다.

이 값은 google-play-services_lib/res에 정의되어 있으므로이 라이브러리 프로젝트를 작업 영역에 올바르게 추가했는지 확인하고 싶을 수 있습니다. 라이브러리를 업데이트 할 때 strings.xml을 업데이트하는 것을 잊어 버린 것처럼 보입니다.

+0

라이브러리를 다시 다운로드하고 다시 가져올 수있었습니다. 유감스럽게도 Google Play 서비스 라이브러리는 근본적인 일부 기기를 '지원되지 않음'으로 감지하지만 사용자에게 잘못된 정보를 알려주는 '대화 상자'를 표시 할 수 있습니다. 고맙습니다! –

0

좋습니다. 나는 내 대답을 바꿨다. libs를 오버라이드하는 것이 있는지 찾아내는 방법이 있다는 것을 알았다. 어딘가에 위치 객체를 사용하고 있으므로이 코드를 추가하고 그 중 하나를 실행할 때 디버그한다. .. 위치 개체가 위치 수신기에 있어야합니다.

location.getClass().getProtectionDomain().getCodeSource().getLocation() ; 
+0

코드는 거의 같습니다. 내가 게시 한 코드는 대부분의 기기에서 작동하지만 몇 가지 뿌리깊은 장치에 몇 가지 문제가 있습니다. HTC Desire HD는 그 중 하나이며, 충돌 로그를 삭제하고 제작 과정에서보고 된 다른 하나가 무엇인지 기억하지 못합니다 (Galaxy Mini 모델 중 하나는 기억하지 못합니다). –

+0

locationmanager도 사용하고 있습니까? 먼저 위치 관리자를 확보해야합니다. – yams

+0

예. 내'onResume' 메소드에서는 사용자가이'Activity'로 돌아 왔을 때 업데이트되도록 설정했지만 두 전화기에서는'onResume'까지 코드를 작성하지 않으므로 안됩니다. 이 문제의 원인 중 일부 또한, 이전 응용 프로그램에서했던 것처럼 LocationManager를 인스턴스화하지 않고지도를 인스턴스화 할 수 있어야합니다. –