我使用libzip来读取本机代码中的APK内容。
assets/sounds/voice文件夹仅在libzip功能中“消失”。
libzip仍然可以看到其他文件。 我仍然可以在项目文件夹中的assets/sounds/voice中看到它。 我做了很多次clean 。 我仍然可以从bin文件夹解压缩APK文件,我看到所有必需的文件。 (包括assets/sounds/voice文件夹中的文件)我添加了小型日志记录命令,它不会打印assets/sounds/voice文件夹中的文件。 所有其他文件都存在。
int inum = zip_get_num_files(apkzip); for(int i = 0; i < inum; i++){ const char * name = zip_get_name(apkzip, i, 0); __android_log_print(ANDROID_LOG_INFO,"FILEZIP", "zip: %s", name); }我不知道在什么步骤它是错的。 曾经使用我的libzip无法读取的新格式压缩ZPK吗? 或者可能是什么原因。
I use libzip to read APK content in native code.
assets/sounds/voice folder "disappeared" for libzip functions only.
libzip still see other files. I still can see it in assets/sounds/voice in project folder. I did clean many times. I still can unzip APK file from bin folder and I see all required files. (including files from assets/sounds/voice folder)I added small logging command and it does not print files from assets/sounds/voice folder. All other files are present.
int inum = zip_get_num_files(apkzip); for(int i = 0; i < inum; i++){ const char * name = zip_get_name(apkzip, i, 0); __android_log_print(ANDROID_LOG_INFO,"FILEZIP", "zip: %s", name); }I have no idea what at what step it is wrong. Had eclipse compressed ZPK with new format that my libzip does not able to read? or what could be a reason.
最满意答案
这不是libzip的答案,但为什么你必须使用libzip来读取NDK应用程序中的apk文件? 在Android NDK中,您可以使用AAsset API从apk获取文件。 看看“ 如何从Android NDK获取资产 ”。
EDITED
它仍然在我仍然使用的android-5中可用
好。 那么Cocos2d-x的ZipFile怎么样? 它基于Minizip 。
如何从cocos2dx / platform / android / CCFileUtilsAndroid.cpp使用ZipFile
s_pZipFile = new ZipFile(resourcePath, "assets/"); pData = s_pZipFile->getFileData(fullPath.c_str(), pSize);This is not an answer for libzip, but why you have to use libzip to read apk file in NDK application? In Android NDK, you can use AAsset APIs to get file from the apk. Take a look at "How To Get File In Assets From Android NDK".
EDITED
It is not available in android-5 that I still use
Ok. So how about Cocos2d-x's ZipFile? It is based on Minizip.
How to use ZipFile from cocos2dx/platform/android/CCFileUtilsAndroid.cpp
s_pZipFile = new ZipFile(resourcePath, "assets/"); pData = s_pZipFile->getFileData(fullPath.c_str(), pSize);更多推荐
发布评论