Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app crash when migrate protobuf from protobuf-java to protobuf-javalite #6565

Closed
DysaniazzZ opened this issue Aug 26, 2019 · 3 comments
Closed

Comments

@DysaniazzZ
Copy link

DysaniazzZ commented Aug 26, 2019

What version of protobuf and what language are you using?
Version: 3.9.1
Language:Java

What operating system (Linux, Windows, ...) and version?
Android, API 23

my configs are below:
root build.gradle:

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.10'
    }
}

...

module build.gradle:

...

protobuf {
    protoc {
        artifact = 'com.google.protobuf:protoc:3.9.1'
    }
    generateProtoTasks {
        all().each { task ->
            task.builtins {
                java {
                    option "lite"
                }
            }
        }
    }
}

dependencies {
    api 'com.google.protobuf:protobuf-javalite:3.9.1'
}

but the app crash when I open it, and the crash logs are below:

java.lang.NoSuchMethodError: No virtual method putBoolean(Ljava/lang/Object;JZ)V in class Lsun/misc/Unsafe; or its super classes (declaration of 'sun.misc.Unsafe' appears in /system/framework/core-libart.jar)
        at com.google.protobuf.UnsafeUtil$JvmMemoryAccessor.putBoolean(UnsafeUtil.java:620)
        at com.google.protobuf.UnsafeUtil.putBoolean(UnsafeUtil.java:143)
        at com.google.protobuf.MessageSchema.parseProto3Message(MessageSchema.java:5255)
        at com.google.protobuf.MessageSchema.mergeFrom(MessageSchema.java:5396)
        at com.google.protobuf.ArrayDecoders.decodeMessageField(ArrayDecoders.java:246)
        at com.google.protobuf.ArrayDecoders.decodeMessageList(ArrayDecoders.java:704)
        at com.google.protobuf.MessageSchema.parseProto3Message(MessageSchema.java:5330)
        at com.google.protobuf.MessageSchema.mergeFrom(MessageSchema.java:5396)
        at com.google.protobuf.ArrayDecoders.decodeMessageField(ArrayDecoders.java:246)
        at com.google.protobuf.ArrayDecoders.decodeMessageList(ArrayDecoders.java:704)
        at com.google.protobuf.MessageSchema.parseProto3Message(MessageSchema.java:5330)
        at com.google.protobuf.MessageSchema.mergeFrom(MessageSchema.java:5396)
        at com.google.protobuf.GeneratedMessageLite.parsePartialFrom(GeneratedMessageLite.java:1552)
        at com.google.protobuf.GeneratedMessageLite.parseFrom(GeneratedMessageLite.java:1652)
        at xxx.entity.ChannelGroup$ChannelGroupProto.parseFrom(ChannelGroup.java:279)
@grill2010
Copy link

I think this is the same issue as mine. Should be resolved in the next version.

@DysaniazzZ
Copy link
Author

@grill2010 Yes, I think so. Look forward to the next release.

@rafi-kamal
Copy link
Contributor

This is a duplicate of #6551, which was fixed in 3.10 release. Please reopen the issue if the problem still exists in 3.10+.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants