Oracle MAF - 请求GPS位置导致Android 6.0中的致命操作系统异常

时间:2016-08-31 02:42:19

标签: java android eclipse genymotion oracle-maf

当我在" DeviceDemo"中测试GPS服务时来自MAF的示例我收到以下错误:

07-14 02:00:15.204  2657  2657 D AndroidRuntime: Shutting down VM
07-14 02:00:15.204  2657  2657 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main
07-14 02:00:15.204  2657  2657 E AndroidRuntime: java.lang.IllegalArgumentException: provider doesn't exist: network
07-14 02:00:15.204  2657  2657 E AndroidRuntime:     at com.android.server.LocationManagerService.requestLocationUpdatesLocked(LocationManagerService.java:1637)
07-14 02:00:15.204  2657  2657 E AndroidRuntime:     at com.android.server.LocationManagerService.requestLocationUpdates(LocationManagerService.java:1616)
07-14 02:00:15.204  2657  2657 E AndroidRuntime:     at android.location.LocationManager.requestLocationUpdates(LocationManager.java:880)
07-14 02:00:15.204  2657  2657 E AndroidRuntime:     at android.location.LocationManager.requestLocationUpdates(LocationManager.java:496)
07-14 02:00:15.204  2657  2657 E AndroidRuntime:     at com.android.location.fused.FusionEngine.enableProvider(FusionEngine.java:142)

07-14 02:00:15.204  2657  2657 E AndroidRuntime:     at com.android.location.fused.FusionEngine.updateRequirements(FusionEngine.java:195)
07-14 02:00:15.204  2657  2657 E AndroidRuntime:     at com.android.location.fused.FusionEngine.setRequest(FusionEngine.java:118)
07-14 02:00:15.204  2657  2657 E AndroidRuntime:     at com.android.location.fused.FusedLocationProvider$1.handleMessage(FusedLocationProvider.java:98)
07-14 02:00:15.204  2657  2657 E AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102)
07-14 02:00:15.204  2657  2657 E AndroidRuntime:     at android.os.Looper.loop(Looper.java:148)
07-14 02:00:15.204  2657  2657 E AndroidRuntime:     at com.android.server.SystemServer.run(SystemServer.java:285)
07-14 02:00:15.204  2657  2657 E AndroidRuntime:     at com.android.server.SystemServer.main(SystemServer.java:170)
07-14 02:00:15.204  2657  2657 E AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
07-14 02:00:15.204  2657  2657 E AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
07-14 02:00:15.204  2657  2657 E AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

操作系统崩溃并重新启动。这种情况发生在我自己的应用程序中,当我调用" startUpdatingPosition" deviceManager实例上的方法。

 deviceManager.startUpdatingPosition(300, true, "MapBean.mainGeoListener", bean)

" deviceManager.getCurrentPosition"也失败了。 完整代码包含在下面。

只有在Android 6.0与GenyMotion中的模拟三星s6相结合时才会发生此崩溃(我无法测试真实设备)。我的物理三星s5上的Android 6.0没有这个问题。 Android 5.1与任何(模拟)设备也没有这个问题。

这是我的设置:

  • Oracle Enterprise Pack for Eclipse(12.2.1.3.1) - " Neon"包
  • 设备:Genymotion三星S6仿真设备,运行Android 6.0.0 (API23)
  • SDK:构建工具/平台工具24
  • SDK工具25.1.7

我已经对Android 6.0的新权限系统进行了一些研究,我担心这是问题的原因,但到目前为止,我所读过的内容并没有提出任何解决方案。

我还计划调查GenyMotion是否只是一个问题,但这对我来说有些挑战,因为获取s6并不简单,而且我没有intel CPU,所以标准的Android虚拟设备(AVD)跑得太慢,无法在那里测试。非常感谢社区在这方面提供的任何帮助(" DeviceDemo"来自oracle的示例非常容易测试)。

以下是线程处理位置更新:

package bsaf.atlas.atlasapplication;
import oracle.adf.model.datacontrols.device.DeviceManager;
import oracle.adf.model.datacontrols.device.DeviceManagerFactory;

public class ConnectionListener extends Thread {

    private DeviceManager deviceManager;
    private MapCore bean;

    public ConnectionListener(MapCore paramBean)
    {
        this.bean = paramBean;
        this.deviceManager = DeviceManagerFactory.getDeviceManager();
        System.out.println("I have been created!");
    }

    public void run()
    {
        while(true)
        {
            try
            {
                System.out.println("Connection thread trying to hook to listener");
                bean.setLocationWatcherID( deviceManager.startUpdatingPosition(300, true, "MapBean.mainGeoListener", bean) );
                System.out.println("Setting immediate position");
                bean.setUserLocation(deviceManager.getCurrentPosition(500, true));
                System.out.println("Hook success: " + bean.getLocationWatcherID());
                break;
            }
            catch (oracle.adfmf.framework.exception.AdfException e)
            {
                System.out.println("Connection Listener Exception:" + e);
                try {
                    System.out.println("Sleeping thread to retry");
                    Thread.sleep(500);
                } catch (InterruptedException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
        }

    }
}

1 个答案:

答案 0 :(得分:0)

我遇到运行Android 6.0的完全相同的问题。我使用Ionic和ngCordova构建了一个应用程序。在一个模拟的5.2设备(Genymotion)上,它工作得很好但在6.0 Genymotion设备上运行它失败了" java.lang.IllegalArgumentException:提供者不存在:network"