16

Java compiler error: string too large to encode using UTF-8 written instead as 'STRING_TOO_LARGE'.

I want to note, that there I have no long string and no one vector drawable that bigger than 32kb (biggest is 3.7kb).

Gradle 3.2.0, build tool 28.0.3

What can take a problem?

15
  • Are you having any hardcoded string which is too long? Commented Oct 1, 2018 at 10:30
  • Good question, but no have Commented Oct 1, 2018 at 10:33
  • 1
    @TigranBabajanyan here the thread mentioned. As I understood the problem was in two different versions of a third-party library Commented Oct 1, 2018 at 11:12
  • 1
    I had encountered the same and fixed by clear the build cache. For more info: developer.android.com/studio/build/… Commented Oct 31, 2018 at 10:48
  • 2
    If someone are lazy and doesn't have to look for @Kalu Khan Luhar link for clean build cache just use in terminal: ./gradlew cleanBuildCache Commented Nov 27, 2018 at 10:07

3 Answers 3

3

Run this in your terminal

./gradlew cleanBuildCache 

(in my case I need to do this several times until it helps)

Sign up to request clarification or add additional context in comments.

1 Comment

I tried at terminal macbook pro m4 pro --> but It show "permission denied: ./gradlew"
1

Check your vector drawables there may be a big path. I came across same issue and i solved it by deleting big vector drawable it.

Comments

-3

Use gradle 3.2 version like 3.2.1 below.

classpath 'com.android.tools.build:gradle:3.2.1'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.