Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decoder crashes #1301

Closed
lemachi opened this issue Aug 12, 2016 · 4 comments
Closed

Decoder crashes #1301

lemachi opened this issue Aug 12, 2016 · 4 comments

Comments

@lemachi
Copy link

lemachi commented Aug 12, 2016

Information

  1. Apktool Version (apktool -version) - 2.2.0
  2. Operating System (Mac, Linux, Windows) - Mac
  3. APK From? (Playstore, ROM, Other) - local build

Stacktrace/Logcat

java.lang.IllegalAccessError: class brut.androlib.meta.StringExRepresent$RepresentStringEx cannot access its superclass org.yaml.snakeyaml.representer.SafeRepresenter$RepresentString
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at brut.androlib.meta.StringExRepresent.<init>(StringExRepresent.java:23)
    at brut.androlib.meta.MetaInfo.getYaml(MetaInfo.java:44)
    at brut.androlib.meta.MetaInfo.save(MetaInfo.java:54)
    at brut.androlib.meta.MetaInfo.save(MetaInfo.java:63)
    at brut.androlib.Androlib.writeMetaFile(Androlib.java:245)
    at brut.androlib.ApkDecoder.writeMetaFile(ApkDecoder.java:305)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:162)
    at brut.androlib.ApkDecoder$decode$2.call(Unknown Source)

Steps to Reproduce

import org.junit.Test
import brut.androlib.ApkDecoder;

class ApkToolsTest {

    @Test
    void testExplode() {
        File outDir = new File("exploded-apk");

        File file = new File("test.apk");
        println file.length();
        ApkDecoder decoder = new ApkDecoder();
        decoder.setApkFile(file);
        decoder.setOutDir(outDir);
        decoder.setDecodeSources((short)0);
        decoder.setForceDelete(true);
        decoder.decode();
    }

}

Frameworks

If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files
(.apks that live in /system/framework or /system/priv-app)

APK

If this APK can be freely shared, please upload/attach a link to it.

Private, sorry

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything?
  2. If you are trying to install a modified apk, did you resign it?
  3. Are you using the latest apktool version?

This works on 2.0.1 but breaks on 2.2.0.
Any ideas would be appreciated.

Cheers, Michael

@iBotPeaches
Copy link
Owner

I believe IllegalAccessError come from having multiple classes with different permissions. This may come from a discrepancy in class paths where multiple versions of the same class come into play, thus one version has a private method, etc.

I don't duplicate this at all on 2.2.0. Are you building apktool 2.2.0 into some bundled application or are you using it directly?

@lemachi
Copy link
Author

lemachi commented Aug 19, 2016

I'm using ApkTool in Gradle. If I'm wrapping it into an Exec task which spawns a new process it works jut fine, but using the class directly fails after the upgrade to 2.2.0.

@iBotPeaches
Copy link
Owner

PRs are accepted if you can track this down. I won't have time for a bit to setup a test case of running the apktool class directly through Gradle in a test format.

Too much has changed between 2.0.1 -> 2.0.2 -> 2.0.3 -> 2.1.0 -> 2.1.1 -> 2.2.0, but my guess based on the stack trace is this commit is involved - https://github.com/iBotPeaches/Apktool/pull/1128/files

@iBotPeaches
Copy link
Owner

Apktool hasn't explored a true library behavior yet. Tossed into roadmap to explore this - 46a4a25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants