我有问题从资产中获取位图
我尝试在调试模式下运行我的应用程序,当我点击播放(调用保存在资源文件夹中的图像)时,应用程序停止工作,调试器给我这些断点
SceneActivity [line: 536] - onCreate(Bundle)
SceneActivity [line: 763] - getBitmapFromAsset(String)
SceneActivity [line: 792] - createObjectResizerManager()
SceneActivity [line: 796] - createObjectResizerManager()
和这些堆栈
Thread [<1> main] (Suspended (breakpoint at line 763 in SceneActivity))
<VM does not provide monitor information>
SceneActivity.getBitmapFromAsset(String) line: 763
SceneActivity.onCreate(Bundle) line: 468
SceneActivity(Activity).performCreate(Bundle) line: 5104
Instrumentation.callActivityOnCreate(Activity, Bundle) line: 1080
ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2144
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2230
ActivityThread.access$600(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 141
ActivityThread$H.handleMessage(Message) line: 1234
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 137
ActivityThread.main(String[]) line: 5041
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 511
ZygoteInit$MethodAndArgsCaller.run() line: 793
ZygoteInit.main(String[]) line: 560
NativeStart.main(String[]) line: not available [native method]
这是我的代码
/**
* Retrieves Bitmap from Asset
* @param strName
* @return
* @throws IOException
*/
private Bitmap getBitmapFromAsset(String strName) throws IOException {
AssetManager assetManager = getAssets();
InputStream istr = assetManager.open(strName);
Bitmap bitmap = BitmapFactory.decodeStream(istr);
istr.close();
return bitmap;
}
/**
注意:该应用程序工作正常,直到我尝试将其导出为APK,这涉及我在SDK“安装sdk构建工具20”中进行一些更新以解决proguard的问题“无法找到引用的类org.w3c。 dom.bootstrap.DOMImplementationRegistry“