0

MainActivity.java:

package de.jamesbeans.magicframe2;

import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends AppCompatActivity implements SensorEventListener {
    public SensorManager sm;
    public Sensor as;
    long time;
    long lastlogtime;
    double x, y, vx, vy;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        sm = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
        if(sm != null) {
            Sensor s = sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
            if(s != null) {
                Log.d("Sensors", "Found sensor!");
                as = s;
                sm.registerListener(this, as, SensorManager.SENSOR_DELAY_NORMAL);
            } else {
                Log.d("Sensors", "Linear acceleration sensor ain't available!");
            }
        } else {
            Log.d("Sensors", "Sensors ain't available");
        }
    }


    @Override
    protected void onResume() {
        super.onResume();
        sm.registerListener(this, as, SensorManager.SENSOR_DELAY_NORMAL);
    }

    @Override
    protected void onPause() {
        super.onPause();
        sm.unregisterListener(this);
    }

    @Override
    public void onSensorChanged(SensorEvent sensorEvent) {
        if(time == 0) {
            time = sensorEvent.timestamp;
            lastlogtime = time;
        } else {
            long dt = sensorEvent.timestamp - time;
            vx += sensorEvent.values[0] * dt;
            vy += sensorEvent.values[1] * dt;
            x += vx * dt;
            y += vy * dt;
            time = sensorEvent.timestamp;
            if(lastlogtime - time > 1000000000) {
                Log.d("Position", x + ", " + y);
                lastlogtime = time;
            }
        }
    }

    @Override
    public void onAccuracyChanged(Sensor sensor, int i) {
        //Do nothin'
    }
}

MainActivity.xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    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"
    tools:context="de.jamesbeans.magicframe2.MainActivity">

</android.support.constraint.ConstraintLayout>

Although this is such a simple app which is only supposed to log the position of the device, this error occurs when executing it:

06-19 21:51:01.357 14973-14973/de.jamesbeans.magicframe2 W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/de.jamesbeans.magicframe2-1/split_lib_dependencies_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@de.jamesbeans.magicframe2-1@split_lib_dependencies_apk.apk@classes.dex) because non-0 exit status
06-19 21:51:01.605 14973-14973/de.jamesbeans.magicframe2 W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/de.jamesbeans.magicframe2-1/split_lib_slice_0_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@de.jamesbeans.magicframe2-1@split_lib_slice_0_apk.apk@classes.dex) because non-0 exit status
06-19 21:51:01.683 14973-14973/de.jamesbeans.magicframe2 W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/de.jamesbeans.magicframe2-1/split_lib_slice_1_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@de.jamesbeans.magicframe2-1@split_lib_slice_1_apk.apk@classes.dex) because non-0 exit status
06-19 21:51:01.758 14973-14973/de.jamesbeans.magicframe2 W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/de.jamesbeans.magicframe2-1/split_lib_slice_2_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@de.jamesbeans.magicframe2-1@split_lib_slice_2_apk.apk@classes.dex) because non-0 exit status
06-19 21:51:01.837 14973-14973/de.jamesbeans.magicframe2 W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/de.jamesbeans.magicframe2-1/split_lib_slice_3_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@de.jamesbeans.magicframe2-1@split_lib_slice_3_apk.apk@classes.dex) because non-0 exit status
06-19 21:51:01.908 14973-14973/de.jamesbeans.magicframe2 W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/de.jamesbeans.magicframe2-1/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@de.jamesbeans.magicframe2-1@split_lib_slice_4_apk.apk@classes.dex) because non-0 exit status
06-19 21:51:02.000 14973-14973/de.jamesbeans.magicframe2 W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/de.jamesbeans.magicframe2-1/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@de.jamesbeans.magicframe2-1@split_lib_slice_5_apk.apk@classes.dex) because non-0 exit status
06-19 21:51:02.079 14973-14973/de.jamesbeans.magicframe2 W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/de.jamesbeans.magicframe2-1/split_lib_slice_6_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@de.jamesbeans.magicframe2-1@split_lib_slice_6_apk.apk@classes.dex) because non-0 exit status
06-19 21:51:02.165 14973-14973/de.jamesbeans.magicframe2 W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/de.jamesbeans.magicframe2-1/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@de.jamesbeans.magicframe2-1@split_lib_slice_7_apk.apk@classes.dex) because non-0 exit status
06-19 21:51:02.240 14973-14973/de.jamesbeans.magicframe2 W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/de.jamesbeans.magicframe2-1/split_lib_slice_8_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@de.jamesbeans.magicframe2-1@split_lib_slice_8_apk.apk@classes.dex) because non-0 exit status
06-19 21:51:02.311 14973-14973/de.jamesbeans.magicframe2 W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm --instruction-set-features=smp,-div,-atomic_ldrd_strd --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=cortex-a53 --instruction-set-features=default --dex-file=/data/app/de.jamesbeans.magicframe2-1/split_lib_slice_9_apk.apk --oat-file=/data/dalvik-cache/arm/data@app@de.jamesbeans.magicframe2-1@split_lib_slice_9_apk.apk@classes.dex) because non-0 exit status
06-19 21:51:02.316 14973-14973/de.jamesbeans.magicframe2 W/System: ClassLoader referenced unknown path: /data/app/de.jamesbeans.magicframe2-1/lib/arm

It would be amazing if someone could help me with this problem as googling it hasn't yielded any results working for me.

Simon Bohnen
  • 143
  • 1
  • 6
  • How far are is execution getting? Is it crashing immediately or do you get any output? i.e. do you see the first message, "Found Sensor"? IIf not, it may be an issue with your project set up. Maybe see [this answer](https://stackoverflow.com/a/39654701/1324406). – Amber Jun 19 '17 at 20:53
  • In most cases I see "Found sensor", but not always. I also guessed it was an error with the project setup. – Simon Bohnen Jun 20 '17 at 04:34
  • I also tried copying all the code into a new project, which didn't help. Thus it doesn't seem to be a problem with the project structure. The solution you provided didn't work either. – Simon Bohnen Jun 20 '17 at 09:47

0 Answers0