Unresolved reference for synthetic view when layout is in library module

前端 未结 10 2115
醉梦人生
醉梦人生 2020-12-12 21:37

using Kotlin 1.20.20 (not that it matters, older versions behaves the same)

When layout is in separate library module Android Studio has no problem finding and refer

10条回答
  •  我在风中等你
    2020-12-12 21:53

    I solved my issue with copy both androidExtension and buildscript from project build.gradle to module that uses the library.

    buildscript {
    
        repositories {
            jcenter()
            google()
        }
        dependencies {
            classpath "com.android.tools.build:gradle:$gradle_version"
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        }
    }
    
    androidExtensions {
        experimental = true
    }
    

    Note: I use the following version of kotlin and gradle:

    buildscript {
        ext.kotlin_version = '1.3.0'
        ext.gradle_version = '3.0.1'
    

提交回复
热议问题