Stop a working draft with vector drawings after updating build.gradle by API <21

I have a working draft.

  • minSdkVersion 17
  • com.android.tools.build: gradle: 2.3.3
  • gradle 4.1
  • Android Studio 3 Canary 6

I have in my gradle files:

 defaultConfig { vectorDrawables.useSupportLibrary = true vectorDrawables.generatedDensities = [] } 

I also call into action:

 AppCompatDelegate.setCompatVectorFromResourcesEnabled(true) 

The application works fine. Now change to:

  • com.android.tools.build: gradle: 3.0.0-alpha6
  • add to google() line repositories

Run gradle clean assembleDebug .

The application continues to work with devices with API> 20. But for API <21 (google android emulator) they crash when the application starts. I see a logcat error: Resources$NotFoundException: Resource ID #0x7f080058 (0x7f080058 - drawable abc_vector_test).

Why?

UPD 2017-07-19 . It has been fixed and released in com.android.tools.build: gradle: 3.0.0-alpha7

+7
source share
3 answers

Gradle plugin from version 3 uses the new AAPT, which has some errors.
After reading some issues with the error tracker, I found that Gradle has the option to completely disable AAPT2: android.enableAapt2=false

Also from the release notes for alpha5:

AAPT2. We continue to stabilize AAPT2, which provides incremental resource processing. If your build failed due to a processing problem resource, send us an error report. To temporarily disable AAPT, set the file android.enableAapt2 = false in the file gradle.properties.
Roboelectric is not currently compatible with AAPT2

+1
source

I add gradle.properties to the line

 android.enableAapt2=false 

and he solves my mistake.

UPD 2017-07-19 . It has been fixed and released in com.android.tools.build: gradle: 3.0.0-alpha7

+8
source

I ran into the same problem, changing Android Studio to a previous version of canary5 and writing the following in the build.gradle file

 buildscript { ... dependencies { classpath 'com.android.tools.build:gradle:3.0.0-alpha5' ... 
0
source

All Articles