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

Failed to Open Dex Files from Base.apk due to Out-of-Order Field Index for Annotation #46

Closed
kittizz opened this issue Jul 8, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@kittizz
Copy link

kittizz commented Jul 8, 2023

Describe the bug
I just changed 'const/4 v1, 0x0' to 'const/4 v1, 0x1' and rebuilt the smali, but it still cannot be opened.
I tested DECOMPILE and BUILD without making any modifications, and it worked fine.

To Reproduce
Steps to reproduce the behavior:

  1. Used version
  • APKEditor - 1.2.4
  • Using: ARSCLib-1.2.0
  1. Operating system 'android 13'
  2. Command
  • java -jar APKEditor/APKEditor-1.2.4.jar d -i xxx.apk -f
  • java -jar APKEditor/APKEditor-1.2.4.jar b -i xxx

Log/Stacktrace

E  FATAL EXCEPTION: main
   Process: com.scb.phone, PID: 923
   java.lang.RuntimeException: Unable to instantiate application com.scb.phone.AndroidApplication package com.scb.phone: java.lang.ClassNotFoundException: Didn't find class "com.scb.phone.AndroidApplication" on path: DexPathList[[zip file "/data/app/~~-s0Q_Suv5SsIx0VboDh4Ow==/com.scb.phone-vsBiUTmjtF7yMjlw_LO87Q==/base.apk"],nativeLibraryDirectories=[/data/app/~~-s0Q_Suv5SsIx0VboDh4Ow==/com.scb.phone-vsBiUTmjtF7yMjlw_LO87Q==/lib/arm64, /data/app/~~-s0Q_Suv5SsIx0VboDh4Ow==/com.scb.phone-vsBiUTmjtF7yMjlw_LO87Q==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
   	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1573)
   	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1502)
   	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7543)
   	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
   	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2400)
   	at android.os.Handler.dispatchMessage(Handler.java:106)
   	at android.os.Looper.loopOnce(Looper.java:226)
   	at android.os.Looper.loop(Looper.java:313)
   	at android.app.ActivityThread.main(ActivityThread.java:8747)
   	at java.lang.reflect.Method.invoke(Native Method)
   	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
   	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
   Caused by: java.lang.ClassNotFoundException: Didn't find class "com.scb.phone.AndroidApplication" on path: DexPathList[[zip file "/data/app/~~-s0Q_Suv5SsIx0VboDh4Ow==/com.scb.phone-vsBiUTmjtF7yMjlw_LO87Q==/base.apk"],nativeLibraryDirectories=[/data/app/~~-s0Q_Suv5SsIx0VboDh4Ow==/com.scb.phone-vsBiUTmjtF7yMjlw_LO87Q==/lib/arm64, /data/app/~~-s0Q_Suv5SsIx0VboDh4Ow==/com.scb.phone-vsBiUTmjtF7yMjlw_LO87Q==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
   	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
   	at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
   	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
   	at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:76)
   	at android.app.Instrumentation.newApplication(Instrumentation.java:1232)
   	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1565)
   	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1502) 
   	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7543) 
   	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) 
   	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2400) 
   	at android.os.Handler.dispatchMessage(Handler.java:106) 
   	at android.os.Looper.loopOnce(Looper.java:226) 
   	at android.os.Looper.loop(Looper.java:313) 
   	at android.app.ActivityThread.main(ActivityThread.java:8747) 
   	at java.lang.reflect.Method.invoke(Native Method) 
   	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) 
   	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067) 
   	Suppressed: java.io.IOException: Failed to open dex files from /data/app/~~-s0Q_Suv5SsIx0VboDh4Ow==/com.scb.phone-vsBiUTmjtF7yMjlw_LO87Q==/base.apk because: Failure to verify dex file '/data/app/~~-s0Q_Suv5SsIx0VboDh4Ow==/com.scb.phone-vsBiUTmjtF7yMjlw_LO87Q==/base.apk': Out-of-order field_idx for annotation: 63f then 63c
   		at dalvik.system.DexFile.openDexFileNative(Native Method)
   		at dalvik.system.DexFile.openDexFile(DexFile.java:371)
   		at dalvik.system.DexFile.<init>(DexFile.java:113)
   		at dalvik.system.DexFile.<init>(DexFile.java:86)
   		at dalvik.system.DexPathList.loadDexFile(DexPathList.java:438)
   		at dalvik.system.DexPathList.makeDexElements(DexPathList.java:397)
   		at dalvik.system.DexPathList.<init>(DexPathList.java:166)
   		at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:160)
   		at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:130)
   		at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:146)
   		at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:93)
   		at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:134)
   		at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:126)
   		at android.app.ApplicationLoaders.getClassLoaderWithSharedLibraries(ApplicationLoaders.java:61)
   		at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:1059)
   		at android.app.LoadedApk.getClassLoader(LoadedApk.java:1151)
   		at android.app.LoadedApk.getResources(LoadedApk.java:1475)
   		at android.app.ContextImpl.createAppContext(ContextImpl.java:3264)
   		at android.app.ContextImpl.createAppContext(ContextImpl.java:3256)
E  App crashed on incremental package com.scb.phone which is 100% loaded.

logcat.txt

Used apk file
Attach/share your apk
https://apkcombo.com/th/scb-easy/com.scb.phone/download/apk
Additional context
Add any other context about the problem here.

@kittizz
Copy link
Author

kittizz commented Jul 9, 2023

I tried putting dex file from apktool and build it works.

@REAndroid REAndroid added the bug Something isn't working label Jul 9, 2023
REAndroid added a commit that referenced this issue Jul 9, 2023
@REAndroid
Copy link
Owner

Fixed now 0533457

@kittizz
Copy link
Author

kittizz commented Jul 9, 2023

Fixed now 0533457

Now I encountered the problem of Incompatible attribute value android:innerRadiusRatio="3", expected types: float instead of the first time it wasn't like this.

➜  XXX_project java -jar ../APKEditor/APKEditor-1.2.5.jar d -f -i XXX3681.apk
00.000 I: [DECOMPILE] Decompiling ...
   Input: XXX3681.apk
 Output: XXX3681_decompile_xml
 Force: true
 Type: xml
 ---------------------------- 
00.012 I: [DECOMPILE] Loading ...
00.282 I: [DECOMPILE] Initializing android framework ...
00.282 I: [DECOMPILE] Loading android framework for version: 33
00.314 I: [DECOMPILE] Initialized framework: android-33 (UpsideDownCake)
00.314 I: [DECOMPILE] Decompiling to xml ...
00.331 I: [DECOMPILE] [SANITIZE]: Sanitizing paths ...
00.366 [DECOMPILE] [SANITIZE]: '.. ent%20Med%20v3.2.ttf' -> 'assets/flutter_assets/packages/nhox_flutter_ui/lib/assets/fonts/alias_eb80d3f3'
00.369 I: [DECOMPILE] Validating resource names ...
00.451 I: [DECOMPILE] Spec names validated, duplicates = 0, bad = 5883, removed specs = 5883
00.451 I: [DECOMPILE] Decode: uncompressed-files.json
00.463 I: [DECOMPILE] Decoding: AndroidManifest.xml
00.515 I: [DECOMPILE] public.xml: com.xXX.phone -> package_1
00.534 I: [DECOMPILE] Res files: resources
01.392 [DECOMPILE] res/mipmap-xxxhdpi/mipmap_0x7f0e0003.webp                                                                                
01.392 I: [DECOMPILE] Ignore non bin xml: res/raw/aNm.xml
02.135 [DECOMPILE] Values: package_1                                                          
02.264 I: [DECOMPILE] Baksmali: classes.dex
06.735 I: [DECOMPILE] Baksmali: classes2.dex
10.755 I: [DECOMPILE] Baksmali: classes3.dex
15.523 I: [DECOMPILE] Baksmali: classes4.dex
19.730 I: [DECOMPILE] Baksmali: classes5.dex
24.123 I: [DECOMPILE] Baksmali: classes6.dex
25.247 I: [DECOMPILE] Extracting root files ...
26.103 I: [DECOMPILE] Dumping signatures ...
26.104 I: [DECOMPILE] Saved to: XXX3681_decompile_xml
➜  XXX_project java -jar ../APKEditor/APKEditor-1.2.5.jar b -f -i XXX3681_decompile_xml 
00.000 I: [BUILD] Building ...
   Input: XXX3681_decompile_xml
 Output: XXX3681_decompile_xml_out.apk
 Force: true
 ---------------------------- 
00.012 I: [BUILD] Scanning XML directory ...
00.027 I: [BUILD] Scanning: XXX3681_decompile_xml
00.037 I: [BUILD] Loading string pool ...
00.133 [BUILD] 9664 building pool: values-xxxhdpi    
00.283 I: [BUILD] Initializing android framework ...
00.283 I: [BUILD] Loading android framework for version: 33
00.329 I: [BUILD] Initialized framework: android-33 (UpsideDownCake)
00.330 I: [BUILD] Encoding attrs ...
00.333 [BUILD] Encoding: package_1/res/values/attrs.xml
00.359 I: [BUILD] Encoding values ...
00.483 [BUILD] Encoding: package_1/res/values-xxxhdpi/dimens.xml    
00.483 I: [BUILD] Scan: package_1/res
00.561 I: [BUILD] Scanned 5189 files: package_1/res
00.597 I: [BUILD] Add manifest: AndroidManifest.xml
00.597 I: [BUILD] Building dex ...
00.725 I: [BUILD] (1/6) Cached: classes.dex
00.848 I: [BUILD] (2/6) Cached: classes2.dex
01.034 I: [BUILD] (3/6) Cached: classes3.dex
01.201 I: [BUILD] (4/6) Cached: classes4.dex
01.349 I: [BUILD] (5/6) Cached: classes5.dex
01.388 I: [BUILD] (6/6) Cached: classes6.dex
01.389 I: [BUILD] Scanning root directory ...
01.401 I: [BUILD] Restoring original file paths ...
01.445 I: [BUILD] Loading signatures ...
01.448 I: [BUILD] Sorting files ...
01.475 I: [BUILD] Refreshing resource table ...
01.505 I: [BUILD] TableBlock: packages = 1, size = 2817256 bytes
01.505 I: [BUILD] Writing apk...
01.513 I: [BUILD] Buffering compress changed files ...
02.450 [BUILD] Encoding: res/drawable/shape_progressbar_circle.xml                               
ERROR:
Incompatible attribute value android:innerRadiusRatio="3", expected types: float
java.io.IOException: Incompatible attribute value android:innerRadiusRatio="3", expected types: float
        at com.reandroid.arsc.chunk.xml.ResXmlAttribute.encode(ResXmlAttribute.java:570)
        at com.reandroid.arsc.chunk.xml.ResXmlAttribute.encode(ResXmlAttribute.java:516)
        at com.reandroid.arsc.chunk.xml.ResXmlElement.parseAttributes(ResXmlElement.java:1241)
        at com.reandroid.arsc.chunk.xml.ResXmlElement.parse(ResXmlElement.java:1161)
        at com.reandroid.arsc.chunk.xml.ResXmlDocument.parse(ResXmlDocument.java:395)
        at com.reandroid.apk.xmlencoder.XMLParseEncodeSource.encode(XMLParseEncodeSource.java:77)
        at com.reandroid.apk.xmlencoder.XMLParseEncodeSource.getResXmlDocument(XMLParseEncodeSource.java:65)
        at com.reandroid.apk.xmlencoder.XMLParseEncodeSource.write(XMLParseEncodeSource.java:40)
        at com.reandroid.archive2.writer.OutputSource.writeBufferFile(OutputSource.java:119)
        at com.reandroid.archive2.writer.OutputSource.writeBuffer(OutputSource.java:65)
        at com.reandroid.archive2.writer.OutputSource.makeBuffer(OutputSource.java:61)
        at com.reandroid.archive2.writer.ApkWriter.writeBuffer(ApkWriter.java:132)
        at com.reandroid.archive2.writer.ApkWriter.write(ApkWriter.java:53)
        at com.reandroid.apk.ApkModule.writeApk(ApkModule.java:456)
        at com.reandroid.apk.ApkModule.writeApk(ApkModule.java:446)
        at com.reandroid.apkeditor.compile.Builder.buildXml(Builder.java:114)
        at com.reandroid.apkeditor.compile.Builder.run(Builder.java:43)
        at com.reandroid.apkeditor.compile.Builder.execute(Builder.java:142)
        at com.reandroid.apkeditor.Main.execute(Main.java:68)
        at com.reandroid.apkeditor.Main.main(Main.java:41)

@kittizz
Copy link
Author

kittizz commented Jul 9, 2023

It used to be normal in APKEditor-1.2.4
I think it's because of ARSCLib 1.2.1 update
therefore making it a problem

REAndroid referenced this issue in REAndroid/ARSCLib Jul 9, 2023
REAndroid added a commit that referenced this issue Jul 9, 2023
@REAndroid
Copy link
Owner

Check the latest update.
NB: APKEditor.jar also updated

@kittizz
Copy link
Author

kittizz commented Jul 10, 2023

it working thx

@kittizz kittizz closed this as completed Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants