ERROR: Could not extract package's data directory. Are you sure that your installed application is d...

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

最后,google一下,成功解决了该问题:

1、adb shell

2、su,使用root权限(手机已root)

3、ls -l /data,/data权限信息如下:

4、修改权限

# chmod 771 /data/data
# chown system.system /data/data

5、再次执行ls -l /data

启动程序后,再次运行ndk-gdb,成功:

转载于:https://www.cnblogs.com/dyingbleed/archive/2012/10/07/2713991.html

猜你喜欢

转载自blog.csdn.net/weixin_33895016/article/details/93301819