次のように「classes.dex」のためのInputStreamを取得することができる場合があります
- は、アプリケーションのAPKコンテナへのパスを取得します。
- JarFileクラスのおかげで、あなたのapkコンテナ内の "classes.dex"エントリを取得します。
- 入力ストリームを取得してください。ここで
例示するためのコードの抜粋です:
// Get the path to the apk container.
String apkPath = getApplicationInfo().sourceDir;
JarFile containerJar = null;
try {
// Open the apk container as a jar..
containerJar = new JarFile(apkPath);
// Look for the "classes.dex" entry inside the container.
ZipEntry ze = containerJar.getEntry("classes.dex");
// If this entry is present in the jar container
if (ze != null) {
// Get an Input Stream for the "classes.dex" entry
InputStream in = containerJar.getInputStream(ze);
// Perform read operations on the stream like in.read();
// Notice that you reach this part of the code
// only if the InputStream was properly created;
// otherwise an IOException is raised
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (containerJar != null)
try {
containerJar.close();
} catch (IOException e) {
e.printStackTrace();
}
}
はそれが役に立てば幸い!
これを達成できましたか?私は同じものが必要であり、手がかりを見つけることができません。あなたが私をこのように導くことができれば、大きな助けになるでしょう。 – Sathish