google-ar / arcore-android-sdk

ARCore SDK for Android Studio
https://developers.google.com/ar
Other
4.98k stars 1.22k forks source link

HelloAr crashes on emulator on macOS #577

Closed MathiasGilson closed 6 years ago

MathiasGilson commented 6 years ago

Sample App HelloAR keeps crashing on the emulator configured with Pixel 2 API 27, Android 8.1 x86 with 4GB of RAM

I'm running MacOS High Sierra 10.13.6 and Android Studio 3.1.4

Android Emulator is 27.3.10

I got the following Logcat

09-23 22:19:22.823 4284-4284/com.google.ar.core.examples.java.helloar I/InstantRun: starting instant run server: is main process
09-23 22:19:23.250 4284-4284/com.google.ar.core.examples.java.helloar I/third_party/arcore/ar/core/android/sdk/session_create.cc: Entering ArSession_create
09-23 22:19:23.253 4284-4284/com.google.ar.core.examples.java.helloar I/third_party/arcore/ar/core/android/sdk/session_create.cc: ARCore Version: APK version code: 180716069
09-23 22:19:23.275 4284-4284/com.google.ar.core.examples.java.helloar W/native: commandlineflags.cc:1311 Ignoring RegisterValidateFunction() for flag pointer 0xd396642c: no flag found at that address
09-23 22:19:23.281 4284-4284/com.google.ar.core.examples.java.helloar I/native: version_check.cc:23 ARCore Version: APK version:1.4.180716069
    version_check.cc:24 ARCore Version: emulated SDK version:1.4.180626000
09-23 22:19:23.281 4284-4284/com.google.ar.core.examples.java.helloar I/third_party/arcore/ar/core/android/sdk/session_create.cc: ARCore Version: SDK build name: 1.4
09-23 22:19:23.282 4284-4284/com.google.ar.core.examples.java.helloar I/third_party/arcore/ar/core/android/sdk/session_create.cc: Dynamite load ok.
09-23 22:19:23.290 4284-4284/com.google.ar.core.examples.java.helloar W/native: commandlineflags.cc:1311 Ignoring RegisterValidateFunction() for flag pointer 0xd389773c: no flag found at that address
09-23 22:19:23.300 4284-4284/com.google.ar.core.examples.java.helloar I/native: session_create_implementation.cc:49 Entering ArSession_createImplementation. ARCore SDK version: [1.4.180626000].
09-23 22:19:23.300 4284-4284/com.google.ar.core.examples.java.helloar V/third_party/redwood/base/jni_common/jni_helper.cc: ~JniHelper: did not need to detach thread. (Called from line 20.)
    ~JniHelper: did not need to detach thread. (Called from line 703.)
    JniHelper: about to attach thread. (Called from line 90.)
    JniHelper: thread already attached. (Called from line 90.)
    ~JniHelper: did not need to detach thread. (Called from line 90.)
09-23 22:19:23.314 4284-4284/com.google.ar.core.examples.java.helloar V/third_party/redwood/base/jni_common/jni_helper.cc: ~JniHelper: did not need to detach thread. (Called from line 448.)
09-23 22:19:23.315 4284-4284/com.google.ar.core.examples.java.helloar I/native: device_profile_conversions.cc:140 used_active_calibration: 2
09-23 22:19:23.316 4284-4284/com.google.ar.core.examples.java.helloar I/native: device_profile_conversions.cc:140 used_active_calibration: 2
09-23 22:19:23.318 4284-4284/com.google.ar.core.examples.java.helloar I/native: android_sensors.cc:56 Using calibrated accelerometer.
09-23 22:19:23.320 4284-4284/com.google.ar.core.examples.java.helloar V/third_party/redwood/base/jni_common/jni_helper.cc: JniHelper: about to attach thread. (Called from line 68.)
    JniHelper: thread already attached. (Called from line 68.)
    ~JniHelper: did not need to detach thread. (Called from line 68.)
    ~JniHelper: did not need to detach thread. (Called from line 69.)
    JniHelper: about to attach thread. (Called from line 137.)
    JniHelper: thread already attached. (Called from line 137.)
09-23 22:19:23.323 4284-4305/com.google.ar.core.examples.java.helloar V/third_party/redwood/base/jni_common/jni_helper.cc: JniHelper: about to attach thread. (Called from line 188.)
09-23 22:19:23.324 4284-4305/com.google.ar.core.examples.java.helloar V/third_party/redwood/base/jni_common/jni_helper.cc: JniHelper: attached thread. (Called from line 188.)
09-23 22:19:23.325 4284-4284/com.google.ar.core.examples.java.helloar V/third_party/redwood/base/jni_common/jni_helper.cc: ~JniHelper: did not need to detach thread. (Called from line 137.)
    JniHelper: about to attach thread. (Called from line 114.)
    JniHelper: thread already attached. (Called from line 114.)
09-23 22:19:23.332 4284-4284/com.google.ar.core.examples.java.helloar V/third_party/redwood/base/jni_common/jni_helper.cc: ~JniHelper: did not need to detach thread. (Called from line 114.)
09-23 22:19:23.332 4284-4284/com.google.ar.core.examples.java.helloar W/native: performance_manager.cc:18 Cannot get processor data.  Will not pin threads
09-23 22:19:23.371 4284-4284/com.google.ar.core.examples.java.helloar I/native: vio_helper.cc:46 Use uncalibrated IMU scale factors.
    vio_helper.cc:58 Use uncalibrated IMU misalignment factors.
09-23 22:19:23.686 4284-4284/com.google.ar.core.examples.java.helloar W/AnchorServiceClientFactory: The API key for use with the Google AR service could not be obtained!
09-23 22:19:23.693 4284-4284/com.google.ar.core.examples.java.helloar D/NetworkSecurityConfig: No Network Security Config specified, using platform default
09-23 22:19:23.701 4284-4284/com.google.ar.core.examples.java.helloar V/third_party/redwood/base/jni_common/jni_helper.cc: ~JniHelper: did not need to detach thread. (Called from line 343.)
09-23 22:19:23.702 4284-4284/com.google.ar.core.examples.java.helloar V/third_party/redwood/base/jni_common/jni_helper.cc: ~JniHelper: did not need to detach thread. (Called from line 209.)
09-23 22:19:23.702 4284-4284/com.google.ar.core.examples.java.helloar I/native: android_camera.cc:1117 Initializing camera manager.
09-23 22:19:23.703 4284-4284/com.google.ar.core.examples.java.helloar I/native: android_camera.cc:1133 Camera manager initialized successfully with 2 cameras.
    device_profile_conversions.cc:140 used_active_calibration: 2
09-23 22:19:23.706 4284-4284/com.google.ar.core.examples.java.helloar V/third_party/redwood/base/jni_common/jni_helper.cc: JniHelper: about to attach thread. (Called from line 44.)
    JniHelper: thread already attached. (Called from line 44.)
09-23 22:19:23.708 4284-4284/com.google.ar.core.examples.java.helloar V/third_party/redwood/base/jni_common/jni_helper.cc: ~JniHelper: did not need to detach thread. (Called from line 44.)
09-23 22:19:23.709 4284-4284/com.google.ar.core.examples.java.helloar I/native: session_create_implementation.cc:189 ArSession_createImplementation returning OK.
09-23 22:19:23.711 4284-4284/com.google.ar.core.examples.java.helloar I/third_party/arcore/ar/core/android/sdk/arimage_jni.cc: Loading AImage symbols
09-23 22:19:23.712 4284-4284/com.google.ar.core.examples.java.helloar I/third_party/arcore/ar/core/android/sdk/image_metadata_jni.cc: Loading ACameraMetadata symbols
09-23 22:19:23.714 4284-4284/com.google.ar.core.examples.java.helloar I/native: session.cc:543 Entering Session::Resume.
09-23 22:19:23.714 4284-4284/com.google.ar.core.examples.java.helloar V/third_party/redwood/base/jni_common/jni_helper.cc: JniHelper: about to attach thread. (Called from line 44.)
    JniHelper: thread already attached. (Called from line 44.)
    ~JniHelper: did not need to detach thread. (Called from line 44.)
09-23 22:19:23.714 4284-4284/com.google.ar.core.examples.java.helloar I/native: android_sensors.cc:94 Starting thread.
09-23 22:19:23.715 4284-4284/com.google.ar.core.examples.java.helloar I/native: cameras.cc:579 Selected camera 0 stream 0 as feature extraction stream.
09-23 22:19:23.717 4284-4284/com.google.ar.core.examples.java.helloar E/NdkImageReader: AImageReader_getWindow
09-23 22:19:23.721 4284-4319/com.google.ar.core.examples.java.helloar I/native: android_sensors.cc:140 Gyro min delay 10ms requesting 10ms
09-23 22:19:23.724 4284-4319/com.google.ar.core.examples.java.helloar I/native: android_sensors.cc:157 Accel min delay 10ms requesting 10ms
09-23 22:19:23.744 4284-4317/com.google.ar.core.examples.java.helloar I/native: cameras.cc:739 Camera changed state from 0 to 1: Camera device opened succesfully.
    cameras.cc:739 Camera changed state from 1 to 2: Capture session starting...
09-23 22:19:23.745 4284-4317/com.google.ar.core.examples.java.helloar I/native: cameras.cc:739 Camera changed state from 2 to 3: Capture session started streaming.
09-23 22:19:23.745 4284-4284/com.google.ar.core.examples.java.helloar I/native: session.cc:592 Session::Resume returning OK.
09-23 22:19:23.812 4284-4330/com.google.ar.core.examples.java.helloar D/OpenGLRenderer: HWUI GL Pipeline
09-23 22:19:23.886 4284-4330/com.google.ar.core.examples.java.helloar I/zygote: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
09-23 22:19:23.887 4284-4330/com.google.ar.core.examples.java.helloar I/OpenGLRenderer: Initialized EGL, version 1.4
09-23 22:19:23.887 4284-4330/com.google.ar.core.examples.java.helloar D/OpenGLRenderer: Swap behavior 1
09-23 22:19:23.888 4284-4330/com.google.ar.core.examples.java.helloar W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
09-23 22:19:23.888 4284-4330/com.google.ar.core.examples.java.helloar D/OpenGLRenderer: Swap behavior 0
09-23 22:19:23.890 4284-4330/com.google.ar.core.examples.java.helloar D/EGL_emulation: eglCreateContext: 0xe75055a0: maj 3 min 0 rcv 3
09-23 22:19:23.892 4284-4330/com.google.ar.core.examples.java.helloar D/EGL_emulation: eglMakeCurrent: 0xe75055a0: ver 3 0 (tinfo 0xe75033d0)
09-23 22:19:24.107 4284-4303/com.google.ar.core.examples.java.helloar D/EGL_emulation: eglCreateContext: 0xe7505120: maj 3 min 0 rcv 3
09-23 22:19:24.178 4284-4320/com.google.ar.core.examples.java.helloar I/native: timebase_helpers.cc:168 Timebase offset intialized to 0
09-23 22:19:24.196 4284-4304/com.google.ar.core.examples.java.helloar I/native: arcore_feature_extractor_wrapper.cc:29 Extracting features using  ArcoreFeatureExtractorWrapper.
    arcore_feature_extractor_wrapper.cc:48 Narrow camera model.
09-23 22:19:24.331 4284-4303/com.google.ar.core.examples.java.helloar D/EGL_emulation: eglMakeCurrent: 0xe7505120: ver 3 0 (tinfo 0xe7503200)
09-23 22:19:24.401 4284-4330/com.google.ar.core.examples.java.helloar D/EGL_emulation: eglMakeCurrent: 0xe75055a0: ver 3 0 (tinfo 0xe75033d0)
09-23 22:19:24.562 4284-4306/com.google.ar.core.examples.java.helloar W/native: gyro_helper.cc:59 Gyro samples do not cover << [ 0 ; 321.997210461999998 ] sec. Use identity R. Gyro samples cover [ 321.720600000000047 ; 322.531830000000014 ] sec.
    feature_processing.cc:154 Skipping first feature measurement because we don't have a previous to diff against.
09-23 22:19:24.563 4284-4309/com.google.ar.core.examples.java.helloar I/native: plane_detection_manager.cc:204 Failed to get device pose.
09-23 22:19:24.564 4284-4306/com.google.ar.core.examples.java.helloar I/native: vio_initializer.cc:637 Not accepting frame as first BA keyframe.
09-23 22:19:24.651 4284-4306/com.google.ar.core.examples.java.helloar I/native: vio_initializer.cc:637 Not accepting frame as first BA keyframe.
09-23 22:19:24.651 4284-4307/com.google.ar.core.examples.java.helloar I/native: plane_detection_manager.cc:204 Failed to get device pose.
09-23 22:19:24.661 4284-4284/com.google.ar.core.examples.java.helloar I/Choreographer: Skipped 46 frames!  The application may be doing too much work on its main thread.
09-23 22:19:24.732 4284-4295/com.google.ar.core.examples.java.helloar I/zygote: Background concurrent copying GC freed 9510(3MB) AllocSpace objects, 0(0B) LOS objects, 49% free, 1624KB/3MB, paused 89us total 390.879ms
09-23 22:19:24.733 4284-4306/com.google.ar.core.examples.java.helloar I/native: vio_initializer.cc:637 Not accepting frame as first BA keyframe.
09-23 22:19:24.733 4284-4307/com.google.ar.core.examples.java.helloar I/native: plane_detection_manager.cc:204 Failed to get device pose.
09-23 22:19:24.820 4284-4308/com.google.ar.core.examples.java.helloar I/native: plane_detection_manager.cc:204 Failed to get device pose.
09-23 22:19:24.997 4284-4308/com.google.ar.core.examples.java.helloar I/native: plane_detection_manager.cc:204 Failed to get device pose.
09-23 22:19:25.102 4284-4307/com.google.ar.core.examples.java.helloar I/native: plane_detection_manager.cc:204 Failed to get device pose.
09-23 22:19:25.241 4284-4307/com.google.ar.core.examples.java.helloar I/native: plane_detection_manager.cc:204 Failed to get device pose.
09-23 22:19:25.247 4284-4320/com.google.ar.core.examples.java.helloar E/native: camera_image_stream.cc:115 **Failed to extract the metadata or correct the timestamp, status=generic::deadline_exceeded: Timed out waiting for metadata.**
09-23 22:19:25.369 4284-4308/com.google.ar.core.examples.java.helloar I/native: plane_detection_manager.cc:204 Failed to get device pose.
09-23 22:19:25.604 4284-4307/com.google.ar.core.examples.java.helloar I/native: plane_detection_manager.cc:204 Failed to get device pose.
09-23 22:19:25.715 4284-4309/com.google.ar.core.examples.java.helloar I/native: plane_detection_manager.cc:204 Failed to get device pose.
09-23 22:19:25.731 4284-4304/com.google.ar.core.examples.java.helloar I/native: performance_monitor.cc:115 Event: FeatureExtraction is taking too long, it took 151.691ms
09-23 22:19:25.758 4284-4289/com.google.ar.core.examples.java.helloar I/zygote: Do partial code cache collection, code=30KB, data=22KB
09-23 22:19:25.759 4284-4289/com.google.ar.core.examples.java.helloar I/zygote: After code cache collection, code=30KB, data=22KB
    Increasing code cache capacity to 128KB
09-23 22:19:25.885 4284-4309/com.google.ar.core.examples.java.helloar I/native: plane_detection_manager.cc:204 Failed to get device pose.
09-23 22:19:26.033 4284-4306/com.google.ar.core.examples.java.helloar I/native: data_manager.cc:1069 Behind by: 0.203821 seconds, skip current frame.
09-23 22:19:26.033 4284-4309/com.google.ar.core.examples.java.helloar I/native: plane_detection_manager.cc:204 Failed to get device pose.
09-23 22:19:26.037 4284-4320/com.google.ar.core.examples.java.helloar E/native: camera_image_stream.cc:115 Failed to extract the metadata or correct the timestamp, status=generic::deadline_exceeded: Timed out waiting for metadata.
09-23 22:19:26.095 4284-4307/com.google.ar.core.examples.java.helloar I/native: plane_detection_manager.cc:204 Failed to get device pose.
09-23 22:19:26.095 4284-4306/com.google.ar.core.examples.java.helloar I/native: vio_helper.cc:165 Gyro bias not calibrated.
    vio_helper.cc:153 Accel bias not calibrated.
09-23 22:19:26.095 4284-4306/com.google.ar.core.examples.java.helloar W/native: ba_initialization.cc:634 First state passed to BA has zero gyro bias.
    ba_initialization.cc:637 First state passed to BA has zero accel bias.
09-23 22:19:26.095 4284-4306/com.google.ar.core.examples.java.helloar I/native: ba_initialization_helpers.cc:547 Number of landmarks before eliminating short tracks 150, and after elimination 77

    --------- beginning of crash
09-23 22:19:26.096 4284-4306/com.google.ar.core.examples.java.helloar **A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x150 in tid 4306 (tango_hp_0), pid 4284 (es.java.helloar)**

Any idea ?

Thanks

MathiasGilson commented 6 years ago

Changing the SDK target version from 27 to 28 resolved this issue

I changed the app build.gradle file like this

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28 // <== Change this
    defaultConfig {
        applicationId "com.google.ar.core.examples.java.helloar"

        minSdkVersion 24
        targetSdkVersion 28 // <== Change this
        versionCode 1
        versionName "1.0"
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.google.ar:core:1.4.0'
    implementation 'de.javagl:obj:0.2.1'

    implementation 'com.android.support:appcompat-v7:28.0.0' // <== Change this
    implementation 'com.android.support:design:28.0.0' // <== Change this
}
MathiasGilson commented 6 years ago

I had to update the emulator API to 28 too and enable VirtualScene on the back cam of the emulator The version of AndroidEmulator doesn't offer the VirtualScene option so you have to enable it manually by adding hw.camera.back=virtualscene to your config.ini file in ~/.android/avd/<Name of your simulated device>/config.ini

inio commented 6 years ago

Interesting, glad you were able to work that out.

MathiasGilson commented 6 years ago

Android Studio 3.2 fixed the error, you have the virtualscene option on the emulator config window now