0

I already updated my AndroidStudio to version 3.3 and I'm using Jackson to parse JSON. Until this update, my version was 2.8.0. After AndroidStudio update I'm receiving the NoSuchMethodError below:

E/AndroidRuntime: FATAL EXCEPTION: main
                     Process: org.madebyalex.myperiod, PID: 18261
                     java.lang.NoSuchMethodError: No virtual method
                     writeStartObject(Ljava/lang/Object;)V in class 
                     Lcom/fasterxml/jackson/core/JsonGenerator; or its 
                     super classes (declaration of 
                     'com.fasterxml.jackson.core.JsonGenerator' appears 
                      in /data/app/org.madebyalex.myperiod-
                     1/split_lib_dependencies_apk.apk:classes6.dex)
                     at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:151)
                     at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:292)
                     at com.fasterxml.jackson.databind.ObjectWriter$Prefetch.serialize(ObjectWriter.java:1429)
                     at com.fasterxml.jackson.databind.ObjectWriter._configAndWriteValue(ObjectWriter.java:1158)
                     at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:971)
                     at org.madebyalex.myperiod.JsonUtils.writeProfileInfo(JsonUtils.java:274)

So I've update my Jackson version to 2.8.7, clear Gradle cache files and a rebuild. The problem continues the same. This is my gradle file:

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
   compile 'com.android.support:support-v4:25.2.0'
   compile 'com.android.support:design:25.2.0'
   compile 'com.android.support:appcompat-v7:25.2.0'
   compile 'com.android.support:recyclerview-v7:25.2.0'
   compile 'com.android.support:cardview-v7:25.2.0'
   compile files('libs/jackson-core-2.8.7.jar')
   compile files('libs/jackson-databind-2.8.7.jar')
   compile files('libs/jackson-annotations-2.8.0.jar')
}

One thing I noticed even after rebuild and cache deletion, jackson core version still in version 2.7.4 in "External Libraries" reference folder of AndroidStudio. This is the name: jackson-core-2.7.4.

I searched some llinks on SO and found this: ObjectMapper java.lang.NoSuchMethodError But no success.

Community
  • 1
  • 1
learner
  • 1,311
  • 3
  • 18
  • 39
  • I don't think this would cause the problem, but why are you using a mismatched version of `jackson-annotations`? – Kevin Krumwiede Mar 04 '17 at 20:00
  • The latest jackson-annotations is this version. At least in the repo. AMD as you said, this os not the cause of the problem. – learner Mar 04 '17 at 21:17
  • OK. I founded the LinkedIn with latest version: https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations/2.8.7. Unfortunately Jackson core repo doesn't container this link. And problem persists. – learner Mar 04 '17 at 21:28

1 Answers1

0

Problem solved. I asserted latest version of the jars changing my gradle file to instead to point out to my local jars, AndroidStudio downloads directly to maven repo:

compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.7'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.7'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.8.7'

My mistake to not seen this before.

learner
  • 1,311
  • 3
  • 18
  • 39