APK签名android.content.res.Resources$NotFoundException resource ID #0x7f060000

本文记录了一个关于Android应用程序在尝试从资源文件加载MP3时遇到的崩溃问题,详细展示了错误日志,并探讨了可能的原因及解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

What steps will reproduce the problem?
1. Decode an app with a raw resource (such as an MP3)
2. Build the app without changing a thing

What is the expected output? What do you see instead?
E/AndroidRuntime( 1584): FATAL EXCEPTION: main
E/AndroidRuntime( 1584): java.lang.RuntimeException: Unable to create application com.app.android.Application: android.content.res.Resources$NotFoundException: File res/raw/message.mp3 from drawable resource ID #0x7f060000
E/AndroidRuntime( 1584): 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3431)
E/AndroidRuntime( 1584): 	at android.app.ActivityThread.access$2200(ActivityThread.java:123)
E/AndroidRuntime( 1584): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:977)
E/AndroidRuntime( 1584): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1584): 	at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1584): 	at android.app.ActivityThread.main(ActivityThread.java:3839)
E/AndroidRuntime( 1584): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1584): 	at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 1584): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
E/AndroidRuntime( 1584): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
E/AndroidRuntime( 1584): 	at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1584): Caused by: android.content.res.Resources$NotFoundException: File res/raw/message.mp3 from drawable resource ID #0x7f060000
E/AndroidRuntime( 1584): 	at android.content.res.Resources.openRawResourceFd(Resources.java:897)
E/AndroidRuntime( 1584): 	at android.media.SoundPool.load(SoundPool.java:204)
E/AndroidRuntime( 1584): 	at com..android.util.SoundManager.initializeSounds(SoundManager.java:49)
E/AndroidRuntime( 1584): 	at com..android.util.SoundManager.<init>(SoundManager.java:39)
E/AndroidRuntime( 1584): 	at com..android.util.SoundManager.initialize(SoundManager.java:132)
E/AndroidRuntime( 1584): 	at com.app.android.Application.onCreate(Application.java:48)
E/AndroidRuntime( 1584): 	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:969)
E/AndroidRuntime( 1584): 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3428)
E/AndroidRuntime( 1584): 	... 10 more
E/AndroidRuntime( 1584): Caused by: java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
E/AndroidRuntime( 1584): 	at android.content.res.AssetManager.openNonAssetFdNative(Native Method)
E/AndroidRuntime( 1584): 	at android.content.res.AssetManager.openNonAssetFd(AssetManager.java:449)
E/AndroidRuntime( 1584): 	at android.content.res.Resources.openRawResourceFd(Resources.java:894)
E/AndroidRuntime( 1584): 	... 17 more


What version of the product are you using? On what operating system?
Latest / Ubuntu

Please provide any additional information below.

The res/raw mp3 is included in R$raw.smali and in the actual APK and manifest
Apr 23, 2011
#1 WesGar...@gmail.com
FYI --keep-broken-res does not change anything
Apr 23, 2011
#2 WesGar...@gmail.com
FYI -r flag does not change anything either
May 2, 2011
Project Member #3 Brut.alll
"Caused by: java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed"

Try to unzip resulting apk file and zip it back without a compression. Sometimes there are problems with resources.arsc file, if it's compressed and bigger than ~1MB.
May 3, 2011
Project Member #4 Brut.alll
I think this is the same as  Issue 67 .
Nov 16, 2012
Project Member #5 connor.tumbleson
(No comment was entered for this change.)
还是会报Process crashed before executing the test(s): android.content.res.Resources$NotFoundException: String resource ID #0x0 at android.content.res.Resources.getText(Resources.java:466) at android.content.res.Resources.getString(Resources.java:559) at android.content.Context.getString(Context.java:946) at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:217) at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:207) at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:49) at android.content.ContentProvider.attachInfo(ContentProvider.java:2644) at android.content.ContentProvider.attachInfo(ContentProvider.java:2613) at android.app.ActivityThread.installProvider(ActivityThread.java:8292) at android.app.ActivityThread.installContentProviders(ActivityThread.java:7807) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7488) at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2416) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8705) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:913) INSTRUMENTATION_RESULT: shortMsg=Process crashed. INSTRUMENTATION_CODE: 0
最新发布
07-31
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值