2017-01-22 60 views
1

Google Places API可以在Android棒棒糖及以下版本上運行嗎?
由於某些手機與我的應用程序,使用谷歌的地方給了這個錯誤:谷歌Places API在棒棒糖及以下

java.lang.ClassNotFoundException: 
com.google.android.gms.location.places.Places 
java.lang.Class.classForName(Native Method) 
java.lang.Class.forName()Class.java:324 
md5b74118df040d8158864d95fd3b66e81d.MainActivity.n_onResume(Native Method) 
md5b74118df040d8158864d95fd3b66e81d.MainActivity.onResume()MainActivity.java:52 
android.app.Instrumentation.callActivityOnResume()Instrumentation.java:1281 
android.app.Activity.performResume()Activity.java:6320 
android.app.ActivityThread.performResumeActivity()ActivityThread.java:3110 
android.app.ActivityThread.handleResumeActivity()ActivityThread.java:3152 
android.app.ActivityThread.handleLaunchActivity()ActivityThread.java:2495 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
android.app.ActivityThread$H.handleMessage()ActivityThread.java:1354 
android.os.Handler.dispatchMessage()Handler.java:102 
android.os.Looper.loop()Looper.java:148 
android.app.ActivityThread.main()ActivityThread.java:5443 
java.lang.reflect.Method.invoke(Native Method) 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run()ZygoteInit.java:728 
com.android.internal.os.ZygoteInit.main()ZygoteInit.java:618 
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.location.places.Places" on path: DexPathList[[zip file "/mnt/expand/e7a5152a-8805-4bc2-8125-c715c5d4ff20/app/torathamachane.torathamachane-2/base.apk"],nativeLibraryDirectories=[/mnt/expand/e7a5152a-8805-4bc2-8125-c715c5d4ff20/app/torathamachane.torathamachane-2/lib/arm, /mnt/expand/e7a5152a-8805-4bc2-8125-c715c5d4ff20/app/torathamachane.torathamachane-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]] 
+0

1.清潔和重建項目。 2.關閉並重新打開您的項目。其中一人應該解決你的問題我猜 – ash12

+0

@ ash12在我的手機上它工作。只有當我發佈併發布它時,一些有棒棒糖和以下的人說應用程序崩潰了。 – amitairos

+0

是否安裝了谷歌播放服務? –

回答

0

一個你的問題的原因可以

In 9.0.2, the 'places' library was inside 'location' library. In 9.2.0, you need to add 'places' library as dependency:

compile 'com.google.android.gms:play-services-places:9.2.0' 
「你在你所依賴的升級您的谷歌遊戲服務版本」

Also,for play service 9.2.0 places import has changed from

import com.google.android.gms.location.places; 

import com.google.android.gms.location.places.Place; 

,或者你需要的所有文件夾的地方

import com.google.android.gms.location.places.*; 
+0

我想我有更新的版本。如果不是,它在某些設備上如何工作? – amitairos

+0

請再次檢查您的依賴項,因爲您的日誌清楚地表明它沒有com.google.android.gms.location.places.Place;類 – ash12