问题描述
我在 Android 的 Material Components 中使用 Cards 制作了一个简单的应用程序。当我尝试在我的“OnePlus AC2001”手机中运行它时,我在 logcat
中收到此错误。
2021-01-31 17:28:59.544 26933-26933/? E/rialdesigncard: UnkNown bits set in runtime_flags: 0x28000
但是当我在模拟器中运行应用程序时我没有收到任何错误。
这是我的 MainActivity.java
文件:
public class MainActivity extends AppCompatActivity {
CardView cardView;
TextView textView;
CheckBox checkBox;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
init();
}
private void init() {
cardView = findViewById(R.id.my_card_ui);
textView = findViewById(R.id.title_text);
checkBox = findViewById(R.id.checkBox);
cardView.setonClickListener(v -> {
checkBox.setChecked(checkBox.isChecked()? false: true);
textView.setText("First title");
});
}
}
这是我的ActivityMain.xml
:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:id="@+id/my_card_ui"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checkable="true"
android:clickable="true"
android:focusable="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="30dp">
<CheckBox
android:id="@+id/checkBox"
android:layout_width="30dp"
android:layout_height="30dp" />
<TextView
android:id="@+id/title_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Title 1"
android:textColor="@color/black"
android:textSize="30dp"
android:textStyle="bold" />
<TextView
android:id="@+id/title_para"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="I am a paragraph and I am in a card. I am a paragraph and I am in a card. I am a paragraph and I am in a card."
android:textColor="@color/purple_700"
android:textSize="20dp" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
解决方法
一段时间以来,我一直看到此错误(OnePlus 设备),但我也找不到解决方案。不过,该错误似乎不会以任何方式影响应用。
附加信息点:
我观察到,每当我在真实设备上运行/调试应用程序时,Logcat 中都会出现此错误,但它在运行/调试控制台中并没有一致显示。我还没有尝试检查(如您所见)在使用模拟器时是否复制了错误。
此外,我的 Logcat 在设备运行时显示了许多其他软件包的 Unknown bits set in runtime_flags: 0x20000
错误。一些示例:.android.dialer
、oneplus.weather
、twitter.android
等。
这是我目前发现的:
-
在 ARM DS5 DUI0446U 调试器 User Guide 中,内部 RAM 的可能内存映射可以介于 0x8000 和 0x28000 之间。我不是计算机工程背景,我不确定这是否是进一步理解问题的相关方向。搜索 Android 运行时 (ART) 站点(this,或者一般来说,this)没有产生有用的结果。
-
对于相关错误,通过遵循 ART this 代码的 source 答案,
0x28000
似乎与DEBUG_IGNORE_APP_SIGNAL_HANDLER
标志或 { {1}} 标志(截至本文发布时为DISABLE_TEST_API_ENFORCEMENT_POLICY
)。 [例如,line 154-155
是1 << 17
]
我对这两个标志中的任何一个都没有更深入的了解。尽管如此,0x20000
错误在生产应用程序中似乎很常见。虽然这并不表示 0x20000
错误同样没有问题,但在我看来,它确实说明了 0x28000
的性质。
与这些标志相关的错误(请参阅源代码中的 runtime_flags
)可能不会真正“破坏”应用程序。需要一些进一步的信息才能绝对确定,但以上信息可能足以让您不必担心应用程序被破坏。
P.S.:如果您认为此回复足够好,请将其标记为答案,以便我也会收到一些反馈。