Annotation attribute must be a class literal? Why? Constants should be fine too

后端 未结 5 822
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-13 18:55

Can someone explain why String and Class annotation parameters are expected differently? Why does the compiler require literals for Classes, wherby accepting constants for Strin

5条回答
  •  误落风尘
    2021-02-13 19:19

        maven {
            url 'https://maven.google.com'
        }
    

    You must paste this in your project build.gradle(Project: MyApplication(Project Name))

    implementation 'android.arch.persistence.room:runtime:1.1.1'
    annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
    

    You must paste this in your project build.gradle(Module:app)

    There might be a problem with dependency or just with their naming.

    If you want a full code example go for the link:

    https://www.captechconsulting.com/blogs/android-architecture-components-room-persistence-library

提交回复
热议问题