第一种是指
sync [-l] [-z ALGORITHM] [-Z] [all|data|odm|oem|product|system|system_ext|vendor]
sync a local build from $ANDROID_PRODUCT_OUT to the device (default all)
-n: dry run: push files to device without storing to the filesystem
-l: list files that would be copied, but don't copy them
-z: enable compression with a specified algorithm (any/none/brotli/lz4/zstd)
-Z: disable compression
这个adb sync 似乎只用于把在电脑上源码构建的Android系统push到手机上
$ANDROID_PRODUCT_OUT
是一个环境变量,用于指示 Android 编译系统生成的构建输出目录的路径。在 Android 开发环境中,该变量通常设置为构建输出目录的完整路径。
Android 编译系统会根据所选的目标设备和其他配置参数,将编译结果生成到 $ANDROID_PRODUCT_OUT
目录中。该目录中包含了构建所需的各种文件和目录,例如系统镜像文件、应用程序等。
如果电脑上没有设置这个ANDROID_PRODUCT_OUT,会输出 adb.exe: product directory not specified; set $ANDROID_PRODUCT_OUT
https://medium.com/@yigitpirildak/syncing-aosp-build-changes-using-adb-sync-885ce12e5cc7
https://xdaforums.com/t/adb-sync-question.552372/
https://android.googlesource.com/platform/packages/modules/adb/+/refs/heads/master
看源码
std::vector<std::string> partitions{"data", "odm", "oem", "product", "system", "system_ext", "vendor"}; bool found = false; for (const auto& partition : partitions) { if (src == "all" || src == partition) { std::string src_dir{product_file(partition)}; if (!directory_exists(src_dir)) continue; found = true; if (!do_sync_sync(src_dir, "/" + partition, list_only, compression, dry_run)) { return 1; } } }
从源码来看,
"data", "odm", "oem", "product","system", "system_ext", "vendor" 这些构建出来应该都是一个个目录bool directory_exists(const std::string& path) { struct stat sb; return stat(path.c_str(), &sb) != -1 && S_ISDIR(sb.st_mode); } struct stat S_ISDIR这些都是linux的库,看起来是用了mingw
标签:src,sync,system,adb,指代,ANDROID,OUT From: https://www.cnblogs.com/hhdom/p/18012419