【问题标题】:Doesn't recognise the .proto file in android studio canary无法识别 android studio canary 中的 .proto 文件
【发布时间】:2021-12-21 06:19:01
【问题描述】:

这是我的毕业典礼。

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'
                }
            }
        }
    }
}

我将 proto 文件夹放在 src/main 下。 然后,创建 proto 文件到 src/main/proto, 它显示[注册新文件类型关联]是这样的。

如果有什么我可以补充的,请告诉我。

【问题讨论】:

    标签: kotlin proto


    【解决方案1】:

    这是我的错。我只是将 proto 插件安装到 android studio。

    【讨论】:

      猜你喜欢
      • 2018-10-20
      • 1970-01-01
      • 2014-03-30
      • 2022-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-03
      相关资源
      最近更新 更多