Android Studio报错Error Running app: cannot debug application

来源:互联网 发布:零起点学算法 编辑:程序博客网 时间:2024/05/03 09:31

Android studio中的项目无法对app这个module进行debug。报错信息如下:

Cannot debug application xx.xxx.xxx.app on device lge_nexus_5x(此处表示你的手机型号).你的xxxapp不能在型号为Nexus 5x的LGE手机上调试。This application does not have the debuggable attribute enabled in its manifest.这个项目在清单文件(AndroidManifest.xml)中没有设置可以调试的参数。If you have manually set it in the manifest, then remove it and let the IDE automatically assign it.如果你已经手动在清单文件种设置了这个属性,请remove掉,让IDE自动生成。If you are using Gradle, make sure that your current variant is debuggable.如果你使用Gradle,确认你现在的变体是可调试的。

解决方法

如果你手动删除了Manifest里面的设置
<application android:debuggable="true"></application>
这个属性在设置后manifest中会有红线提示,release版本中需要删除

如果删除了这个属性还是没有用,在Android Studio界面左下角找到Build Variants,点击Build Variants。出现如下界面:
这里写图片描述

将Build Varient中你想要debug的module的Varient属性变成debug就行了。

阅读全文
0 0