【问题标题】:Run an Android App运行安卓应用
【发布时间】:2017-11-02 12:30:23
【问题描述】:

谁能帮我解决这个错误?

07-06 21:22:04.794 8489-8489/? D/dalvikvm: Late-enabling CheckJNI
07-06 21:22:04.944 8489-8489/? I/dalvikvm: Could not find method android.view.Window$Callback.onProvideKeyboardShortcuts, referenced from method android.support.v7.view.WindowCallbackWrapper.onProvideKeyboardShortcuts
07-06 21:22:04.944 8489-8489/? W/dalvikvm: VFY: unable to resolve interface method 15403: Landroid/view/Window$Callback;.onProvideKeyboardShortcuts (Ljava/util/List;Landroid/view/Menu;I)V
07-06 21:22:04.944 8489-8489/? D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
07-06 21:22:04.944 8489-8489/? W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
07-06 21:22:04.944 8489-8489/? I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
07-06 21:22:04.944 8489-8489/? W/dalvikvm: VFY: unable to resolve interface method 15405: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
07-06 21:22:04.944 8489-8489/? D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
07-06 21:22:04.944 8489-8489/? I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
07-06 21:22:04.944 8489-8489/? W/dalvikvm: VFY: unable to resolve interface method 15409: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
07-06 21:22:04.944 8489-8489/? D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
07-06 21:22:04.954 8489-8489/? I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
07-06 21:22:04.954 8489-8489/? W/dalvikvm: VFY: unable to resolve virtual method 477: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
07-06 21:22:04.954 8489-8489/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
07-06 21:22:04.954 8489-8489/? I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
07-06 21:22:04.954 8489-8489/? W/dalvikvm: VFY: unable to resolve virtual method 499: Landroid/content/res/TypedArray;.getType (I)I
07-06 21:22:04.954 8489-8489/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
07-06 21:22:04.954 8489-8489/? I/dalvikvm: Could not find method android.content.Context.createDeviceProtectedStorageContext, referenced from method android.support.v4.content.ContextCompat.createDeviceProtectedStorageContext
07-06 21:22:04.954 8489-8489/? W/dalvikvm: VFY: unable to resolve virtual method 268: Landroid/content/Context;.createDeviceProtectedStorageContext ()Landroid/content/Context;
07-06 21:22:04.954 8489-8489/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
07-06 21:22:04.954 8489-8489/? I/dalvikvm: Could not find method android.content.Context.getCodeCacheDir, referenced from method android.support.v4.content.ContextCompat.getCodeCacheDir
07-06 21:22:04.954 8489-8489/? W/dalvikvm: VFY: unable to resolve virtual method 273: Landroid/content/Context;.getCodeCacheDir ()Ljava/io/File;
07-06 21:22:04.954 8489-8489/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
07-06 21:22:04.954 8489-8489/? I/dalvikvm: Could not find method android.content.Context.getColor, referenced from method android.support.v4.content.ContextCompat.getColor
07-06 21:22:04.964 8489-8489/? W/dalvikvm: VFY: unable to resolve virtual method 274: Landroid/content/Context;.getColor (I)I
07-06 21:22:04.964 8489-8489/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
07-06 21:22:04.964 8489-8489/? I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method android.support.v4.content.ContextCompat.getColorStateList
07-06 21:22:04.964 8489-8489/? W/dalvikvm: VFY: unable to resolve virtual method 275: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
07-06 21:22:04.964 8489-8489/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
07-06 21:22:04.964 8489-8489/? I/dalvikvm: Could not find method android.content.Context.getDataDir, referenced from method android.support.v4.content.ContextCompat.getDataDir
07-06 21:22:04.964 8489-8489/? W/dalvikvm: VFY: unable to resolve virtual method 277: Landroid/content/Context;.getDataDir ()Ljava/io/File;
07-06 21:22:04.964 8489-8489/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
07-06 21:22:04.964 8489-8489/? I/dalvikvm: Could not find method android.content.Context.getDrawable, referenced from method android.support.v4.content.ContextCompat.getDrawable
07-06 21:22:04.964 8489-8489/? W/dalvikvm: VFY: unable to resolve virtual method 278: Landroid/content/Context;.getDrawable (I)Landroid/graphics/drawable/Drawable;
07-06 21:22:04.964 8489-8489/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
07-06 21:22:04.964 8489-8489/? I/dalvikvm: Could not find method android.content.Context.getNoBackupFilesDir, referenced from method android.support.v4.content.ContextCompat.getNoBackupFilesDir
07-06 21:22:04.964 8489-8489/? W/dalvikvm: VFY: unable to resolve virtual method 285: Landroid/content/Context;.getNoBackupFilesDir ()Ljava/io/File;
07-06 21:22:04.964 8489-8489/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
07-06 21:22:04.964 8489-8489/? I/dalvikvm: Could not find method android.content.Context.isDeviceProtectedStorage, referenced from method android.support.v4.content.ContextCompat.isDeviceProtectedStorage
07-06 21:22:04.964 8489-8489/? W/dalvikvm: VFY: unable to resolve virtual method 298: Landroid/content/Context;.isDeviceProtectedStorage ()Z
07-06 21:22:04.964 8489-8489/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
07-06 21:22:04.984 8489-8489/? D/AndroidRuntime: Shutting down VM
07-06 21:22:04.984 8489-8489/? W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41692c08)
07-06 21:22:04.994 8489-8489/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: com.example.lenovo.app, PID: 8489
                                                 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.lenovo.app/com.example.lenovo.app.MainActivity}: java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat.
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2339)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2391)
                                                     at android.app.ActivityThread.access$900(ActivityThread.java:166)
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)
                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                     at android.os.Looper.loop(Looper.java:146)
                                                     at android.app.ActivityThread.main(ActivityThread.java:5511)
                                                     at java.lang.reflect.Method.invokeNative(Native Method)
                                                     at java.lang.reflect.Method.invoke(Method.java:515)
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
                                                     at dalvik.system.NativeStart.main(Native Method)
                                                  Caused by: java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat.
                                                     at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:713)
                                                     at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:194)
                                                     at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
                                                     at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:129)
                                                     at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:152)
                                                     at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:29)
                                                     at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:53)
                                                     at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:204)
                                                     at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:184)
                                                     at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:518)
                                                     at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:70)
                                                     at com.example.lenovo.app.MainActivity.onCreate(MainActivity.java:10)
                                                     at android.app.Activity.performCreate(Activity.java:5322)
                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2303)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2391) 
                                                     at android.app.ActivityThread.access$900(ActivityThread.java:166) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:146) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5511) 
                                                     at java.lang.reflect.Method.invokeNative(Native Method) 
                                                     at java.lang.reflect.Method.invoke(Method.java:515) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) 
                                                     at dalvik.system.NativeStart.main(Native Method) 
07-06 21:22:07.814 8489-8489/? I/Process: Sending signal. PID: 8489 SIG: 9

【问题讨论】:

标签: android


【解决方案1】:

将此代码添加到您的 app.gradle 中:

android {
//....something

defaultConfig {        
    generatedDensities = []
}


aaptOptions {
    additionalParameters "--no-version-vectors"
}

【讨论】:

    【解决方案2】:

    你需要正确实现 VectorDrawableCompat:

    1- 确保您的 gradle 在 v2.3.3 中更新为更少

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
    }
    

    2- 在你的 Gradle 中:

    android {
        defaultConfig {
            vectorDrawables.useSupportLibrary = true
        }
    }
    
    dependencies {
       compile 'com.android.support:appcompat-v7:23.2.0'
    }
    

    3- 在您的应用程序类中:

    @Override
    public void onCreate() {
        super.onCreate();
        AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
    }
    

    4- 在你的 xmls 中使用 app:srcCompat 而不是 android:src

    注意:

    如果您在这样的每个活动中启用矢量兼容

    static {
        AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
    }
    

    请不要忘记从 AppCompatActivity 扩展您的活动

    如果仍然无法使用,请向我们提供有关您项目的更多信息

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-01-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-03
      • 2023-03-11
      • 2012-01-28
      相关资源
      最近更新 更多