OneUIProject / oneui-design

Samsung's One UI design components for Android apps.
MIT License
149 stars 17 forks source link

java.lang.IllegalStateException: item_layout.xml is not annotated as @Input #6

Closed WORLD8848 closed 2 years ago

WORLD8848 commented 2 years ago

Hello!!!

I want to apply oneui-core / sesl to my project.

So I am testing with oneui-design samples.

The downloaded oneui-design samples project is installed normally. Through this, I fully understand how to use oneui-core/sesl.

However, the following error occurs when I implement a common module that I normally use in the oneui-design sample project.

Have you ever experienced such an error?

I need your advice to solve these errors.

Please review it.

Yanndroid commented 2 years ago

I never had such an issue, we'll need more information (full log, code, "common module"?, etc..). And oneui-core is a modified version of androidx/material, so you can refer the the official documentation. Whereas oneui-design is custom and for which the sample app was made.

WORLD8848 commented 2 years ago

Common Module의 build.gradle

plugins {

id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'kotlin-android'
id 'kotlin-kapt'                                // WORLD8848: Custom Binding 사용을 위해 적용  /////
id 'kotlin-parcelize'                           // WORLD8848: Room  ////////////////////////////
// id 'androidx.navigation.safeargs.kotlin'     // WORLD8848: Navigation component  ////////////

}

android {

namespace           = BASE_NAMESPACE            // WORLD8848    ////////////////////////////////
compileSdk          = BASE_SDK_COMPILE          // WORLD8848    ////////////////////////////////
buildToolsVersion   "30.0.3"                    // WORLD8848    ////////////////////////////////

defaultConfig  {
    minSdk          = BASE_SDK_MIN              // WORLD8848    ////////////////////////////////
    targetSdk       = BASE_SDK_TARGET           // WORLD8848    ////////////////////////////////
    versionCode     = BASE_VERSION_CODE         // WORLD8848    ////////////////////////////////
    versionName     = BASE_VERSION_NAME         // WORLD8848    ////////////////////////////////

    vectorDrawables.useSupportLibrary = true    // MEMO: WORLD8848  ////////////////////////////

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    consumerProguardFiles "consumer-rules.pro"
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = '1.8'
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

buildFeatures {
    viewBinding = true                          // WORLD8848: ViewBinding //////////////////////
    dataBinding = true                          // WORLD8848: Databinding //////////////////////
}

}

dependencies {

// MEMO: Kotlin component                       ////////////////////////////////////////////////
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$BASE_VERSION_KOTLIN_COROUTINES"
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$BASE_VERSION_KOTLIN_COROUTINES"
implementation  "org.jetbrains.kotlin:kotlin-stdlib:$BASE_VERSION_KOTLIN"

// MEMO: AndroidX component                     ////////////////////////////////////////////////

// implementation "androidx.annotation:annotation:$BASE_VERSION_ANDROIDX_ANNOTATION" // implementation "androidx.appcompat:appcompat:$BASE_VERSION_ANDROIDX_APPCOMPAT" // implementation "androidx.core:core-ktx:$BASE_VERSION_ANDROIDX_COREKTX" // implementation "androidx.constraintlayout:constraintlayout:$BASE_VERSION_ANDROIDX_CONSTRAINTLAYOUT" // implementation "androidx.legacy:legacy-support-v4:$BASE_VERSION_ANDROIDX_LEGACYSUPPORT"

// MEMO: AndroidX compose (BaseInfoBar)         ////////////////////////////////////////////////
implementation "androidx.compose.ui:ui:$BASE_VERSION_ANDROIDX_COMPOSE"
implementation "androidx.compose.material:material:$BASE_VERSION_ANDROIDX_COMPOSE"
debugImplementation "androidx.compose.ui:ui-tooling:$BASE_VERSION_ANDROIDX_COMPOSE"
debugImplementation "androidx.compose.ui:ui-test-manifest:$BASE_VERSION_ANDROIDX_COMPOSE"

// MEMO: AndroidX lifecycle component           ////////////////////////////////////////////////
implementation  "androidx.lifecycle:lifecycle-common-java8:$BASE_VERSION_ANDROIDX_LIFECYCLE"
implementation  "androidx.lifecycle:lifecycle-livedata-ktx:$BASE_VERSION_ANDROIDX_LIFECYCLE"
implementation  "androidx.lifecycle:lifecycle-viewmodel-ktx:$BASE_VERSION_ANDROIDX_LIFECYCLE"

// MEMO: AndroidX navigation component          ////////////////////////////////////////////////
implementation  "androidx.navigation:navigation-fragment-ktx:$BASE_VERSION_ANDROIDX_NAVIGATION_FRAGMENT"
implementation  "androidx.navigation:navigation-ui-ktx:$BASE_VERSION_ANDROIDX_NAVIGATION_UI"

// MEMO: AndroidX recyclerview component        ////////////////////////////////////////////////
implementation  "androidx.recyclerview:recyclerview:$BASE_VERSION_ANDROIDX_RECYCLERVIEW"

// MEMO: AndroidX room component                ////////////////////////////////////////////////
implementation  "androidx.room:room-ktx:$BASE_VERSION_ANDROIDX_ROOM"
kapt            "androidx.room:room-compiler:$BASE_VERSION_ANDROIDX_ROOM"

// MEMO: Google material                        ////////////////////////////////////////////////

// implementation "com.google.android.material:material:$BASE_VERSION_GOOGLE_MATERIAL"

// MEMO: androidx test implementation           ////////////////////////////////////////////////
testImplementation 'junit:junit:4.13.2'
androidTestImplementation "androidx.test.ext:junit:$BASE_VERSION_ANDROIDX_TEST_EXT"
androidTestImplementation "androidx.test.espresso:espresso-core:$BASE_VERSION_ANDROIDX_TEST_ESPRESSO"
androidTestImplementation "androidx.room:room-testing:$BASE_VERSION_ANDROIDX_ROOM_TEST"    // MEMO: Room

// MEMO: Database debug                         ////////////////////////////////////////////////
// debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'

}

WORLD8848 commented 2 years ago

error log

스크린샷 2022-06-25 오전 12 05 40

Yanndroid commented 2 years ago

You haven't even implemented any of the oneui libraries? You're sure that this issue is related to the library?

WORLD8848 commented 2 years ago

Issue related to ONEEUI Library. I think that ONEUI Library occurs in the process of replacing the Android basic library.

salvogiangri commented 2 years ago

Would you mind sharing the source code of your app?

WORLD8848 commented 2 years ago

I am currently in the process of Issue Solving.

The following is the cause I identified.

It is judged that the common module is a problem caused by using androidx.appcompat and androidx.core.

Is there a good way to introduce it?

salvogiangri commented 2 years ago

I don't understand: are you trying to use the new sesl libs or the old Design lib? The new sesl libs are meant to completely replace the androidx one, so you must replace the Google modules with ours: check the README of the sesl repo to see which libs you have to replace.

WORLD8848 commented 2 years ago

OneUI Project uses the latest version.

Build.gradle of the common module.

Issue Solving is in progress after determining that duplication occurs in dependencies.

plugins {

id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'kotlin-android'
id 'kotlin-kapt'                                // WORLD8848: Custom Binding 사용을 위해 적용  /////
id 'kotlin-parcelize'                           // WORLD8848: Room  ////////////////////////////
// id 'androidx.navigation.safeargs.kotlin'     // WORLD8848: Navigation component  ////////////

}

android {

namespace           = BASE_NAMESPACE            // WORLD8848    ////////////////////////////////
compileSdk          = BASE_SDK_COMPILE          // WORLD8848    ////////////////////////////////
buildToolsVersion   "30.0.3"                    // WORLD8848    ////////////////////////////////

defaultConfig  {
    minSdk          = BASE_SDK_MIN              // WORLD8848    ////////////////////////////////
    targetSdk       = BASE_SDK_TARGET           // WORLD8848    ////////////////////////////////
    versionCode     = BASE_VERSION_CODE         // WORLD8848    ////////////////////////////////
    versionName     = BASE_VERSION_NAME         // WORLD8848    ////////////////////////////////

    vectorDrawables.useSupportLibrary = true    // MEMO: WORLD8848  ////////////////////////////

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    consumerProguardFiles "consumer-rules.pro"
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = '1.8'
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

buildFeatures {
    viewBinding = true                          // WORLD8848: ViewBinding //////////////////////
    dataBinding = true                          // WORLD8848: Databinding //////////////////////
}

}

dependencies {

// MEMO: Kotlin component                       ////////////////////////////////////////////////
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$BASE_VERSION_KOTLIN_COROUTINES"
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$BASE_VERSION_KOTLIN_COROUTINES"

// implementation "org.jetbrains.kotlin:kotlin-stdlib:$BASE_VERSION_KOTLIN"

// MEMO: AndroidX component                     ////////////////////////////////////////////////
implementation  "androidx.annotation:annotation:$BASE_VERSION_ANDROIDX_ANNOTATION"
implementation  "androidx.appcompat:appcompat:$BASE_VERSION_ANDROIDX_APPCOMPAT"
implementation  "androidx.core:core-ktx:$BASE_VERSION_ANDROIDX_COREKTX"
implementation  "androidx.constraintlayout:constraintlayout:$BASE_VERSION_ANDROIDX_CONSTRAINTLAYOUT"
implementation  "androidx.legacy:legacy-support-v4:$BASE_VERSION_ANDROIDX_LEGACYSUPPORT"

// MEMO: AndroidX compose (BaseInfoBar)         ////////////////////////////////////////////////

// implementation "androidx.compose.ui:ui:$BASE_VERSION_ANDROIDX_COMPOSE" // implementation "androidx.compose.material:material:$BASE_VERSION_ANDROIDX_COMPOSE" // debugImplementation "androidx.compose.ui:ui-tooling:$BASE_VERSION_ANDROIDX_COMPOSE" // debugImplementation "androidx.compose.ui:ui-test-manifest:$BASE_VERSION_ANDROIDX_COMPOSE"

// MEMO: AndroidX lifecycle component           ////////////////////////////////////////////////
implementation  "androidx.lifecycle:lifecycle-common-java8:$BASE_VERSION_ANDROIDX_LIFECYCLE"
implementation  "androidx.lifecycle:lifecycle-livedata-ktx:$BASE_VERSION_ANDROIDX_LIFECYCLE"
implementation  "androidx.lifecycle:lifecycle-viewmodel-ktx:$BASE_VERSION_ANDROIDX_LIFECYCLE"

// MEMO: AndroidX navigation component          ////////////////////////////////////////////////
implementation  "androidx.navigation:navigation-fragment-ktx:$BASE_VERSION_ANDROIDX_NAVIGATION_FRAGMENT"
implementation  "androidx.navigation:navigation-ui-ktx:$BASE_VERSION_ANDROIDX_NAVIGATION_UI"

// MEMO: AndroidX recyclerview component        ////////////////////////////////////////////////
implementation  "androidx.recyclerview:recyclerview:$BASE_VERSION_ANDROIDX_RECYCLERVIEW"

// MEMO: AndroidX room component                ////////////////////////////////////////////////
implementation  "androidx.room:room-ktx:$BASE_VERSION_ANDROIDX_ROOM"
kapt            "androidx.room:room-compiler:$BASE_VERSION_ANDROIDX_ROOM"

// MEMO: Google material                        ////////////////////////////////////////////////
implementation  "com.google.android.material:material:$BASE_VERSION_GOOGLE_MATERIAL"

// MEMO: androidx test implementation           ////////////////////////////////////////////////
testImplementation 'junit:junit:4.13.2'
androidTestImplementation "androidx.test.ext:junit:$BASE_VERSION_ANDROIDX_TEST_EXT"
androidTestImplementation "androidx.test.espresso:espresso-core:$BASE_VERSION_ANDROIDX_TEST_ESPRESSO"
androidTestImplementation "androidx.room:room-testing:$BASE_VERSION_ANDROIDX_ROOM_TEST"    // MEMO: Room

// Library. ONEUI               ////////////////////////////////////////////////////////////////

// implementation("io.github.oneuiproject.sesl:appcompat:$sesl_appcompat_version") // implementation("io.github.oneuiproject.sesl:apppickerview:$sesl_apppickerview_version") // implementation("io.github.oneuiproject.sesl:material:$sesl_material_version") // implementation("io.github.oneuiproject.sesl:indexscroll:$sesl_indexscroll_version") // implementation("io.github.oneuiproject.sesl:picker-basic:$sesl_picker_basic_version") // implementation("io.github.oneuiproject.sesl:picker-color:$sesl_picker_color_version") // implementation("io.github.oneuiproject.sesl:preference:$sesl_preference_version") // implementation("io.github.oneuiproject.sesl:recyclerview:$sesl_recyclerview_version") // implementation("io.github.oneuiproject.sesl:swiperefreshlayout:$sesl_swiperefreshlayout_version")

// MEMO: Database debug                         ////////////////////////////////////////////////
// debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'

}

salvogiangri commented 2 years ago

The sesl libs are commented out, you're still using Google's androidx modules, so it's not a lib issue. I suggest you to start by cleaning your build.gradle, it is messy and it has a lot of dependencies declared, 99% of them is probably not used in your project (stuff such as compose shouldn't be there)

WORLD8848 commented 2 years ago

When using seslibs, [java.lang.IllegalStateException: item_layout.xml is not annotated as @Input ] occurs when the viewBinding and dataBinding section of buildFeatures is set to true.

salvogiangri commented 2 years ago

Again, it's not an issue caused by our libs. Clean up your build.gradle by removing all the unused dependencies (I actually suggest you to start with just the appcompat and material modules, and add the other ones only if you need them)

WORLD8848 commented 2 years ago

Thanks!!!

I did not write an Issue for the library.

Among those who wanted to use the library, I thought I could experience similar errors, so I tried to share the experience.

I'm sorry if you thought it was a library issue.