use of brut.directory.ExtFile in project Apktool by iBotPeaches.
the class ReferenceVersionCodeTest method referenceBecomesLiteralTest.
@Test
public void referenceBecomesLiteralTest() throws BrutException, IOException {
String apk = "issue1234.apk";
// decode issue1234.apk
ApkDecoder apkDecoder = new ApkDecoder(new File(sTmpDir + File.separator + apk));
ExtFile decodedApk = new ExtFile(sTmpDir + File.separator + apk + ".out");
apkDecoder.setOutDir(new File(sTmpDir + File.separator + apk + ".out"));
apkDecoder.decode();
MetaInfo metaInfo = new Androlib().readMetaFile(decodedApk);
assertEquals("v1.0.0", metaInfo.versionInfo.versionName);
}
use of brut.directory.ExtFile in project Apktool by iBotPeaches.
the class ReferenceVersionCodeTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception, BrutException {
TestUtils.cleanFrameworkFile();
sTmpDir = new ExtFile(OS.createTempDirectory());
TestUtils.copyResourceDir(LargeIntsInManifestTest.class, "brut/apktool/issue1234/", sTmpDir);
}
use of brut.directory.ExtFile in project Apktool by iBotPeaches.
the class SharedLibraryTest method isSharedResourceDecodingAndRebuildingWorking.
@Test
public void isSharedResourceDecodingAndRebuildingWorking() throws IOException, BrutException {
String library = "library.apk";
String client = "client.apk";
// setup apkOptions
ApkOptions apkOptions = new ApkOptions();
apkOptions.frameworkFolderLocation = sTmpDir.getAbsolutePath();
apkOptions.frameworkTag = "shared";
// install library/framework
new Androlib(apkOptions).installFramework(new File(sTmpDir + File.separator + library));
assertTrue(fileExists("2-shared.apk"));
// decode client.apk
ApkDecoder apkDecoder = new ApkDecoder(new File(sTmpDir + File.separator + client));
apkDecoder.setOutDir(new File(sTmpDir + File.separator + client + ".out"));
apkDecoder.setFrameworkDir(apkOptions.frameworkFolderLocation);
apkDecoder.setFrameworkTag(apkOptions.frameworkTag);
apkDecoder.decode();
// decode library.apk
ApkDecoder libraryDecoder = new ApkDecoder(new File(sTmpDir + File.separator + library));
libraryDecoder.setOutDir(new File(sTmpDir + File.separator + library + ".out"));
libraryDecoder.setFrameworkDir(apkOptions.frameworkFolderLocation);
libraryDecoder.setFrameworkTag(apkOptions.frameworkTag);
libraryDecoder.decode();
// build client.apk
ExtFile clientApk = new ExtFile(sTmpDir, client + ".out");
new Androlib(apkOptions).build(clientApk, null);
assertTrue(fileExists(client + ".out" + File.separator + "dist" + File.separator + client));
// build library.apk (shared library)
ExtFile libraryApk = new ExtFile(sTmpDir, library + ".out");
new Androlib(apkOptions).build(libraryApk, null);
assertTrue(fileExists(library + ".out" + File.separator + "dist" + File.separator + library));
}
use of brut.directory.ExtFile in project Apktool by iBotPeaches.
the class UnknownCompressionTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception, BrutException {
TestUtils.cleanFrameworkFile();
sTmpDir = new ExtFile(OS.createTempDirectory());
TestUtils.copyResourceDir(LargeIntsInManifestTest.class, "brut/apktool/unknown_compression/", sTmpDir);
String apk = "deflated_unknowns.apk";
ApkOptions apkOptions = new ApkOptions();
apkOptions.frameworkFolderLocation = sTmpDir.getAbsolutePath();
sOriginalFile = new ExtFile(sTmpDir, apk);
// decode deflated_unknowns.apk
ApkDecoder apkDecoder = new ApkDecoder(sOriginalFile);
apkDecoder.setOutDir(new File(sOriginalFile.getAbsolutePath() + ".out"));
apkDecoder.decode();
// build deflated_unknowns
ExtFile clientApkFolder = new ExtFile(sOriginalFile.getAbsolutePath() + ".out");
new Androlib(apkOptions).build(clientApkFolder, null);
sBuiltFile = new ExtFile(clientApkFolder, "dist" + File.separator + apk);
}
use of brut.directory.ExtFile in project Apktool by iBotPeaches.
the class AndResGuardTest method checkifAndResDecodeRemapsRFolder.
@Test
public void checkifAndResDecodeRemapsRFolder() throws BrutException, IOException {
String apk = "issue1170.apk";
// decode issue1170.apk
ApkDecoder apkDecoder = new ApkDecoder(new File(sTmpDir + File.separator + apk));
sTestOrigDir = new ExtFile(sTmpDir + File.separator + apk + ".out");
apkDecoder.setOutDir(new File(sTmpDir + File.separator + apk + ".out"));
apkDecoder.decode();
checkFileExists("res/mipmap-hdpi-v4/a.png");
}
Aggregations