添加 ImageView 时出现 "W/art Failed execv" 错误

Getting "W/art Failed execv" error when I add an ImageView

我刚开始一个新项目,它运行良好。然后我从我的 drawable 添加一个 ImageView 然后引发这个错误:

03-20 15:54:28.711 25633-25633/com.example.zorgan.app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=speed --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.zorgan.app-1/split_lib_dependencies_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.zorgan.app-1@split_lib_dependencies_apk.apk@classes.dex) because non-0 exit status

知道问题出在哪里吗?这是一个全新的项目,所以不确定出了什么问题。这是我的 activity_main.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"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:background="#333"

    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.zorgan.app.MainActivity">


    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/street" />
</android.support.constraint.ConstraintLayout>

AndroidManifest.xml

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

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

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

</manifest>

错误:

03-20 16:25:37.981 27866-27866/com.example.zorgan.app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=speed --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.zorgan.app-1/split_lib_dependencies_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.zorgan.app-1@split_lib_dependencies_apk.apk@classes.dex) because non-0 exit status
03-20 16:25:38.181 27866-27866/com.example.zorgan.app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=speed --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.zorgan.app-1/split_lib_slice_0_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.zorgan.app-1@split_lib_slice_0_apk.apk@classes.dex) because non-0 exit status
03-20 16:25:38.271 27866-27866/com.example.zorgan.app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=speed --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.zorgan.app-1/split_lib_slice_1_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.zorgan.app-1@split_lib_slice_1_apk.apk@classes.dex) because non-0 exit status
03-20 16:25:38.371 27866-27866/com.example.zorgan.app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=speed --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.zorgan.app-1/split_lib_slice_2_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.zorgan.app-1@split_lib_slice_2_apk.apk@classes.dex) because non-0 exit status
03-20 16:25:38.481 27866-27866/com.example.zorgan.app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=speed --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.zorgan.app-1/split_lib_slice_3_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.zorgan.app-1@split_lib_slice_3_apk.apk@classes.dex) because non-0 exit status
03-20 16:25:38.571 27866-27866/com.example.zorgan.app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=speed --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.zorgan.app-1/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.zorgan.app-1@split_lib_slice_4_apk.apk@classes.dex) because non-0 exit status
03-20 16:25:38.671 27866-27866/com.example.zorgan.app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=speed --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.zorgan.app-1/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.zorgan.app-1@split_lib_slice_5_apk.apk@classes.dex) because non-0 exit status
03-20 16:25:38.761 27866-27866/com.example.zorgan.app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=speed --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.zorgan.app-1/split_lib_slice_6_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.zorgan.app-1@split_lib_slice_6_apk.apk@classes.dex) because non-0 exit status
03-20 16:25:38.881 27866-27866/com.example.zorgan.app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=speed --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.zorgan.app-1/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.zorgan.app-1@split_lib_slice_7_apk.apk@classes.dex) because non-0 exit status
03-20 16:25:38.981 27866-27866/com.example.zorgan.app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=speed --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.zorgan.app-1/split_lib_slice_8_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.zorgan.app-1@split_lib_slice_8_apk.apk@classes.dex) because non-0 exit status
03-20 16:25:39.071 27866-27866/com.example.zorgan.app W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --compiler-filter=speed --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.zorgan.app-1/split_lib_slice_9_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.zorgan.app-1@split_lib_slice_9_apk.apk@classes.dex) because non-0 exit status
03-20 16:25:39.081 27866-27866/com.example.zorgan.app W/System: ClassLoader referenced unknown path: /data/app/com.example.zorgan.app-1/lib/arm64

在你的 Gradle 文件中设置 vectorDrawables.useSupportLibrary = true

android {  
defaultConfig {  
 vectorDrawables.useSupportLibrary = true  
}  
}  

将 ImageView 更改为 android.support。v7.widget.AppCompatImageView

  <android.support.v7.widget.AppCompatImageView
    android:id="@+id/imageView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:srcCompat="@drawable/street" />

转到文件-->无效 Caches/Restart... 它

我遇到了同样的问题,解决方法是删除

android:name="android.support.multidex.MultiDexApplication"

来自

<application>

更新

如果出于某些其他原因您的应用需要上述内容,您可以添加以下依赖项:

compile 'com.android.support:multidex:1.0.0'

此错误的另一个原因 是我的布局 xml 文件中缺少一些元素。添加它们后,我的应用程序不再崩溃并显示此错误