Showing posts with label protobuf java android eclipse. Show all posts
Showing posts with label protobuf java android eclipse. Show all posts

Wednesday, October 12, 2011

Protocol Buffers Lite Android NoClassDefFoundError

I've been struggling to get protobuf-lite to work with android. I've struggled in the past but this time around I kinda randomly solved the issue:

  • build protoc from the tarball
  • go into java/ and do mvn test -P lite then mvn package -P lite
  • copy the resulting protobuf-java-x.x.x-lite.jar from targets/ into your eclipse Project/libs directory (NOTE: not lib/ libs/ !!!)
  • In Eclipse, configure build path, add a user-library with THAT SPECIFIC .jar. (i.e. don't add the protobuf-lite.jar from another part of the filesystem)
  • In the java build path --> order and export tab, make sure you check your newly created user library
  • If that doesn't work and you still get NoClassDefFoundError then in the java build path configuration, go to the source tab and add the libs/ folder. That should take care of it.
Please post a comment if you have any issues.