Search code examples
androidinstallationcrashapkadb

Android app crash after extracting and reinstalling through adb


I tried to find this type of question, and nothing sorted out. I would like to do some research on an app for a customer.

So I explain the issue :

So I would like to extract the app (using adb seems the better way), use apktool to add some line in the AndroidManifest, and repack (and signing) it. After doing this I see the app is crashing after doing some manipulation on it. So as a control point, to be sure than my manipulation didn't break it, I tried to just extract the apk using adb, and resintalling it (from device and with adb) without doing any modification, and I saw the problem was the same, so my modification wasn't the problem.

I did it by locating it and extracting using :

adb shell pm list packages

Find the APK path

adb shell pm path com.my.app

Result :

package:/data/app/~~GdvAunQQGjig1h76mYro8w==/com.my.app-4jvBJLX-LuaGmXzifBYbgg==/base.apk
package:/data/app/~~GdvAunQQGjig1h76mYro8w==/com.my.app-4jvBJLX-LuaGmXzifBYbgg==/split_config.arm64_v8a.apk
package:/data/app/~~GdvAunQQGjig1h76mYro8w==/com.my.app-4jvBJLX-LuaGmXzifBYbgg==/split_config.fr.apk
package:/data/app/~~GdvAunQQGjig1h76mYro8w==/com.my.app-4jvBJLX-LuaGmXzifBYbgg==/split_config.xxhdpi.apk
adb pull /data/app/~~GdvAunQQGjig1h76mYro8w==/com.my.app-4jvBJLX-LuaGmXzifBYbgg==/base.apk C:\mypathout\base.apk

Reinstall by using this command :

adb install C:\mypathout\base.apk

And this result was Succes

Did this method is knowing to doing this type of issue.

I found this links : Android app crashed after installing via adb about a similar question but the he provided less details.

Thanks you for you help :)

EDIT : Logs of the crash has be retrieved and are here https://pastebin.com/peJTGb9N


Solution

  • The resulting files clearly show that the app was initially installed as android app bundle or split apk and the installation is split to several files. This error from the logcat: Caused by: java.lang.NoClassDefFoundError: com.my.app.utilsjni.NativeUtils Means that the app cannot find it's native part written in C++ and compiled as .so. It is probably here: split_config.arm64_v8a.apk I recommend to look for some tool that allows to either merge those .apk files or to install all of them together.

    base.apk  -                main code part
    split_config.arm64_v8a.apk main native code part, specific for arm64v8 cpus
    split_config.fr.apk        texts for french translation
    split_config.xxhdpi.apk    graphic resources for hi res screens