首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android4.2.2上google v2的致命错误

Android4.2.2上google v2的致命错误
EN

Stack Overflow用户
提问于 2014-11-10 19:09:35
回答 1查看 883关注 0票数 0

在Android4.1和4.3上运行良好的代码会导致以下致命错误:

代码语言:javascript
复制
11-10 20:53:21.425    8940-8957/ganbi_collector.com.ganbi_collector E/NativeCrypto﹕ ssl=0x5ca3abe0 cert_verify_callback x509_store_ctx=0x5ee64ab0 arg=0x0
11-10 20:53:21.425    8940-8957/ganbi_collector.com.ganbi_collector E/NativeCrypto﹕ ssl=0x5ca3abe0 cert_verify_callback calling verifyCertificateChain authMethod=ECDHE_ECDSA
11-10 20:53:21.502    8940-8940/ganbi_collector.com.ganbi_collector E/linker﹕ load_library(linker.cpp:759): library "libmaliinstr.so" not found
11-10 20:53:21.971    8940-8940/ganbi_collector.com.ganbi_collector E/SpannableStringBuilder﹕ SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
11-10 20:53:21.972    8940-8940/ganbi_collector.com.ganbi_collector E/SpannableStringBuilder﹕ SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
11-10 20:53:22.034    8940-8940/ganbi_collector.com.ganbi_collector E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NullPointerException
        at ganbi_collector.com.ganbi_collector.MainActivity.setUpMapIfNeeded(MainActivity.java:125)
        at ganbi_collector.com.ganbi_collector.MainActivity.onLocationChanged(MainActivity.java:311)
        at com.google.android.gms.internal.lx$a.handleMessage(Unknown Source)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:194)
        at android.app.ActivityThread.main(ActivityThread.java:5434)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:525)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:834)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
        at dalvik.system.NativeStart.main(Native Method)

以下是目标活动的XML

代码语言:javascript
复制
<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" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

<FrameLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/fragment_container">

    <fragment
        android:id="@+id/ganbi_map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.MapFragment" />

</FrameLayout>

以下是导致错误的方法:

代码语言:javascript
复制
    private GoogleMap gMap;

    private void setUpMapIfNeeded() {
    // Do a null check to confirm that we have not already instantiated the map.
    if (gMap == null) {
        gMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.ganbi_map)).getMap();
        // Check if we were successful in obtaining the map.
        if (gMap != null) {
            // The Map is verified. It is now safe to manipulate the map.
            // Load map preferences
            Log.d("Info", "Map ready for initialization");
            gMap.setMyLocationEnabled(true);
            LogMe(Boolean.toString(locationTrack));
        }
    }
}

    public void onLocationChanged(Location loc) {
    //        Marks marks = new Marks();
    String msg = "Location change received: " +
            Double.toString(loc.getLatitude()) + "," +
            Double.toString(loc.getLongitude());
    LogMe(msg);

    lastLoc = new LatLng(loc.getLatitude(),loc.getLongitude());

    // Move the camera instantly to current location with a zoom of 15.
    if (gMap == null){
        setUpMapIfNeeded();
    } else {
        gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(lastLoc, 15));
    //        marks.getNearMarks(lastLoc);
        getNearMarks(lastLoc);
    }

}

我正在调试使用阿尔卡特pop9与安道尔4.2.2,代码是完美的HTC愿望500与Android4.1和相同的代码是工作与阿尔卡特偶像x2没有任何问题。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-11-11 01:06:56

@ his 7009给了我答案的关键,用他神奇的话说:这是一个种族案件,描述了在通货膨胀之前获得地图的试验。我试着把地图从这场比赛中移开,只让这个电话在以后安全发生。

对于为什么它能与其他设备一起工作,我有不同的解释:实际上,这是Android开发的主要挑战之一,在Android开发中,不同的硬件具有不同的响应时间。阿尔卡特pop9似乎有更好的全球定位系统连接时间。我正在初始化地图,get与GPS连接,这在其他测试手机上是可以的,因为GPS给了充气器足够的时间工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26851115

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档