我的apk包中有classes.dex文件,还有assets目录下的key文件,
我怎么在底层的代码中获得这两个文件呢?着急 谢谢
classes.dex是你打包之后生成的文件。你读取它干嘛?
assets下面的文件读取需要使用**AssetManager**类。
1.先在Activity里面调用getAssets() 来获取AssetManager引用。
2.再用AssetManager的open(String fileName, int accessMode) 方法则指定读取的文件以及访问模式就能得到输入流InputStream。
3.用已经open file 的inputStream读取文件,读取完成后记得inputStream.close() (防止OOM)
4.调用AssetManager.close() 关闭AssetManager。