有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java MapBox Place Picker导致致命信号6

我正在按照这些说明来实现这个Place Picker

但我的应用程序每次启动时都会崩溃,出现以下错误:A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL)我该如何修复它?我没有在网上找到解决方案。。。即使我发现GitHub问题也有同样的错误,但没有答案。有人能帮忙吗

这是我的代码:

public class PlaceSelectionPluginActivity extends AppCompatActivity {

    private static final int REQUEST_CODE = 5678;
    private TextView selectedLocationTextView;

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


        Mapbox.getInstance(this, "***myToken***");

        setContentView(R.layout.activity_place_selection);
        selectedLocationTextView = findViewById(R.id.selected_location_info_textview);
        goToPickerActivity();
    }

    /**
     * Set up the PlacePickerOptions and startActivityForResult
     */
    private void goToPickerActivity() {
        startActivityForResult(
                new PlacePicker.IntentBuilder()
                        .accessToken("***myToken***")
                        .placeOptions(PlacePickerOptions.builder()
                                .statingCameraPosition(new CameraPosition.Builder()
                                        .target(new LatLng(40.7544, -73.9862)).zoom(16).build())
                                .build())
                        .build(this), REQUEST_CODE);
    }

    /**
     * This fires after a location is selected in the Places Plugin's PlacePickerActivity.
     * @param requestCode code that is a part of the return to this activity
     * @param resultCode code that is a part of the return to this activity
     * @param data the data that is a part of the return to this activity
     */
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_CANCELED) {
// Show the button and set the OnClickListener()
            Button goToPickerActivityButton = findViewById(R.id.go_to_picker_button);
            goToPickerActivityButton.setVisibility(View.VISIBLE);
            goToPickerActivityButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    goToPickerActivity();
                }
            });
        } else if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
// Retrieve the information from the selected location's CarmenFeature
            CarmenFeature carmenFeature = PlacePicker.getPlace(data);

// Set the TextView text to the entire CarmenFeature. The CarmenFeature
// also be parsed through to grab and display certain information such as
// its placeName, text, or coordinates.
            if (carmenFeature != null) {
                selectedLocationTextView.setText(String.format(
                        getString(R.string.selected_place_info), carmenFeature.toJson()));
            }
        }
    }
}

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
        mavenCentral()

    }
    dependencies {
        classpath 'com.安卓.tools.build:gradle:3.6.3'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

应用程序级别build.gradle

apply plugin: 'com.安卓.application'

安卓 {
    compileSdkVersion 29
    buildToolsVersion "29.0.0"

    defaultConfig {
        applicationId "com.mycompany.placepickertest"
        minSdkVersion 26
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "安卓x.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-安卓-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation '安卓x.appcompat:appcompat:1.1.0'
    implementation '安卓x.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    安卓TestImplementation '安卓x.test.ext:junit:1.1.1'
    安卓TestImplementation '安卓x.test.espresso:espresso-core:3.2.0'



    implementation 'com.mapbox.mapboxsdk:mapbox-安卓-plugin-places-v9:0.12.0'
}

activity_place_selection.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
    安卓:layout_width="match_parent"
    安卓:layout_height="match_parent">

    <Button
        安卓:id="@+id/go_to_picker_button"
        安卓:layout_width="wrap_content"
        安卓:layout_height="wrap_content"
        安卓:layout_gravity="center"
        安卓:visibility="invisible"
        安卓:text="go to picker activity" />

    <TextView
        安卓:id="@+id/selected_location_info_textview"
        安卓:layout_width="match_parent"
        安卓:layout_height="match_parent" />

</FrameLayout>

完整堆栈跟踪:

2020-05-17 01:00:57.244 14576-14628/com.mycompany.mapboxpickerattempt I/oxpickerattemp: --------- beginning of crash
2020-05-17 01:00:57.265 14576-14628/com.mycompany.mapboxpickerattempt A/libc: /usr/local/google/buildbot/src/安卓/ndk-release-r20/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:73: abort_message: assertion "terminating with uncaught exception of type jni::PendingJavaException" failed
2020-05-17 01:00:57.265 14576-14628/com.mycompany.mapboxpickerattempt A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 14628 (OnlineFileSourc), pid 14576 (oxpickerattempt)

共 (0) 个答案