• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Proguard not working with jackson

 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am using jackson library in my project

gradle.java


proguard.rules.pro


-keepattributes *Annotation*,EnclosingMethod,Signature
-keepnames class com.fasterxml.jackson.** { *; }
-dontwarn com.fasterxml.jackson.databind.**


# General
-keepattributes SourceFile,LineNumberTable,*Annotation*,EnclosingMethod,Signature,Exceptions,InnerClasses




It is storing the data in realm in abc.java


after fetching from realm xyz.java


I am getting a NPE while creating release build:
Cause: java.lang.NullPointerException


Unable to debug this issue further. Any help is appreciated. Thanks in advance
 
Saloon Keeper
Posts: 6888
163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I assume that it works correctly if you don't use obfuscation - is that correct?

A quick search fro "jackson android proguards" finds pages such as https://proguard-rules.blogspot.com/2017/05/jackson-proguard-rules.html, https://stackoverflow.com/questions/27687128/how-to-setup-proguard-for-jackson-json-processor and especially https://github.com/krschultz/android-proguard-snippets/pull/132, all of which have different ProGuard settings than the one you're using.
 
priyanshi bhardwaj
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Moores wrote:I assume that it works correctly if you don't use obfuscation - is that correct?



Yes. I have tried multiple proguard rules for jackson but none of them is working. I am constantly getting a NPE. There is no details also so I can't figure out exactly where Npe is coming. how can I debug it to get detailed logs of the respective issue.
 
priyanshi bhardwaj
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Moores wrote:
A quick search fro "jackson android proguards" finds pages such as https://proguard-rules.blogspot.com/2017/05/jackson-proguard-rules.html, https://stackoverflow.com/questions/27687128/how-to-setup-proguard-for-jackson-json-processor and especially https://github.com/krschultz/android-proguard-snippets/pull/132, all of which have different ProGuard settings than the one you're using.



I have tried above proguard guard settings too but still getting a npe
 
Tim Moores
Saloon Keeper
Posts: 6888
163
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

priyanshi bhardwaj wrote:how can I debug it to get detailed logs of the respective issue.


Add plenty of logging - logcat is your friend. in particular, make sure all object references you use are not null - that's how NPEs happen.
 
What's that smell? Hey, sniff this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic