Polaris Nation
Polaris Nation

Reputation: 1225

Doesn't recognise the .proto file in android studio canary

Here is my gradle.

plugins {
   // ...
   id "com.google.protobuf" version "0.8.12"
}

dependencies {
        // DataStore
    implementation "androidx.datastore:datastore-core:1.0.0"

    // Architectural Components
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"

    // Coroutines
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.4.0'

    // Coroutine Lifecycle Scopes
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"

    // ...
}

protobuf {
    protoc {
        artifact = "com.google.protobuf:protoc:3.10.0"
    }

    // Generates the java Protobuf-lite code for the Protobufs in this project. See
    // https://github.com/google/protobuf-gradle-plugin#customizing-protobuf-compilation
    // for more information.
    generateProtoTasks {
        all().each { task ->
            task.builtins {
                java {
                    option 'lite'
                }
            }
        }
    }
}

I make the proto folder to under src/main. And then, create proto file to src/main/proto, It show the [Register New File Type Association] like this.

enter image description here

enter image description here

If there's anything I can add, please let me know.

Upvotes: 2

Views: 698

Answers (1)

Polaris Nation
Polaris Nation

Reputation: 1225

It was my mistake. I just install proto plugin to android studio.

Upvotes: 1

Related Questions