android NDK。(android NDK. libzip stopped to sub folder)

编程入门 行业动态 更新时间:2024-10-25 14:28:03
android NDK。(android NDK. libzip stopped to sub folder)

我使用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);

更多推荐

本文发布于:2023-07-27 15:30:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1292420.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NDK   android   libzip   folder   stopped

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!