android custom view attributes not working after switch to gradle

前端 未结 5 2080
小蘑菇
小蘑菇 2021-02-02 00:29

so I recently migrated to gradle now my custom view attributes return null

my project looks like this

--custom_icon_view // library that holds the custom view wi

5条回答
  •  一个人的身影
    2021-02-02 01:17

    You will get this error when you have statically declared your package name as a namespace (e.g xmlns:iconview="http://schemas.android.com/apk/lib/be.webelite.iconview" in your case) in a layout file and try building the project with Lint on. Check the Android Gradle Lint checks:

    In Gradle projects, the actual package used in the final APK can vary; for example,you can add a .debug package suffix in one version and not the other. Therefore, you should not hardcode the application package in the resource; instead, use the special namespace http://schemas.android.com/apk/res-auto which will cause the tools to figure out the right namespace for the resource regardless of the actual package used during the build.

提交回复
热议问题