I am using databinding
in my app and it is working perfectly. But when I enable minifyEnabled true
and shrinkResources true
than it show me some errors.
Execution failed for task':app:transformClassesAndResourcesWithR8ForDebug'.
Caused by: com.android.tools.r8.utils.AbortException: Error: D:\TUK_Sep_Conclave\TUK_Septmber\app\build\intermediates\proguard-rules\debug\aapt_rules.txt, offset: 48276, line: 457, column: 33, Expected field or method name at D:\TUK_Sep_Conclave\TUK_Septmber\app\build\intermediates\proguard-rules\debug\aapt_rules.txt:457:33
-keepclassmembers class * { *** @{(view)->listener.onClick(view)}(android.view.View); }
^
at com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:101)
Suppressed: com.android.tools.r8.shaking.ProguardRuleParserException: Expected field or method name at D:\TUK_Sep_Conclave\TUK_Septmber\app\build\intermediates\proguard-rules\debug\aapt_rules.txt:457:33
-keepclassmembers class * { *** @{(view)->listener.onClick(view)}(android.view.View); }
and my layout.xml
is
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.ui.user.activity.ContactUsActivity"
tools:ignore="HardcodedText">
<data>
<variable
name="listener"
type="com.example.ui.user.activity.ContactUsActivity" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/action_call_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:onClick="@{(view)->listener.onClick(view)}"
android:padding="3dip"
android:text="+91-1234567890"
android:textColor="@android:color/white"
android:textSize="12sp" />
</LinearLayout>
</layout>
Now my question is how to write progaurd rules for android databinding and click listener. Any help will be appreciated, Thanks.