Why "This app has been built with an incorrect configuration" error occured in some phones?
Asked Answered
R

5

18

I Have build my app in android 6 without any error, but when I build my app in android 4.4.2 I get this error

This app has been built with an incorrect configuration.
 Please configure your build for VectorDrawableCompat.

and this is my gradle:

android {
    compileSdkVersion 24
    buildToolsVersion "23.0.0"
    defaultConfig {
        applicationId "com.faranegar.channel"
        minSdkVersion 11
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

note: when I set compileSdkVersion 23, every thing is fine and there isn't any error.

Rockery answered 1/7, 2016 at 11:8 Comment(0)
J
17

This issue was alread reported here Issue 214182: appcompat-v7 24.0.0 is incompatible with rasterized vectors.

One of the developer mention:

What version of the Gradle plugin are you using?

As of v2.0 of the Gradle plugin, library resources are never rasterized so this should never happen.

The workaround for this is to update your Gradle by following this official link. Android Plugin for Gradle Release Notes.

buildscript {
  ...
  dependencies {
    classpath 'com.android.tools.build:gradle:2.1.0'
  }
}
Jason answered 1/7, 2016 at 16:34 Comment(0)
R
19

This worked well for me

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "com.example.app"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    generatedDensities = []
}

// This is handled for you by the 2.0+ Gradle Plugin
aaptOptions {
    additionalParameters "--no-version-vectors"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

Notice this in the above code:

// This is handled for you by the 2.0+ Gradle Plugin
aaptOptions {
    additionalParameters "--no-version-vectors"
}

and

generatedDensities = []

UPDATE

If this generatedDensities = [] is showing deprecated, use the following instead.

vectorDrawables.generatedDensities = []

Hope it helps

Renzo answered 9/9, 2016 at 2:57 Comment(1)
@ BlackPearl +1 vote for you. you saved my time ThanksHouseless
J
17

This issue was alread reported here Issue 214182: appcompat-v7 24.0.0 is incompatible with rasterized vectors.

One of the developer mention:

What version of the Gradle plugin are you using?

As of v2.0 of the Gradle plugin, library resources are never rasterized so this should never happen.

The workaround for this is to update your Gradle by following this official link. Android Plugin for Gradle Release Notes.

buildscript {
  ...
  dependencies {
    classpath 'com.android.tools.build:gradle:2.1.0'
  }
}
Jason answered 1/7, 2016 at 16:34 Comment(0)
T
4

if you are using rasterized vector drawables

for Gradle plugin 2.0+

android {
  defaultConfig {
    vectorDrawables.useSupportLibrary = true
    ...
  }
}

for Gradle plugin before 2.0

android {
  defaultConfig {
    generatedDensities = []
    ...  
  }

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

you should add appcompat-v7 23.2.0+ to your build.gradle.for me,i am using

compile 'com.android.support:appcompat-v7:23.4.0'
Thickening answered 16/9, 2016 at 12:12 Comment(2)
after adding vectorDrawables.useSupportLibrary = true, I got this error, "Error:(14, 0) Could not find property 'vectorDrawables' " Please tell me where I'm going wrongEjector
@Ejector check your gradle plugin version in build.gradle.'vectorDrawables' property is supported in gradle plugin 2+.Thickening
S
0

This happened to me while implementing unit tests with JUnit and Robolectric. If that's your case maybe you need to add this to your gradle file, inside the android section. That's how I fixed it:

    testOptions {
        unitTests {
            includeAndroidResources = true
        }
    }
Simoom answered 3/5, 2019 at 0:5 Comment(0)
R
0

I recommend adding

       dataBinding {
    enabled = true
}
Regional answered 10/7 at 17:51 Comment(1)
Why try? Are you unsure about the solution you propose? Can you explain how it works? Can you explain why you guess that it might help in OPs case? What makes you think that the case you experienced this to help in is the same as OPs case? If you are unsure whether this helps, why not use your commenting privilege to first ask for details?Bethsaida

© 2022 - 2024 — McMap. All rights reserved.