[protobuf] NoClassDefFoundError

2011-06-10 Thread Jubei
Hello. I have already read the previous posts and attempted to
everything right to get Protobuf 2.4.1 working on android but I still
get a NoClassDefFoundError on runtime at the following line:

PhoneEvent.Builder eventMessage =
PhoneEvent.newBuilder().setX(x).setY(y).setZ(z);

I have:
- Downloaded protobuf-2.4.1.tar.bz2, unpacked it and ./configure,
make, sudo make install. When I run protoc --version I get libprotoc
2.4.1
- used protoc to compile the .proto to java source and also included
that under my source.
- used maven to build the lite .jar (my proto file has option
optimize_for = LITE_RUNTIME;) -- mvn package -P lite
- put the .jar file under lib, made a new userlibrary and referenced
it in my build path. Project compiles fine.

The funny thing is that the exact same code used to work fine with a
random protobuf.jar I found somewhere on the net and stuffed in my
build path. It's when I tried to move to protobuf 2.4.1 that all
problems started. Am I missing something?

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Re: NoClassDefFoundError

2011-06-10 Thread Ben Wright
Did you remember to compile descriptor.proto with protoc?

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Re: NoClassDefFoundError

2011-06-10 Thread Jubei
Thank you for your response.

Unfortunately I'm not sure what descriptor.proto is. I never had to
compile that before. What would I do with the output of compiling that
file?

On Jun 10, 9:29 am, Ben Wright compuware...@gmail.com wrote:
 Did you remember to compile descriptor.proto with protoc?

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Re: NoClassDefFoundError

2011-06-10 Thread Ben Wright
The descriptor.proto is the proto that describes proto files.  This
supports that Java and C++ reflection language feature and is required
to be part of the java library.

descriptor.proto is located at protobuf-2.4.1/src/google/protobuf/
descriptor.proto (with the C++ code)

Please see the file included in the 2.4.1 distribution at
protobuf-2.4.1/java/README.txt for instructions on how to properly
build / install the java library without maven.

I've included the relevant section below:

Installation - Without Maven


If you would rather not install Maven to build the library, you may
follow these instructions instead.  Note that these instructions skip
running unit tests.

1) Build the C++ code, or obtain a binary distribution of protoc.  If
   you install a binary distribution, make sure that it is the same
   version as this package.  If in doubt, run:

 $ protoc --version

   If you built the C++ code without installing, the compiler binary
   should be located in ../src.

2) Invoke protoc to build DescriptorProtos.java:

 $ protoc --java_out=src/main/java -I../src \
 ../src/google/protobuf/descriptor.proto

3) Compile the code in src/main/java using whatever means you prefer.

4) Install the classes wherever you prefer.

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.