Title: Cannot find @BindindAdapter in dynamic feature module
Tags: android;android-databinding;dynamic-feature-module;android-binding-adapter
Question: I have extension function in app module
@BindingAdapter(&quot;imageSrc&quot;)
fun setImageUrl(view: ImageView, userId: Int) {
try {
val drawableRes = when {
userId % 6 == 0 -&gt; {
R.drawable.avatar_1_raster
}
userId % 6 == 1 -&gt; {
R.drawable.avatar_2_raster
}
userId % 6 == 2 -&gt; {
R.drawable.avatar_3_raster
}
userId % 6 == 3 -&gt; {
R.drawable.avatar_4_raster
}
userId % 6 == 4 -&gt; {
R.drawable.avatar_5_raster
}
else -&gt; {
R.drawable.avatar_6_raster
}
}
val requestOptions = RequestOptions()
requestOptions.placeholder(R.drawable.ic_launcher_background)
Glide
.with(view.context)
.setDefaultRequestOptions(requestOptions)
.load(drawableRes)
.into(view)
} catch (e: Exception) {
e.printStackTrace()
it works fine when it's used in a layout in app module but when it's called from the same layout that is in a dynamic feature module results compile error below
[databinding] {&quot;msg&quot;:&quot;Cannot find a setter for
\u003candroidx.appcompat.widget.AppCompatImageView app:imageSrc\u003e
that accepts parameter type \u0027int\u0027\n\nIf a binding adapter
provides the setter, check that the adapter is annotated correctly and
that the parameter type
matches.&quot;,&quot;file&quot;:&quot;features/post_detail/src/main/res/layout/fragment_post_detail.xml&quot;,&quot;pos&quot;:[{&quot;line0&quot;:19,&quot;col0&quot;:28,&quot;line1&quot;:19,&quot;col1&quot;:38}]}
Layout that uses this binding
<?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
<layout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
xmlns:tools=&quot;http://schemas.android.com/tools&quot;&gt;
<data&gt;
<variable
name=&quot;item&quot;
type=&quot;com.smarttoolfactory.tutorial8_2dynamicfeatures_complexarchitecture.api.Post&quot; /&gt;
</data&gt;
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=&quot;match_parent&quot;
android:layout_height=&quot;match_parent&quot;&gt;
<androidx.appcompat.widget.AppCompatImageView
android:id=&quot;@+id/ivAvatar&quot;
imageSrc=&quot;@{item.userId}&quot;
android:layout_width=&quot;match_parent&quot;
android:layout_height=&quot;wrap_content&quot;
android:adjustViewBounds=&quot;true&quot;
android:src=&quot;@drawable/avatar_1_raster&quot;
app:layout_constraintEnd_toEndOf=&quot;parent&quot;
app:layout_constraintStart_toStartOf=&quot;parent&quot;
app:layout_constraintTop_toBottomOf=&quot;parent&quot;
app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
<androidx.appcompat.widget.AppCompatTextView
android:id=&quot;@+id/tvTitle&quot;
android:layout_width=&quot;match_parent&quot;
android:layout_height=&quot;wrap_content&quot;
android:layout_margin=&quot;8dp&quot;
android:gravity=&quot;center&quot;
android:text=&quot;@{item.title}&quot;
android:textSize=&quot;26sp&quot;
android:inputType=&quot;textCapWords&quot;
android:textStyle=&quot;bold&quot;
app:layout_constraintEnd_toEndOf=&quot;@id/ivAvatar&quot;
app:layout_constraintStart_toStartOf=&quot;@id/ivAvatar&quot;
app:layout_constraintTop_toBottomOf=&quot;@id/ivAvatar&quot;
tools:text=&quot;Sample Title&quot; /&gt;
<androidx.appcompat.widget.AppCompatTextView
android:id=&quot;@+id/tvBody&quot;
android:layout_width=&quot;match_parent&quot;
android:layout_height=&quot;0dp&quot;
android:layout_marginStart=&quot;8dp&quot;
android:layout_marginTop=&quot;16dp&quot;
android:layout_marginEnd=&quot;8dp&quot;
android:layout_marginBottom=&quot;16dp&quot;
android:text=&quot;@{item.body}&quot;
app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
app:layout_constraintEnd_toEndOf=&quot;@id/ivAvatar&quot;
app:layout_constraintStart_toStartOf=&quot;@id/ivAvatar&quot;
app:layout_constraintTop_toBottomOf=&quot;@id/tvTitle&quot;
tools:text=&quot;Sample Body&quot; /&gt;
</androidx.constraintlayout.widget.ConstraintLayout&gt;
</layout&gt;
Comment: @smuk unfortunately no. I create same binding adapter in each module. If you find more practical answer feel free to post it here.

Comment: Hi there, any news about this? Bumped into the same issue. Thanks!

Comment: I have found a possible duplicate: https://stackoverflow.com/questions/62238993/access-binding-adapters-in-multi-module-project - still no answer :)



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 3, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2020:00:07/30/20', 'FavoriteCount': 1.0, 'PostTypeId': 1, 'Tags': '<android><android-databinding><dynamic-feature-module><android-binding-adapter>', 'Title': 'Cannot find @BindindAdapter in dynamic feature module', 'ViewCount': 381, 'id': 63176547, 'user_AboutMe': '<p>I\'m from Thrace.</p>\n<p><a href="https://www.linkedin.com/in/fatih-%C3%B6zcan-a2259b19b/" rel="nofollow noreferrer">https://www.linkedin.com/in/fatih-özcan-a2259b19b/</a></p>\n<p><a href="https://github.com/SmartToolFactory" rel="nofollow noreferrer">https://github.com/SmartToolFactory</a></p>\n<p>Currently developing Android projects with Jetpack Compose. I developed many apps in the past with Sensors, Location, Canvas, Bluetooth LE, LibGDX, Camera, WebRTC and messaging, and other Android tech stack.</p>\n<p>This is my Jetpack Compose Tutorial that  covers</p>\n<p>Material Widgets, Layout, SubcomposeLayout, custom layouts, State, custom rememberable, recomposition, LaunchedEffect, side-effects, Gesture, Animation, Navigation, Canvas, UIs like whatsapp and others.</p>\n<p><a href="https://github.com/SmartToolFactory/Jetpack-Compose-Tutorials" rel="nofollow noreferrer">https://github.com/SmartToolFactory/Jetpack-Compose-Tutorials</a></p>\n<p>And i have some libraries written with Jetpack Compose including</p>\n<p>Image libraries with Jetpack Compose</p>\n<p><a href="https://github.com/SmartToolFactory/Compose-Image" rel="nofollow noreferrer">https://github.com/SmartToolFactory/Compose-Image</a></p>\n<p>Colorful Sliders With Jetpack Compose</p>\n<p><a href="https://github.com/SmartToolFactory/Compose-Colorful-Sliders" rel="nofollow noreferrer">https://github.com/SmartToolFactory/Compose-Colorful-Sliders</a></p>\n<p>Collection of Cool Color Pickers with Jetpack Compose</p>\n<p><a href="https://github.com/SmartToolFactory/Compose-Color-Picker-Bundle" rel="nofollow noreferrer">https://github.com/SmartToolFactory/Compose-Color-Picker-Bundle</a></p>\n<p>Color Detector with Jetpack Compose</p>\n<p><a href="https://github.com/SmartToolFactory/Compose-Color-Detector" rel="nofollow noreferrer">https://github.com/SmartToolFactory/Compose-Color-Detector</a></p>\n<p>Extended gestures for OnTouchEvent and extended transform gestures</p>\n<p><a href="https://github.com/SmartToolFactory/Compose-Extended-Gestures" rel="nofollow noreferrer">https://github.com/SmartToolFactory/Compose-Extended-Gestures</a></p>\n<p>Chat Layout that assigns position of message and status based on message lines and length and resizes children based on longest sibling like whatsapp</p>\n<p><a href="https://github.com/SmartToolFactory/Flexible-Chat-Box" rel="nofollow noreferrer">https://github.com/SmartToolFactory/Flexible-Chat-Box</a></p>\n<p>You can contact me via smarttoolfactory@icloud.com</p>\n', 'user_AccountId': 7139664.0, 'user_DisplayName': 'Thracian', 'user_Reputation': 22357.0, 'user_Views': 1297.0, 'user_id': 5457853.0}}