Android Question App crashes (does not open) in Android 8.1+

Ariston

Member
Licensed User
Hi.

I am Ariston, from Brazil.

I have an App (SISCOMDroid) that works perfectly in Android 8.0 ou older, but in Android 8.1 and 9 it always crashes. It does not even open.

I have no idea of what the problem is. I have also seached for similar problems in this community but it seems that nobody has reported anything alike.

I will be very thankful for a sugestion that can help me solve this problem.

Link to download from Play Store: https://play.google.com/store/apps/details?id=com.arsoft.siscomdroid&hl=pt_BR
 

asales

Well-Known Member
Licensed User
I install your app in Android 8.1 and get this error in the unfiltered logs:

B4X:
START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.arsoft.siscomdroid/.main bnds=[528,702][697,877]} from uid 10029
Start proc 9528:com.arsoft.siscomdroid/u0a101 for activity com.arsoft.siscomdroid/.main
power_hint: no power profile selected yet
Zip: size/crc32 mismatch. expected {372931, 949600, d33cb9a9}, was {134873108, 1302855688, 4034b50}
Failed to extract 'classes.dex' from '/data/app/com.arsoft.siscomdroid-2ZOHb_GjZHFFq_-26lmftA==/base.apk': Inconsistent information
Shutting down VM
FATAL EXCEPTION: main
Process: com.arsoft.siscomdroid, PID: 9528
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.arsoft.siscomdroid/com.arsoft.siscomdroid.main}: java.lang.ClassNotFoundException: Didn't find class "com.arsoft.siscomdroid.main" on path: DexPathList[[zip file "/data/app/com.arsoft.siscomdroid-2ZOHb_GjZHFFq_-26lmftA==/base.apk"],nativeLibraryDirectories=[/data/app/com.arsoft.siscomdroid-2ZOHb_GjZHFFq_-26lmftA==/lib/arm, /system/lib, /system/vendor/lib]]
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2679)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.arsoft.siscomdroid.main" on path: DexPathList[[zip file "/data/app/com.arsoft.siscomdroid-2ZOHb_GjZHFFq_-26lmftA==/base.apk"],nativeLibraryDirectories=[/data/app/com.arsoft.siscomdroid-2ZOHb_GjZHFFq_-26lmftA==/lib/arm, /system/lib, /system/vendor/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
    ... 9 more
    Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.arsoft.siscomdroid-2ZOHb_GjZHFFq_-26lmftA==/base.apk because: Failed to extract 'classes.dex' from '/data/app/com.arsoft.siscomdroid-2ZOHb_GjZHFFq_-26lmftA==/base.apk': Inconsistent information
        at dalvik.system.DexFile.openDexFileNative(Native Method)
        at dalvik.system.DexFile.openDexFile(DexFile.java:353)
        at dalvik.system.DexFile.<init>(DexFile.java:100)
        at dalvik.system.DexFile.<init>(DexFile.java:74)
        at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
        at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
        at dalvik.system.DexPathList.<init>(DexPathList.java:157)
        at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
        at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
        at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
        at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
        at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69)
        at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:35)
        at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:693)
        at android.app.LoadedApk.getClassLoader(LoadedApk.java:727)
        at android.app.LoadedApk.getResources(LoadedApk.java:954)
        at android.app.ContextImpl.createAppContext(ContextImpl.java:2270)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5639)
        at android.app.ActivityThread.-wrap1(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
        ... 6 more
  Force finishing activity com.arsoft.siscomdroid/.main
Showing crash dialog for package com.arsoft.siscomdroid u0

You can see errors like this:
Failed to extract 'classes.dex' from '/data/app/com.arsoft.siscomdroid
java.lang.RuntimeException: Unable to instantiate activity
java.lang.ClassNotFoundException: Didn't find class "com.arsoft.siscomdroid.main"


Maybe @Erel or others members with more knownledge can help you to analyse this messages and solved the problem.
 

Ariston

Member
Licensed User
Failed to extract 'classes.dex' from '/data/app/com.arsoft.siscomdroid
j
I believe the error is here. If the device manages to extract the file 'classes.dex', app will open.
Any tip on how to force exctraction?
Is it permision demanded?
 

techknight

Well-Known Member
Licensed User
You may simply just need to recompile it with the current B4A and see what happens.
 

Ariston

Member
Licensed User
Well, even compiling with the newer version the problem persists.
But I found out that the problem was with the zipaligning.
I use a batch file with the folowing command line to zipalign the apk:
"D:\zipalign\zipalign" -f -v -z 4 C:\B4AProjects\SISCOMDroid\Objects\bin\temp.ap_ SISCOMDroid.apk
If a just rename temp.ap_ to SISCOMDroid.apk, it installs. But if I zipalign it, it only installs in Android 8.0 or oldar. In newer versions it doesn't install.
Now I have to find out if PlayStore will allow uploads without zipaligning.
Or is there a better way do zipalign the apk, or a newer version of zipalign.exe?
 

Computersmith64

Well-Known Member
Licensed User
Well, even compiling with the newer version the problem persists.
But I found out that the problem was with the zipaligning.
I use a batch file with the folowing command line to zipalign the apk:
"D:\zipalign\zipalign" -f -v -z 4 C:\B4AProjects\SISCOMDroid\Objects\bin\temp.ap_ SISCOMDroid.apk
If a just rename temp.ap_ to SISCOMDroid.apk, it installs. But if I zipalign it, it only installs in Android 8.0 or oldar. In newer versions it doesn't install.
Now I have to find out if PlayStore will allow uploads without zipaligning.
Or is there a better way do zipalign the apk, or a newer version of zipalign.exe?
Huh? Doesn't B4A zipalign during the compilation process? I've never done this manually on any of my apps, so if B4A isn't doing it I'd say it's not necessary for Play Store approval.

- Colin.
 

Ariston

Member
Licensed User
It shows when I compile, but even though, when I try to upload the apk to Play Store, this error shows:



In part it says: "Upload failed - You uploaded an APK not aligned with zipalign. Run zipalign on the APK then upload it again."
 

Computersmith64

Well-Known Member
Licensed User
What happens when you try to install the .apk on a local device?

- Colin.
 

Computersmith64

Well-Known Member
Licensed User
Oh - & are you compiling a release (obfuscated) build with a release key? I've seen people reporting this error when they try to upload a debug build, or a release build using a debug key.

- Colin.
 

Ariston

Member
Licensed User
Hi. Problem solved!
I still have to use the batch file to zipalign the app, but with a small change in the command line.
"D:\zipalign\zipalign" -v -4 C:\B4AProjects\SISCOMDroid\Objects\bin\temp.ap_ SISCOMDroid.apk
PlayStore acepted my upload.
Thanks a lot for the tips. They were really helpful.
 

Computersmith64

Well-Known Member
Licensed User
Oh - hang on, why are you uploading the tmp file from your Objects\bin folder? If you are doing a release build the .apk will be sitting in your Objects\ folder - eg: Objects\SISCOMDroid.apk.

- Colin.
 

Computersmith64

Well-Known Member
Licensed User
Hi. Problem solved!
I still have to use the batch file to zipalign the app, but with a small change in the command line.
"D:\zipalign\zipalign" -v -4 C:\B4AProjects\SISCOMDroid\Objects\bin\temp.ap_ SISCOMDroid.apk
PlayStore acepted my upload.
Thanks a lot for the tips. They were really helpful.
I think you're either not compiling a release build, or if you are, you're trying to upload the wrong file. I have 17 apps on Play Store (all but one developed with B4A) & I have never had to manually run a zipalign on any of them. See my post #15...

- Colin.
 

Ariston

Member
Licensed User
I also believe so. It is a bit hard for me (a brasiliam person with a poor English), to grasp everything about android programing, but don't worry, I'm gonna take a better look at my project to find out what I am doing wrong.
Thank you all again.
 

Ariston

Member
Licensed User
Oh - hang on, why are you uploading the tmp file from your Objects\bin folder? If you are doing a release build the .apk will be sitting in your Objects\ folder - eg: Objects\SISCOMDroid.apk.
I didn't pay attention to this. My mistake was exactly it. :D
 
Top