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

UnsupportedClassVersionError: Unsupported major.minor version 52.0 #10

Closed
hisxo opened this issue Dec 20, 2019 · 5 comments
Closed

UnsupportedClassVersionError: Unsupported major.minor version 52.0 #10

hisxo opened this issue Dec 20, 2019 · 5 comments

Comments

@hisxo
Copy link

hisxo commented Dec 20, 2019

Hello,

First, thanks for your tool! I've an error whenI try to patch an APK :

npx apk-mitm test.apk --apktool apktool_2.3.0.jar

  ╭ apk-mitm v0.6.1
  ├ apktool custom version
  ╰ uber-apk-signer v1.1.0

  Using temporary directory:
  /tmp/74eccfd812ae579e107cc604ac214bb9

  ✔ Decoding APK file
  ✔ Modifying app manifest
  ✔ Modifying network security config
  ✔ Disabling certificate pinning
  ✔ Encoding patched APK file
  ⠴ Signing patched APK file
(node:1126) UnhandledPromiseRejectionWarning: Error: Command failed with exit code 1: java -jar /usr/lib/node_modules/apk-mitm/jar/uber-apk-signer.jar --allowResign --overwrite --apks /tmp/74eccfd812ae579e107cc604ac214bb9/tmp.apk
    at makeError (/usr/lib/node_modules/apk-mitm/node_modules/execa/lib/error.js:56:11)
    at handlePromise (/usr/lib/node_modules/apk-mitm/node_modules/execa/index.js:114:26)

I tried with others version of apktool. With 2.3.2 and above I've this error:

npx apk-mitm test.apk --apktool apktool_2.3.3.jar

  ╭ apk-mitm v0.6.1
  ├ apktool custom version
  ╰ uber-apk-signer v1.1.0

  Using temporary directory:
  /tmp/2f2fba23aedf204118557b72e45c0d1a

  ✔ Decoding APK file
  ✔ Modifying app manifest
  ✔ Modifying network security config
  ✔ Disabling certificate pinning
  ❯ Encoding patched APK file
    ↓ Encoding using AAPT2 [skipped]
      → Failed, falling back to AAPT...
    ✖ Encoding using AAPT [fallback]
      → Command failed with exit code 1: java -jar apktool_2.3.3.jar build /tmp/2f2fba23aedf204118557b72e45c0d1a/decode --output /tmp/2f2fba23aedf204118557b72e45c0d
…
    Signing patched APK file

   Failed!  An error occurred:

 Error: Command failed with exit code 1: java -jar apktool_2.3.3.jar build /tmp/2f2fba23aedf204118557b72e45c0d1a/decode --output /tmp/2f2fba23aedf204118557b72e45c0d1a/tmp.apk

Do you have an idea?

Thanks

@shroudedcode
Copy link
Owner

Thanks for the report, Adrien! Could you try running the individual commands (everything after Command failed with exit code 1:) manually and see if that gives you more useful output?

@hisxo
Copy link
Author

hisxo commented Dec 21, 2019

Hi @shroudedcode

Yes, this is the result of these two commands:

java -jar /usr/lib/node_modules/apk-mitm/jar/uber-apk-signer.jar --allowResign --overwrite --apks /tmp/74eccfd812ae579e107cc604ac214bb9/tmp.apk

Exception in thread "main" java.lang.UnsupportedClassVersionError: at/favre/tools/apksigner/SignTool : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:808)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:443)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:65)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:349)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:348)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:430)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:323)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
java -jar apktool_2.3.3.jar build /tmp/2f2fba23aedf204118557b72e45c0d1a/decode --output /tmp/2f2fba23aedf204118557b72e45c0d1a/tmp.apk

I: Using Apktool 2.3.3
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
S: WARNING: Could not write to (/root/.local/share/apktool/framework), using /tmp instead...
S: Please be aware this is a volatile directory and frameworks could go missing, please utilize --frame-path if the default storage directory is unavailable
W: /tmp/2f2fba23aedf204118557b72e45c0d1a/decode/AndroidManifest.xml:2: error: No resource identifier found for attribute 'compileSdkVersion' in package 'android'
W:
W: /tmp/2f2fba23aedf204118557b72e45c0d1a/decode/AndroidManifest.xml:2: error: No resource identifier found for attribute 'compileSdkVersionCodename' in package 'android'
W:
W: /tmp/2f2fba23aedf204118557b72e45c0d1a/decode/AndroidManifest.xml:12: error: No resource identifier found for attribute 'appComponentFactory' in package 'android'
W:
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_6044636843477729569.tmp, p, --forced-package-id, 127, --min-sdk-version, 16, --target-sdk-version, 28, --version-code, 53, --version-name, 1.3.0, --no-version-vectors, -F, /tmp/APKTOOL4069633296174487723.tmp, -0, arsc, -0, META-INF/androidx.appcompat_appcompat.version, -0, META-INF/androidx.arch.core_core-runtime.version, -0, META-INF/androidx.asynclayoutinflater_asynclayoutinflater.version, -0, META-INF/androidx.coordinatorlayout_coordinatorlayout.version, -0, META-INF/androidx.core_core.version, -0, META-INF/androidx.cursoradapter_cursoradapter.version, -0, META-INF/androidx.customview_customview.version, -0, META-INF/androidx.documentfile_documentfile.version, -0, META-INF/androidx.drawerlayout_drawerlayout.version, -0, META-INF/androidx.fragment_fragment.version, -0, META-INF/androidx.interpolator_interpolator.version, -0, META-INF/androidx.legacy_legacy-support-core-ui.version, -0, META-INF/androidx.legacy_legacy-support-core-utils.version, -0, META-INF/androidx.lifecycle_lifecycle-livedata-core.version, -0, META-INF/androidx.lifecycle_lifecycle-livedata.version, -0, META-INF/androidx.lifecycle_lifecycle-runtime.version, -0, META-INF/androidx.lifecycle_lifecycle-viewmodel.version, -0, META-INF/androidx.loader_loader.version, -0, META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version, -0, META-INF/androidx.print_print.version, -0, META-INF/androidx.slidingpanelayout_slidingpanelayout.version, -0, META-INF/androidx.swiperefreshlayout_swiperefreshlayout.version, -0, META-INF/androidx.vectordrawable_vectordrawable-animated.version, -0, META-INF/androidx.vectordrawable_vectordrawable.version, -0, META-INF/androidx.versionedparcelable_versionedparcelable.version, -0, META-INF/androidx.viewpager_viewpager.version, -0, META-INF/services/com.fasterxml.jackson.core.JsonFactory, -0, properties, -0, png, -0, res/drawable-ldrtl-xxhdpi-v17/abc_spinner_mtrl_am_alpha.9.png, -0, gif, -0, res/drawable-xhdpi-v4/notification_bg_low_normal.9.png, -0, res/drawable-xhdpi-v4/notification_bg_low_pressed.9.png, -0, res/drawable-xhdpi-v4/notification_bg_normal.9.png, -0, res/drawable-xhdpi-v4/notification_bg_normal_pressed.9.png, -0, res/drawable-xxhdpi-v4/abc_ab_share_pack_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_btn_switch_to_on_mtrl_00001.9.png, -0, res/drawable-xxhdpi-v4/abc_btn_switch_to_on_mtrl_00012.9.png, -0, res/drawable-xxhdpi-v4/abc_cab_background_top_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_list_divider_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_list_focused_holo.9.png, -0, res/drawable-xxhdpi-v4/abc_list_longpressed_holo.9.png, -0, res/drawable-xxhdpi-v4/abc_list_pressed_holo_dark.9.png, -0, res/drawable-xxhdpi-v4/abc_list_pressed_holo_light.9.png, -0, res/drawable-xxhdpi-v4/abc_list_selector_disabled_holo_dark.9.png, -0, res/drawable-xxhdpi-v4/abc_list_selector_disabled_holo_light.9.png, -0, res/drawable-xxhdpi-v4/abc_menu_hardkey_panel_mtrl_mult.9.png, -0, res/drawable-xxhdpi-v4/abc_popup_background_mtrl_mult.9.png, -0, res/drawable-xxhdpi-v4/abc_scrubber_primary_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_scrubber_track_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_spinner_mtrl_am_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_switch_track_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_tab_indicator_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_textfield_activated_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_textfield_default_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_textfield_search_activated_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/abc_textfield_search_default_mtrl_alpha.9.png, -0, res/drawable-xxhdpi-v4/common_google_signin_btn_icon_dark_normal_background.9.png, -0, res/drawable-xxhdpi-v4/common_google_signin_btn_icon_light_normal_background.9.png, -0, res/drawable-xxhdpi-v4/common_google_signin_btn_text_dark_normal_background.9.png, -0, res/drawable-xxhdpi-v4/common_google_signin_btn_text_light_normal_background.9.png, -0, arsc, -I, /tmp/1.apk, -S, /tmp/2f2fba23aedf204118557b72e45c0d1a/decode/res, -M, /tmp/2f2fba23aedf204118557b72e45c0d1a/decode/AndroidManifest.xml]

@shroudedcode
Copy link
Owner

The first error seems to have to do with Java versions. version 52.0 stands for Java 8, so maybe you're using a Java version older than that?

@hisxo
Copy link
Author

hisxo commented Dec 21, 2019

I updated java :

java -version

java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

Now, if I run the same command :

java -jar /usr/lib/node_modules/apk-mitm/jar/uber-apk-signer.jar --allowResign --overwrite --apks /tmp/af26870344ac6eeb2464eead1edd9b09/tmp.apk

╭ apk-mitm v0.6.1
  ├ apktool custom version
  ╰ uber-apk-signer v1.1.0

  Using temporary directory:
  /tmp/f14d72823041e8f878f0b52b0912d0f0

  ✔ Decoding APK file
  ✔ Modifying app manifest
  ✔ Modifying network security config
  ✔ Disabling certificate pinning
  ✔ Encoding patched APK file
  ⠼ Signing patched APK file
(node:19260) UnhandledPromiseRejectionWarning: Error: Command failed with exit code 1: java -jar /usr/lib/node_modules/apk-mitm/jar/uber-apk-signer.jar --allowResign --overwrite --apks /tmp/f14d72823041e8f878f0b52b0912d0f0/tmp.apk
    at makeError (/usr/lib/node_modules/apk-mitm/node_modules/execa/lib/error.js:56:11)
    at handlePromise (/usr/lib/node_modules/apk-mitm/node_modules/execa/index.js:114:26)
  ✔ Decoding APK file
  ✔ Modifying app manifest
  ✔ Modifying network security config
  ✔ Disabling certificate pinning
  ✔ Encoding patched APK file
  ⠹ Signing patched APK file

But I tried again (with the last version of apktool 2.4.1) :

npx test.apk --apktool apktool_2.4.1.jar

  ╭ apk-mitm v0.6.1
  ├ apktool custom version
  ╰ uber-apk-signer v1.1.0

  Using temporary directory:
  /tmp/50ee2f8aa02092d3cdc57eda8444d9ff

  ✔ Decoding APK file
  ✔ Modifying app manifest
  ✔ Modifying network security config
  ✔ Disabling certificate pinning
  ✔ Encoding patched APK file
  ✔ Signing patched APK file

   WARNING

  This app seems to be using Android App Bundle which means that you
  will likely run into problems installing it. That's because this app
  is made out of multiple APK files and you've only got one of them.

  If you want to patch an app like this with apk-mitm, you'll have to
  supply it with all the APKs. You have two options for doing this:

  – download a *.xapk file (for example from https://apkpure.com​)
  – export a *.apks file (using https://github.com/Aefyr/SAI​)

  You can then run apk-mitm again with that file to patch the bundle.

   Done!  Patched file: ./test.apk

AppBundle seems to be another problem, so thanks, now my initial problem seems to be resolved 👍

@shroudedcode
Copy link
Owner

Awesome, glad I was able to help! Note that you don't need to manually tell apk-mitm to use Apktool 2.4.1. That version is currently bundled with apk-mitm and will be used if you don't specify --apktool.

@shroudedcode shroudedcode changed the title UnhandledPromiseRejectionWarning: Error: Command failed with exit code 1 UnsupportedClassVersionError: Unsupported major.minor version 52.0 Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants