在Android模拟器上运行Geofence应用程序

时间:2014-05-28 15:57:42

标签: android android-geofence

有没有办法运行Android模拟器上提供的示例Geofence应用: 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

1 个答案:

答案 0 :(得分:0)

似乎无法找到您的MainActivity。也许你的Manifest.xml文件中没有提到它?

除此之外:实际上没有必要让geofencing App在模拟器中运行。 Androids Geofencing API主要基于网络定位,模拟器只支持GPS。因此,即使您可以在模拟器上运行App,创建地理围栏也会因其他异常而失败。