JesseKnott-2239 avatar image
0 Votes"
JesseKnott-2239 asked JesseKnott-2239 commented

Debug build runs fine, but release builds throw exception

I'm having a hard time troubleshooting this. Perhaps someone can tell me what's wrong by this error?

When I run a Debug build it compiles and runs on the emulator just fine, but if I try to run a release build, it throws this error?
My build environment is a bit odd, I am building both Paid and free versions of my app from the same code base.
As a result I have an alternate FreeEditionAndroidManifest.xml file, that has an appId I created for the free edition of the app. The paid version has an addId associated with that version but ads are never shown.
For the ads themselves, I am only using the adIds associated with the Free edition of the app since the paid never shows ads anyway.

Neither the paid nor the free builds will run release versions. I can only get the log output from the DDMS since it's a release build, and it seems that it's not entirely useful info...

Is this related to the emulator not allowing AdMob to run in production releases?

 java.lang.ClassNotFoundException: Didn't find class ""

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

LeonLu-MSFT avatar image
0 Votes"
LeonLu-MSFT answered JesseKnott-2239 commented


Welcome to our Microsoft Q&A platform!

Which Linker and code shrinker did you set?

Please set Linker to none, then release your application, if it works. If the Linker set to None, then you can release your application, If this issue disappear, because Linker are excluding

And if code shrinker to ‘R8’, please enable the ProGuard. Next, you can either let the Xamarin.Android build process use a default ProGuard configuration file, or you can create your own custom configuration file for ProGuard to use.

Add follow code to your custom configuration file for ProGuard.

-keep public class

If you want to set Linker option to Sdk Assemblies Only. You need to instruct it to keep the code that shouldn't be stripped out. You can see this thread

If you want to keep

Best Regards,

Leon Lu

If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

oops, my comment appears to have disappeared.

Proguard was complaining about using d8, and dex is deprecated so I'd like to avoid it. dex also seems to throw an error with Java in the build (probably creating the bytecode?).

At any rate, I was able to get the build to complete and run by setting the linker to none. So for the moment at least I will accept a larger package size. I will experiment with making a linker.config, or if you recommend using ProGuard over d8, I can work on getting it to play nice with d8. I figure it's probably some configuration issue since those are the only dex compilers to work with.

Thanks again for the help!


0 Votes 0 ·