protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Built-in option 'java-package' not found

Open RyanShun-511 opened this issue 3 years ago • 1 comments

I am new to gRPC, I hope you can help me.I'm having trouble writing the.proto file on Android Studio.I want to implement my client on an Android phone. What version of protobuf and what language are you using? Version: libprotoc 3.21.4. Language: Java

What operating system (Linux, Windows, ...) and version? Windows What runtime / compiler are you using (e.g., python version or gcc version) IDEA:Android studio

What did you expect to see I want to write an Android client using gRPC.

build.gradle(Project) plugins { id 'com.android.application' } apply plugin:'com.google.protobuf' android { compileSdk 31

defaultConfig {
    applicationId "com.gitlab.grpcdemo"
    minSdk 21
    targetSdk 31
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
    viewBinding true
}

} // 和android以及dependencies平级 protobuf { protoc { artifact = 'com.google.protobuf:protoc:3.7.1' } plugins { javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" } grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.20.0' // CURRENT_GRPC_VERSION } } generateProtoTasks { all().each { task -> task.plugins { javalite {} grpc { // Options added to --grpc_out option 'lite' } } } } }

dependencies { implementation 'io.grpc:grpc-okhttp:1.20.0' implementation 'io.grpc:grpc-protobuf-lite:1.20.0' implementation 'io.grpc:grpc-stub:1.20.0' implementation 'javax.annotation:javax.annotation-api:1.2'

implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

} build.gradle(Module) plugins { id 'com.android.application' } apply plugin:'com.google.protobuf' android { compileSdk 31

defaultConfig {
    applicationId "com.gitlab.grpcdemo"
    minSdk 21
    targetSdk 31
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
    viewBinding true
}

} // 和android以及dependencies平级 protobuf { protoc { artifact = 'com.google.protobuf:protoc:3.7.1' } plugins { javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" } grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.20.0' // CURRENT_GRPC_VERSION } } generateProtoTasks { all().each { task -> task.plugins { javalite {} grpc { // Options added to --grpc_out option 'lite' } } } } }

dependencies { implementation 'io.grpc:grpc-okhttp:1.20.0' implementation 'io.grpc:grpc-protobuf-lite:1.20.0' implementation 'io.grpc:grpc-stub:1.20.0' implementation 'javax.annotation:javax.annotation-api:1.2'

implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

} I think I've got dependencies and plug-ins all worked out. Can someone help me with this? Thanks a million.

RyanShun-511 avatar Aug 07 '22 15:08 RyanShun-511

I had a similar issue. I was getting it from a plugin HIGAN's Protobuf plugin. image Try changing it to standard JetBrains Protocol Buffer plugin image

Hope it works afterwards.

DjuroRad avatar Dec 07 '22 07:12 DjuroRad

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

github-actions[bot] avatar Jan 07 '24 10:01 github-actions[bot]

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

github-actions[bot] avatar Jan 22 '24 10:01 github-actions[bot]