Protobuf Gradle插件版本0.8.6及更高版本与项目'flutter_blue'的使用版本0.8.3

时间:2018-12-11 00:39:17

标签: gradle flutter

使用:

  • VS代码:1.29.1
  • 颤振:1.0.0
  • Flutter_blue:0.4.1
  • 使用了flutter_blue / example

启动调试器时,我得到了:

Error running Gradle:
ProcessException: Process "C:\Development\flutter\bluetooth_example\android\gradlew.bat" exited abnormally:
Configure project :flutter_blue
The com.google.protobuf plugin was already applied to the project: :flutter_blue and will not be applied again after plugin: android-library

FAILURE: Build failed with an exception.
* What went wrong:
The Android Gradle plugin supports only Protobuf Gradle plugin version 0.8.6 and higher. Project 'flutter_blue' is using version 0.8.3.

有什么建议吗?

谢谢

2 个答案:

答案 0 :(得分:3)

我创建了一个拉取请求来解决此问题。

https://github.com/pauldemarco/flutter_blue/pull/147

这是flutter_blue软件包中build.gradle文件中所需的更改。

 dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3' <- Remove
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.6' <-- Add
    }

您可以通过将版本编辑为8.3.6来手动完成操作,尽管您可能还需要在项目清单文件中更新minSDK版本。

答案 1 :(得分:0)

使用更新的protobuf版本更新flutter_blue对我来说很有用。 您可以在flutter_blue /下更改设置,就像以下更改一样-

 diff --git a/android/build.gradle b/android/build.gradle index
 cf39349..39b277b 100644
 --- a/android/build.gradle
 +++ b/android/build.gradle @@ -9,7 +9,7 @@ buildscript {

      dependencies {
          classpath 'com.android.tools.build:gradle:3.1.3'
 -        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3'
 +        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.6'
      }  }