libgdx - .apk 中的资源文件加倍
这是我第一次尝试将 libgdx 项目打包成 .apk 文件,令我惊讶的是该文件比资源文件总大小大 2 倍。资产文件夹应该是 4MB,但 .apk 文件变成了 8MB。 我尝试通过提取 .apk 文件来检查问题的根源。起初我以为是库文件导致了问题, 但后来我检查了一下,它只需要1MB内存。然后我发现 asset 文件夹中的图像和音乐文件夹被复制到外部,并且占用的大小是总大小的两倍。
这是我在 eclipse 项目中的 android 目录结构
-src
-gen
-asset
->image (30kB)
->musics (3MB)
->sfx (100kB)
-bin
-libs
-res
,这是 .apk 文件内的目录,
-assets
->image (30kB)
->musics (3MB)
->sfx (100kB)
-com
-images (30kB)
-lib
-META-INF
-musics (3MB)
-res
-sfx (100kB)
这里有人遇到过同样的问题吗? 有什么解决办法吗? 谢谢
This is my first time trying to package my libgdx project into .apk file and I get surprised that the file is 2 times larger than the total size of asset files. the assets folder supposed to be 4MB but the .apk file became 8MB.
I tried to check the source of the problem by extracting the .apk file. at first I thought it was the library file that cause the problem,
but then I checked that it only take 1MB of memory. Then I found out that the image and music folder inside asset folder are copied outside and that take double the size of the total size.
here is my android directory structure in eclipse project
-src
-gen
-asset
->image (30kB)
->musics (3MB)
->sfx (100kB)
-bin
-libs
-res
and here is the directory inside .apk file
-assets
->image (30kB)
->musics (3MB)
->sfx (100kB)
-com
-images (30kB)
-lib
-META-INF
-musics (3MB)
-res
-sfx (100kB)
is there anyone here ever had the same problem?
any solution about this?
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的资源会被拉入两次:一次来自 $ANDROID_PROJECT/assets 目录,一次来自桌面项目的类路径。
有3个项目,共享代码,桌面,android。共享代码项目包含实际的应用程序代码,桌面项目包含指向 android/assets 文件夹的源文件夹链接以及桌面启动器类,android 项目包含资产和 android 启动器类。
您还可以尝试不从主项目中导出资产源文件夹,但这有点无聊。
Your assets get pulled in twice: once from the $ANDROID_PROJECT/assets directory, and once from the classpath of your desktop project.
Have 3 projects, shared code, desktop, android. The shared code project contains the actual application code, the desktop project contains a source folder link to the android/assets folder as well as the desktop starter class, the android project contains the assets and the android starter class.
You can also try to not export the assets source folder from your main project, that's a bit more meh though.