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

Unable to instantiate application after redex step #67

Closed
sean-kenny opened this issue Apr 14, 2016 · 6 comments
Closed

Unable to instantiate application after redex step #67

sean-kenny opened this issue Apr 14, 2016 · 6 comments

Comments

@sean-kenny
Copy link

sean-kenny commented Apr 14, 2016

When trying redex with a debug build (NOT pro-guarded at all) the app will immediately crash when launching the redex version of the apk. The exception is as follows:

04-14 13:19:30.491 31052 31052 E AndroidRuntime: FATAL EXCEPTION: main
04-14 13:19:30.491 31052 31052 E AndroidRuntime: Process: com.mycompany.music.debug, PID: 31052
04-14 13:19:30.491 31052 31052 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate application com.mycompany.music.MycompanyApplicationDebug: java.lang.ClassNotFoundException: Didn't find class "com.mycompany.music.MycompanyApplicationDebug" on path: DexPathList[[zip file "/data/app/com.mycompany.music.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/com.mycompany.music.debug-1/lib/arm, /data/app/com.mycompany.music.debug-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    at android.app.LoadedApk.makeApplication(LoadedApk.java:676)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6294)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    at android.app.ActivityThread.access$1800(ActivityThread.java:222)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1861)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:102)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:158)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:7229)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
04-14 13:19:30.491 31052 31052 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mycompany.music.MycompanyApplicationDebug" on path: DexPathList[[zip file "/data/app/com.mycompany.music.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/com.mycompany.music.debug-1/lib/arm, /data/app/com.mycompany.music.debug-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    at android.app.Instrumentation.newApplication(Instrumentation.java:1004)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    at android.app.LoadedApk.makeApplication(LoadedApk.java:666)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    ... 9 more
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    Suppressed: java.lang.ClassNotFoundException: com.mycompany.music.MycompanyApplicationDebug
04-14 13:19:30.491 31052 31052 E AndroidRuntime:        at java.lang.Class.classForName(Native Method)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
04-14 13:19:30.491 31052 31052 E AndroidRuntime:        ... 12 more
04-14 13:19:30.491 31052 31052 E AndroidRuntime:    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot 

If I look at the contents of the original debug apk and grep for dex files I see:

➜  redex git:(master) ✗ unzip -l ../app/build/outputs/apk/app-armV7-debug-unaligned.apk | grep dex
  7959096  04-14-16 12:23   classes.dex
   805196  04-14-16 12:23   classes2.dex
    89656  04-14-16 12:23   classes3.dex
    ...
   153760  04-14-16 12:22   classes89.dex
   319652  04-14-16 12:23   classes90.dex
      768  04-14-16 12:23   classes91.dex

If I look at the contents of the redexed apk and grep for dex files I see:

➜  redex git:(master) ✗ unzip -l redex-out.apk | grep dex
Archive:  redex-out.apk
  6688416  04-14-16 13:10   classes.dex

It appears the multidex dex files are missing or perhaps just merged? Either way, the app is unable to start...

@sean-kenny
Copy link
Author

Similar issue to #27

@sean-kenny sean-kenny changed the title Stripping Multidex Classes from apk Stripping multidex Classes from apk Apr 14, 2016
@sean-kenny sean-kenny changed the title Stripping multidex Classes from apk Redex stripping multidex classes from apk Apr 14, 2016
@sean-kenny sean-kenny changed the title Redex stripping multidex classes from apk Redex stripping multidex classes from output apk Apr 14, 2016
@sean-kenny sean-kenny changed the title Redex stripping multidex classes from output apk Unable to instantiate application after redex step Apr 14, 2016
@shmuelr
Copy link

shmuelr commented Apr 14, 2016

So this is the MultiDex issue?

@Gavin1989
Copy link

@bertmaher
Copy link
Contributor

Thanks for reporting the issue! Redex is supposed to work with multidex (FB is multidex), so there must be a bug.

Hard to know what's going on, but you could help me debug it by creating a config file (see the doc linked by @Gavin1989 ), and progressively eliminating passes until the application installs. That'll at least tell me which pass is misbehaving.

@bertmaher
Copy link
Contributor

I just fixed a really silly bug with multidex, so multidex apps should work now. Sorry for the hassle.

@sean-kenny
Copy link
Author

awesome @bertmaher, I will try it out again!

facebook-github-bot pushed a commit that referenced this issue Mar 3, 2022
Summary:
X-link: facebookincubator/hsthrift#67

Updating `googletest` from `1.8.0` to `1.10.0`

Reviewed By: mzlee, igorsugak, luciang, meyering, r-barnes

Differential Revision: D34351084

fbshipit-source-id: 939b3985ab63a06b6d511ec8711c2d5863bdfea8
facebook-github-bot pushed a commit that referenced this issue Mar 3, 2022
Summary:
X-link: facebookincubator/hsthrift#67

Updating `googletest` from `1.8.0` to `1.10.0`

Reviewed By: mzlee, igorsugak, luciang, meyering, r-barnes

Differential Revision: D34351084

fbshipit-source-id: 939b3985ab63a06b6d511ec8711c2d5863bdfea8
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

4 participants