![](/img/trans.png)
[英]Could not find class 'com.google.android.gms.location.internal.ParcelableGeofence', referenced from method glt.a
[英]Could not find class 'com.google.android.gms.location.internal.ParcelableGeofence referenced from method glt.a
我有一個應用程序,其中主頁是地圖。
不知道為什么我會收到此錯誤以及與此錯誤一起Could not find class 'gpr', referenced from method gps.a
我已經更新了Eclipse,因此我嘗試使用新的SHA1指紋更改為API密鑰。 但這不起作用。
當您打開應用程序時,我的應用程序將顯示當前位置。 它只是落入整個地圖,但在LOG cat中卻出現了這些錯誤。 這是我的Logcat
`07-08 12:54:39.897: I/Google Maps Android API(25749): Google Play services client version: 5077000
07-08 12:54:39.907: I/dalvikvm(25749): Could not find method guj.a, referenced from method gqi.a
07-08 12:54:39.907: W/dalvikvm(25749): VFY: unable to resolve static method 24936: Lguj;.a (Landroid/content/Context;)Lgri;
07-08 12:54:39.907: D/dalvikvm(25749): VFY: replacing opcode 0x71 at 0x0003
07-08 12:54:39.917: E/dalvikvm(25749): Could not find class 'gpr', referenced from method gps.a
07-08 12:54:39.917: W/dalvikvm(25749): VFY: unable to resolve new-instance 4090 (Lgpr;) in Lgps;
07-08 12:54:39.917: D/dalvikvm(25749): VFY: replacing opcode 0x22 at 0x0000
07-08 12:54:39.927: E/dalvikvm(25749): Could not find class 'gpr', referenced from method gps.a
07-08 12:54:39.927: W/dalvikvm(25749): VFY: unable to resolve new-instance 4090 (Lgpr;) in Lgps;
07-08 12:54:39.927: D/dalvikvm(25749): VFY: replacing opcode 0x22 at 0x0000
07-08 12:54:39.927: E/dalvikvm(25749): Could not find class 'gpr', referenced from method gps.a
07-08 12:54:39.927: W/dalvikvm(25749): VFY: unable to resolve new-instance 4090 (Lgpr;) in Lgps;
07-08 12:54:39.927: D/dalvikvm(25749): VFY: replacing opcode 0x22 at 0x0000
07-08 12:54:39.937: D/dalvikvm(25749): DexOpt: unable to opt direct call 0x5ea3 at 0x0a in Lgps;.a
07-08 12:54:39.937: D/dalvikvm(25749): DexOpt: unable to opt direct call 0x5ea3 at 0x0c in Lgps;.a
07-08 12:54:39.937: D/dalvikvm(25749): DexOpt: unable to opt direct call 0x5ea3 at 0x0a in Lgps;.a
07-08 12:54:39.957: I/Google Maps Android API(25749): Google Play services package version: 5084034
07-08 12:54:39.977: W/dalvikvm(25749): VFY: unable to resolve static field 20873 (t) in Lyp;
07-08 12:54:39.977: D/dalvikvm(25749): VFY: replacing opcode 0x62 at 0x000e
07-08 12:54:39.977: W/dalvikvm(25749): VFY: unable to resolve static field 20873 (t) in Lyp;
07-08 12:54:39.977: D/dalvikvm(25749): VFY: replacing opcode 0x62 at 0x000d
07-08 12:54:40.888: I/dalvikvm(25749): Failed resolving Lcom/google/android/gms/location/internal/ParcelableGeofence; interface 4023 'Lgln;'
07-08 12:54:40.888: W/dalvikvm(25749): Link of class 'Lcom/google/android/gms/location/internal/ParcelableGeofence;' failed
07-08 12:54:40.898: E/dalvikvm(25749): Could not find class 'com.google.android.gms.location.internal.ParcelableGeofence', referenced from method glt.a
07-08 12:54:40.898: W/dalvikvm(25749): VFY: unable to resolve check-cast 2086 (Lcom/google/android/gms/location/internal/ParcelableGeofence;) in Lglt;
07-08 12:54:40.898: D/dalvikvm(25749): VFY: replacing opcode 0x1f at 0x0019
07-08 12:54:41.589: W/ActivityThread(25749): ClassLoader.loadClass: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader());`
我嘗試使用Google進行搜索,似乎還沒有適當的解決方案,因此如果有人可以幫助我,這將是有幫助的。
我向您展示如何解決您遇到的相同問題。
首先,我清理了所有SDK,然后再次下載了Google Play服務庫。 然后,我刪除了計算機的.android文件夾,並重新生成了debug.keystore。
之后,我只需獲取新的SHA1即可獲取我的Google Maps V2 Api密鑰。
更新我的apikey之后,讓我們看看如何更改代碼。
現在,在您的xml布局中,將片段與MapView插入的MapFragment一起使用。
<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=".MapsActivity" >
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />
</RelativeLayout>
並使用FragmentManager找到它:
public class MapsActivity extends Activity
{
private GoogleMap map;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
// Gets the MapView from the XML layout and creates it
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
map.getUiSettings().setMyLocationButtonEnabled(false);
//map.setMyLocationEnabled(true);
map.setOnMapClickListener(this);
map.setOnMapLongClickListener(this);
try
{
MapsInitializer.initialize(MapsActivity.this);
}
catch (Exception e)
{
e.printStackTrace();
}
}
希望對我有幫助,如果我的英語不好,抱歉
在7月升級到API級別23(使用客戶端google-play-service_lib 5.0.77)后,我遇到了同樣的問題。
將Google Play服務更新到測試設備上的最新版本(6.1.09)后,此問題已解決。
因此,這似乎是(特定於設備的問題),原因是設備/仿真器上的Google Play服務版本與項目中的客戶端庫API(google-play-service_lib)不兼容。
根據Google的文檔,當客戶端比服務新時,客戶端庫API應該可以解決過時的服務apk問題。 (並且在這種情況下也是如此,因為問題實際上並沒有影響已發布的APK) https://developer.android.com/google/play-services/index.html 。
我之前嘗試通過使用新的API密鑰和新安裝的Eclipse / ADT / SDK / google-play-service_lib來解決此問題,但此問題和其他類似問題中的建議均無效。
您可以張貼清單嗎? 當然,Sans API密鑰。
對於我最近遇到的問題,您的日志看上去幾乎與我的日志相同,此問題已通過在清單中添加以下內容來解決:
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
我正在開發一種可以正常訪問地圖,然后突然停止運行的應用程序。 我看不到任何實際上指向缺少權限的內容; 我將清單與另一個使用maps api v2的應用程序進行比較時才了解它。
對於為什么以前沒有它,我仍然感到困惑(Google表示您需要獲得地圖的許可才能工作)。 也許我曾經把它放在那兒,然后不小心刪除了那條線,但是把它放進去的任何一種方式都可以解決它。
來源: https : //developers.google.com/maps/documentation/business/mobile/android/config
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.