ERROR: Could not extract package's data directory. Are you sure that your installed application is debuggable?
ndk-gdb,调试native code,出现以下错误:
ndk-gdb --verbose,查看信息:
--verbose: Print verbose information about the native debugging session setup. Only needed to debug problems when you can't connect and that the error messages printed by ndk-gdb are not enough.
调试手机:HTC Desire Android 2.2
Are you sure that your install application is debuggable?
I'm sure!
1、已修改AndroidManifest.xml,为标签<application />添加属性:android:debuggable="true"
2、ndk-build -NDK_DEBUG=1生成调试版.so库,查看<PROJECT_HOME>/libs/armeabi/目录:
所以,不是这个问题。
在终端运行命令,其中<PACKAGE_NAME>是项目的包名:
adb shell run-as <PACKAGE_NAME> /system/bin/sh -c pwd
run-as: Package '<PACKAGE_NAME>' has corrupt installation
最后,解决方法,在“终端”输入:
1、adb shell
2、su (使用root权限,手机已root,点击手机屏幕中的 授权) 注:手机htc A510e root方法,参考
3、ls -l /data (/data权限信息如下:
4、修改权限
# chmod 771 /data/data
# chown system.system /data/data
5、再次执行ls -l /data
启动程序后,再次运行ndk-gdb,成功: