A
A
Alexander Ivanov2016-03-09 22:29:01
Android
Alexander Ivanov, 2016-03-09 22:29:01

What is the rendering issue in Android Studio?

Just a few hours ago everything was working fine. Now, when creating a new project or opening an old one, errors appear and nothing is edited. How to fix it?a995aff732.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Dorofeev, 2016-03-10
@Lazoreth

Finally got to here!
The problem is with the last one AppCompat 23.2.0.
This version introduced support for VectorDrawableCompat.
Now vector assets will no longer be converted to bitmaps at build time.
However, the studio is unaware of this and automatically decides to do it again.
Therefore, you need to register a special flag in Gradleyour project,
otherwise it will crash, the same exceptionas yours.
1st option (if you have version Gradle wrapper >= 2.0):

android {
  defaultConfig {
    vectorDrawables.useSupportLibrary = true
  }
}

2nd option: (if version Gradle wrapper == 1.5; most likely it will suit you)
android {
  defaultConfig {
    // Stops the Gradle plugin’s automatic rasterization of vectors
    generatedDensities = []
  }
  // Flag to tell aapt to keep the attribute ids around
  aaptOptions {
    additionalParameters "--no-version-vectors"
  }
}

Well, to use this case:
<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
   app:srcCompat="@drawable/ic_search"/>

Pay attention to the last line:
However, this solution does not help everyone. Although, you simply lose the ability to see the correct
appearance of some elements during editing. Everything will look fine when you run it.

F
FoxInSox, 2016-03-09
@FoxInSox

Read the error text (Exception Details) and fix it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question