Skip to content

Enabling proguard in d15-7 now causes ClassNotFoundException on startup #1373

Closed

Description

@pjcollins

Projects which enable proguard are crashing on startup when using d15-7. This is a regression as compared to d15-6.

This 'behavior' was previously reported as #1331, however the stack trace encountered in that instance was different than in this new failure. I've attached an .apk file as well as the intermediate output of that build.

Steps to Reproduce

  1. msbuild /t:Install /p:Configuration=Release /p:EnableProguard=true *.csproj

Release.zip

App29.App29-Signed.zip

Version Information

Xamarin.Android SDK 8.3.0.1

Log File

03-06 14:14:38.374 30948 30948 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{App29.App29/md5cccdd53e8348812fe1f2fce1387c090e.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "md5cccdd53e8348812fe1f2fce1387c090e.MainActivity" on path: DexPathList[[zip file "/data/app/App29.App29-eAar8WzCugsoi-6aT68DbA==/base.apk"],nativeLibraryDirectories=[/data/app/App29.App29-eAar8WzCugsoi-6aT68DbA==/lib/arm, /system/fake-libs, /data/app/App29.App29-eAar8WzCugsoi-6aT68DbA==/base.apk!/lib/armeabi-v7a, /system/lib]]
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2679)
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        at android.app.ActivityThread.-wrap11(Unknown Source:0)
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:164)
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6494)
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
03-06 14:14:38.374 30948 30948 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "md5cccdd53e8348812fe1f2fce1387c090e.MainActivity" on path: DexPathList[[zip file "/data/app/App29.App29-eAar8WzCugsoi-6aT68DbA==/base.apk"],nativeLibraryDirectories=[/data/app/App29.App29-eAar8WzCugsoi-6aT68DbA==/lib/arm, /system/fake-libs, /data/app/App29.App29-eAar8WzCugsoi-6aT68DbA==/base.apk!/lib/armeabi-v7a, /system/lib]]
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
03-06 14:14:38.374 30948 30948 E AndroidRuntime:        ... 9 more
03-06 14:14:38.378 30948 30982 D libEGL  : loaded /vendor/lib/egl/libGLESv1_CM_adreno.so
03-06 14:14:38.386  1163 10565 W ActivityManager:   Force finishing activity App29.App29/md5cccdd53e8348812fe1f2fce1387c090e.MainActivity
03-06 14:14:38.388  1163  1178 I ActivityManager: Showing crash dialog for package App29.App29 u0

VS bug #578898

Activity

  1. added
    bug
    on Mar 6, 2018
  2. added this to the d15-7 milestone on Mar 6, 2018
  3. added
    Area: App Runtime
    and removed
    bug
    on Mar 6, 2018
  4. atsushieno commented on Mar 7, 2018

    @atsushieno
    Contributor

    You forgot to attach the sources, those archives are both build artifacts.

  5. atsushieno commented on Mar 7, 2018

    @atsushieno
    Contributor

    Also, the last time I touched Proguard task was like Oct. 2016. It's more about MSBuild tasks, so @dellis1972 and probably @jonathanpeppers (who made the last commit) would know what happened there. https://github.com/xamarin/xamarin-android/commits/master/src/Xamarin.Android.Build.Tasks/Tasks/Proguard.cs

  6. pjcollins commented on Mar 7, 2018

    @pjcollins
    MemberAuthor

    @atsushieno sorry for not including source, from what I have seen this reproduces with any project. Here's a simple demo that can be used:
    https://github.com/xamarin/monodroid-samples/tree/master/Button

  7. jonathanpeppers commented on Mar 7, 2018

    @jonathanpeppers
    Member

    Hey guys, it looks like the same commits for the <Proguard /> MSBuild task are on 15.6: https://github.com/xamarin/xamarin-android/commits/d15-6/src/Xamarin.Android.Build.Tasks/Tasks/Proguard.cs

    So I guess it means the issue lies somewhere else? I will be coming back from parental leave part time on Monday, I can probably take a deeper look then if someone else hasn't yet.

  8. added
    vs-sync
    on Mar 8, 2018
  9. jonathanpeppers commented on Mar 12, 2018

    @jonathanpeppers
    Member

    This is indeed a fallout from #1131 -- something that was added for 15.7 right before I went on leave.

    It looks like this for-loop needs changed, since acw-map.txt has less lines: https://github.com/xamarin/xamarin-android/blob/89b524c2929c2e743c60038fa9623869cffa2505/src/Xamarin.Android.Build.Tasks/Tasks/Proguard.cs#L133

  10. added 2 commits that reference this issue on Mar 12, 2018
    4803d16
    4123958
  11. pjcollins commented on Mar 27, 2018

    @pjcollins
    MemberAuthor

    Verified fixed in XA 8.3.0.10.

  12. ghost locked as resolved and limited conversation to collaborators on Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: App Runtimevs-sync

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions