应用程序在平板电脑上运行时崩溃。错误:请为VectorDrawableCompat配置您的构建

时间:2016-09-22 09:35:02

标签: android

我正在开发平板电脑目标设备的应用程序。 我正在使用nexus 10制表模拟器,其分辨率与平板电脑相同。

它在模拟器上运行,即使它在我的真实移动设备上运行,但当我在真正的平板电脑设备上运行时,它会说“不幸停止了”。

我对这个错误毫无头绪。第一次面对这样的错误。

这是我的Logcat:

09-22 14:53:47.662 8121-8121/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: com.noesis.bhurmalaidanmal, PID: 8121
                                                 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.noesis.bhurmalaidanmal/com.noesis.bhurmalaidanmal.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:2198)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2247)
                                                     at android.app.ActivityThread.access$800(ActivityThread.java:139)
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                     at android.os.Looper.loop(Looper.java:136)
                                                     at android.app.ActivityThread.main(ActivityThread.java:5028)
                                                     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:788)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604)
                                                     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:720)
                                                     at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:187)
                                                     at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:77)
                                                     at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:127)
                                                     at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:147)
                                                     at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:27)
                                                     at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:50)
                                                     at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:201)
                                                     at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:181)
                                                     at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:521)
                                                     at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
                                                     at com.noesis.bhurmalaidanmal.MainActivity.onCreate(MainActivity.java:24)
                                                     at android.app.Activity.performCreate(Activity.java:5241)
                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2247) 
                                                     at android.app.ActivityThread.access$800(ActivityThread.java:139) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:136) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5028) 
                                                     at java.lang.reflect.Method.invokeNative(Native Method) 
                                                     at java.lang.reflect.Method.invoke(Method.java:515) 

这是我的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"

    defaultConfig {
        applicationId "com.noesis.bhurmalaidanmal"
        minSdkVersion 9
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.0.1'
    compile 'com.android.support:design:24.2.0'
    compile 'com.ogaclejapan.smarttablayout:library:1.2.1@aar'

}

请有人帮帮我。对你的帮助表示感谢。 感谢。

1 个答案:

答案 0 :(得分:0)

我认为你需要添加

String test = "Hi, ";
String test1 = "this is ";
String test2 = "Java programming!";
你的build.gradle中的

(模块:app)。

有关详细信息,请Android Support Library 23.2

修改 进行如下更改:

 android {  
   defaultConfig {  
     vectorDrawables.useSupportLibrary = true  
    }  
 }