AndroidStudio disable "Expected resource of type string"

Yaroslav picture Yaroslav · Jan 26, 2016 · Viewed 22.7k times · Source

I've just tried to generate signed apk for one of my projects (I already did this before), but (maybe since updating Android Studio) I'm getting

Error:Error: Expected resource of type string [ResourceType]

This is because I'm using Butterknife's @BindString, that is generated into something like that

target.settings = res.getString(2131230792);

How can I make studio not detect this as error? I've tried searching in settings, but without success.

Answer

Yaroslav picture Yaroslav · Jan 26, 2016

Answer to this is: disable lint rule in your build.gradle

android {
  lintOptions {
    disable "ResourceType"
  }
}

Edit: This may happen particularly when migrating from Eclipse to Android Studio.