选择菜单选项时出现 NonSDKApi 违规

问题描述

当我选择查看菜单选项时,我遇到了 NonSdkApiUsedViolation 违规,违规是... "Landroid/widget/AbsListView;->mIsChildViewEnabled:Z"

我重构了我的项目以迁移到 Androidx 并设置 gradle 属性

    android.useAndroidX=true`
    android.enableJetifier=true
    android.enableR8.fullMode=false

我正在努力寻找触发此违规行为的任何内容,该应用程序运行正常,我只是不确定是否要忽略此问题。 总的来说,我不知道如何识别或修复报告的任何 NonSDKApi 违规行为。

如有任何帮助我理解或提供任何建议以查找和消除此特定 SDK 违规行为,我们将不胜感激

依赖项{

implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.android.gms:play-services-maps:17.0.1'
implementation 'com.google.android.libraries.places:places:2.4.0'

implementation fileTree(dir: 'libs',include: ['*.jar'])

implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation 'com.android.volley:volley:1.2.0'
implementation 'com.google.firebase:firebase-crashlytics:18.1.0'
implementation 'com.google.firebase:firebase-analytics:19.0.0'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

}

24400-24400 D/StrictMode:StrictMode 政策违规:android.os.strictmode.NonSdkApiUsedViolation:Landroid/widget/AbsListView;->mIsChildViewEnabled:Z 在 android.os.StrictMode.lambda$static$1(StrictMode.java:416) 在 android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(未知来源:2) 在 java.lang.Class.getDeclaredField(Native Method) 在 androidx.appcompat.widget.DropDownListView.(DropDownListView.java:124) 在 androidx.appcompat.widget.MenuPopupWindow$MenuDropDownListView.(MenuPopupWindow.java:147) 在 androidx.appcompat.widget.MenuPopupWindow.createDropDownListView(MenuPopupWindow.java:80) 在 androidx.appcompat.widget.ListPopupWindow.buildDropDown(ListPopupWindow.java:1178) 在 androidx.appcompat.widget.ListPopupWindow.show(ListPopupWindow.java:663) 在 androidx.appcompat.view.menu.StandardMenuPopup.tryShow(StandardMenuPopup.java:181) 在 androidx.appcompat.view.menu.StandardMenuPopup.show(StandardMenuPopup.java:208) 在 androidx.appcompat.view.menu.MenuPopupHelper.showPopup(MenuPopupHelper.java:296) 在 androidx.appcompat.view.menu.MenuPopupHelper.tryShow(MenuPopupHelper.java:182) 在 androidx.appcompat.widget.ActionMenuPresenter$OpenOverflowRunnable.run(ActionMenuPresenter.java:792) 在 android.os.Handler.handleCallback(Handler.java:938) 在 android.os.Handler.dispatchMessage(Handler.java:99) 在 android.os.Looper.loop(Looper.java:246) 在 android.app.ActivityThread.main(ActivityThread.java:8512) 在 java.lang.reflect.Method.invoke(Native Method) 在 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) 在 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1139)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...