• 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Proguard not working with jackson

 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • 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: 6795
161
  • Mark post as helpful
  • send pies
  • 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: 241
  • Mark post as helpful
  • send pies
  • 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: 241
  • Mark post as helpful
  • send pies
  • 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: 6795
161
  • Mark post as helpful
  • send pies
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic