前言
在Ubuntu 20.04.4 LTS系统中编译Android12 OTA差分包的时候提示如下报错log:
Warning: releasetools script should be invoked as hermetic Python executable -- build and run `ota_from_target_files` directly.
Traceback (most recent call last):File "./build/tools/releasetools/ota_from_target_files", line 241, in <module>import ota_utilsFile "/home/server1/work/Android12/r12/build/make/tools/releasetools/ota_utils.py", line 21, in <module>import ota_metadata_pb2File "/home/server1/work/Android12/r12/build/make/tools/releasetools/ota_metadata_pb2.py", line 7, in <module>from google.protobuf import descriptor as _descriptor
ImportError: No module named google.protobuf
解决方法:
网上搜索了ImportError: No module named google.protobuf相关的资料,大部分都是建议使用重新安装protobuf。即:
pip uninstall protobuf
pip uninstall google
pip install google
pip install protobuf
试了以后,还是一样的提示上面的报错。
最终解决办法:
sudo apt-get install python-protobuf