android - What's the possible reason of non-custom signed APK (generated via debugging) running fine but the custom signed APK (release) not working? -


this very strange problem me. android app coming end. debugging runs ok many many times without error. runs fine. it's time me build release , publish app. follow steps can found via google easily. in fact signed apk installed ok , app starts ok but if user interacts navigate between screens of app, crashed no reason. not screen switching causes app crash, of them , can notice maybe involves reflection here. design own binding system bind viewmodel behind fragment , using reflection must, no other way.

i totally believe not fault in code because the app runs fine in debug mode. , @ time of losing hope publish app, found signed version of apk file in debug folder (that signed version generated if start debugging app run in targeted device - emulator, building in debug mode won't generate file). it's lucky me that signed apk works perfectly. can deploy apk new device , install normally, app runs expectedly.

so must wrong releasing process. here info configuration release mode (mainly in android options tab):

  • packaging (packaging properties): nothing checked in here.
  • linker: tried both sdk assemblies only , sdk , user assemblies nothing works.
  • advanced properties: checked options support possible cpu architectures (this should not problem because in debug mode, these options checked).

at beginning of learning xamarin android, tried finding information publishing android app , did complete simple test (to deploy simple app). worked ok @ time (maybe because it's simple), when comes complex 1 (mainly involving binding system uses reflection heavily) can crashed @ user interactions. have separate library project (containing custom views) referenced ok in main project (not sure if break, 1 custom view used ok while others may cause crashing). because crashes happen in compiled build, cannot debug see wrong.

i hope here has experienced same problem me out. no code provided here because there code, seems crashed @ many places , 1 more important reason code should not problem (for 1 reason explained above - runs smoothly in debug mode, found signed apk file in debug folder can installed ok , app runs ok in debug mode).

please me out, thank you.

since stated using lot of reflection, first thing is:

  • in android build settings:
    • disable proguard if selected
    • change linker options don't link
    • rebuild release build

update: since worked , app no longer crashes.

the linker remove code want preserve. example:

you need determine classes and/or method being remove because have no direct references , called via reflection , preserve prevent linker removing them.

if in code, can use [preserve] attribute.

if 3rd party libs or xamarin.android framework, can create "hardcoded" fake reference classes/members linker sees need them.

  • you might have code call dynamically via system.reflection.memberinfo.invoke.
  • if instantiate types dynamically, may want preserve default constructor of types.
  • if use xml serialization, may want preserve properties of types.

ref: https://developer.xamarin.com/guides/android/advanced_topics/linking/


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -