copy db file with adb pull results in 'permission denied' error

前端 未结 15 780
执笔经年
执笔经年 2020-12-13 17:13

I just rooted my Nexus 5 using this method: http://www.phonearena.com/news/How-to-root-Google-Nexus-5_id49014

I also enabled USB debugging in the developer options.<

15条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-13 17:52

    Since I've updated to Android Oreo, I had to use this script to fix 'permission denied' issue.

    This script on Mac OS X will copy your db file to Desktop. Just change it to match your ADB_PATH, DESTINATION_PATH and PACKAGE NAME.

    #!/bin/sh
    ADB_PATH="/Users/xyz/Library/Android/sdk/platform-tools"
    PACKAGE_NAME="com.example.android"
    DB_NAME="default.realm"
    DESTINATION_PATH="/Users/xyz/Desktop/${DB_NAME}"
    NOT_PRESENT="List of devices attached"
    ADB_FOUND=`${ADB_PATH}/adb devices | tail -2 | head -1 | cut -f 1 | sed 's/ *$//g'`
    if [[ ${ADB_FOUND} == ${NOT_PRESENT} ]]; then
        echo "Make sure a device is connected"
    else
         ${ADB_PATH}/adb exec-out run-as ${PACKAGE_NAME} cat files/${DB_NAME} > ${DESTINATION_PATH}
    fi
    

提交回复
热议问题