0

有没有办法运行 Android 模拟器上提供的示例地理围栏应用程序:http: //developer.android.com/training/location/geofencing.html

该应用程序在启动时关闭,我在 LogCat 上收到以下错误消息:

05-28 11:54:35.397: E/AndroidRuntime(847): FATAL EXCEPTION: main
05-28 11:54:35.397: E/AndroidRuntime(847): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.android.geofence/com.example.android.geofence.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.android.geofence.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.android.geofence-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.android.geofence-2, /system/lib]]
05-28 11:54:35.397: E/AndroidRuntime(847):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
05-28 11:54:35.397: E/AndroidRuntime(847):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
05-28 11:54:35.397: E/AndroidRuntime(847):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
05-28 11:54:35.397: E/AndroidRuntime(847):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
05-28 11:54:35.397: E/AndroidRuntime(847):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-28 11:54:35.397: E/AndroidRuntime(847):  at android.os.Looper.loop(Looper.java:137)
05-28 11:54:35.397: E/AndroidRuntime(847):  at android.app.ActivityThread.main(ActivityThread.java:5103)
05-28 11:54:35.397: E/AndroidRuntime(847):  at java.lang.reflect.Method.invokeNative(Native Method)
05-28 11:54:35.397: E/AndroidRuntime(847):  at java.lang.reflect.Method.invoke(Method.java:525)
05-28 11:54:35.397: E/AndroidRuntime(847):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
05-28 11:54:35.397: E/AndroidRuntime(847):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
05-28 11:54:35.397: E/AndroidRuntime(847):  at dalvik.system.NativeStart.main(Native Method)
05-28 11:54:35.397: E/AndroidRuntime(847): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.android.geofence.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.android.geofence-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.android.geofence-2, /system/lib]]
05-28 11:54:35.397: E/AndroidRuntime(847):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
05-28 11:54:35.397: E/AndroidRuntime(847):  at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-28 11:54:35.397: E/AndroidRuntime(847):  at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-28 11:54:35.397: E/AndroidRuntime(847):  at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
05-28 11:54:35.397: E/AndroidRuntime(847):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
05-28 11:54:35.397: E/AndroidRuntime(847):  ... 11 more
4

1 回答 1

0

似乎找不到您的 MainActivity。也许您没有在 Manifest.xml 文件中提及它?

除此之外:让地理围栏应用程序在模拟器中运行实际上没有任何意义。Android 的地理围栏 API 很大程度上基于网络定位,模拟器只支持 GPS。因此,即使您可以让应用程序在模拟器上运行,创建地理围栏也会因其他异常而失败。

于 2014-05-30T11:19:41.923 回答