【问题标题】:Fatal signal 11 for Mapbox gl 4.2.1 for android 4.0.4Mapbox gl 4.2.1 for android 4.0.4 的致命信号 11
【发布时间】:2017-01-09 18:01:06
【问题描述】:

我正在关注将 Mapbox 与 Android Studio 结合使用的演示应用,但我的应用不断崩溃并出现以下错误:

A/libc:致命信号 11 (SIGSEGV) 位于 0x00000000(代码=1)

我的 java 和 xml 文件对以下演示中提供的代码进行数学运算:https://www.mapbox.com/android-sdk/examples/

任何帮助将不胜感激谢谢!

以下是错误列表:

01-09 17:49:21.898: E/dalvikvm(3182): Could not find class 'android.util.ArrayMap', referenced from method com.android.tools.fd.runtime.MonkeyPatcher.monkeyPatchExistingResources 
01-09 17:49:21.898: E/dalvikvm(3182): Could not find class 'android.util.ArrayMap', referenced from method com.android.tools.fd.runtime.MonkeyPatcher.pruneResourceCache 
01-09 17:49:21.953: E/MapboxEventManager(3182): Error Trying to load Staging Credentials: java.lang.NullPointerException 
01-09 17:49:22.148: E/dalvikvm(3182): Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering    
01-09 17:49:22.210: E/OfflineManager(3182): Failed to read the storage key: null 
01-09 17:49:22.937: A/libc(3182): Fatal signal 11 (SIGSEGV)at 0x00000000 (code=1)

下面是我的 Build.grade:

   apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        applicationId "com.example.pmbi002.myapplication"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.0'
    testCompile 'junit:junit:4.12'

    compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:4.2.1@aar'){
        transitive=true
    }

}

以下是我的清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="xxxxx">

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />


    <uses-sdk android:minSdkVersion="15" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <service android:name="com.mapbox.mapboxsdk.telemetry.TelemetryService" />
    </application>

</manifest>

下面是我的 Java 代码:

package xxx;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.mapbox.mapboxsdk.MapboxAccountManager;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;


public class MainActivity extends AppCompatActivity {

    private MapView mapView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Mapbox access token is configured here. This needs to be called either in your application
        // object or in the same activity which contains the mapview.
        MapboxAccountManager.start(this, getString(R.string.access_token));

        // This contains the MapView in XML and needs to be called after the account manager
        setContentView(R.layout.activity_main);

        mapView = (MapView) findViewById(R.id.mapView);
        mapView.onCreate(savedInstanceState);
        mapView.getMapAsync(new OnMapReadyCallback() {
            @Override
            public void onMapReady(MapboxMap mapboxMap) {

                // Customize map with markers, polylines, etc.
            }
        });
    }
    // Add the mapView lifecycle to the activity's lifecycle methods
    @Override
    public void onResume() {
        super.onResume();
        mapView.onResume();
    }

    @Override
    public void onPause() {
        super.onPause();
        mapView.onPause();
    }

    @Override
    public void onLowMemory() {
        super.onLowMemory();
        mapView.onLowMemory();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mapView.onDestroy();
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        mapView.onSaveInstanceState(outState);
    }
}

【问题讨论】:

  • 如果您尝试从 aar 依赖项中删除 transitive=true,它会改变什么吗?
  • 不,这不会改变任何事情。
  • 不确定这是否意味着什么,但错误消息指的是直到 API 19 才添加的类。
  • 我能够使用 Mapbox 4.1.1 让应用停止崩溃,但仍然没有找到使用 Mapbox 4.2.1 的解决方案。

标签: android mapbox mapbox-gl


【解决方案1】:

确保您已将所有 the permissions 和遥测服务放在清单中。除此之外,还要确保你在你的类中包含了正确的导入。

E/OfflineManager(3182): Failed to read the storage key: null

提示您可能正在离线使用?你能发布一些你的代码吗,你的 gradle 文件看起来不错。

【讨论】:

  • 我已将我的清单和活动文件添加到我的帖子中。如果有帮助,我正在尝试在具有 sdk 版本 15 的 Android 4.0.4 上运行该应用程序。谢谢!
  • 你也有这个异常:E/MapboxEventManager(3182): Error Trying to load Staging Credentials: java.lang.NullPointerException
猜你喜欢
  • 1970-01-01
  • 2012-05-12
  • 2012-12-27
  • 1970-01-01
  • 1970-01-01
  • 2012-09-16
  • 2015-02-06
  • 2013-10-05
  • 1970-01-01
相关资源
最近更新 更多