我databinding
在我的应用程序中使用它,它运行良好。但是当我启用它时minifyEnabled true
,shrinkResources true
它会显示一些错误。
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); }
我layout.xml
的是
<?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>
现在我的问题是如何为android数据绑定和点击监听器编写progaurd规则。任何帮助将不胜感激,谢谢。