如何将fork github包添加到pubspec.yaml?

时间:2019-03-22 12:28:21

标签: github flutter

map_view插件不再维护,如果最小sdk达到28,将使用户遇到问题,因此幸运的是Eimji派生了该软件包的修改版本,但仅在github https://github.com/Eimji/flutter_google_map_view而非{{3}上我搜索将他的叉子添加到我的pubspec.yaml中。

我尝试了

flutter_google_map_view:
       git://github.com/Eimji/flutter_google_map_view.git

谢谢

更新

我通过map_view更改了名称,似乎已接受... 但是当我使用flutter_google_map_view时

Error on line 1, column 7 of flutter_google_map_view\pubspec.yaml: "name" field doesn't match expected name "flutter_google_map_view".

我不知道为什么map_view可以“工作”而不是mapview ...所以我不知道它是否真的被接受或者是很棒的方法...

所以现在当我上传本地map_view程序包时还有其他问题...

* Error running Gradle:
Exit code 1 from: C:\Users\utilisateur\AndroidStudioProjects\nirbi\android\gradlew.bat app:properties:
WARNING: The specified Android SDK Build Tools version (25.0.3) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
WARNING: The specified Android SDK Build Tools version (25.0.3) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
WARNING: The specified Android SDK Build Tools version (25.0.3) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':map_view'.
> Failed to notify project evaluation listener.
   > java.lang.AbstractMethodError (no error message)

我从build.gradle文件中搜索buildToolsVersion '25 .0.3,但没有这样的东西。所以我在build.gradle中添加了buildToolsVersion '28 .0.3',但是总是有相同的错误...

更新

我删除了所有似乎正常工作的“ buildToolsVersion '25 .0.3'”,现在我遇到了最后一个问题:

* Error running Gradle:
Exit code 1 from: C:\Users\utilisateur\AndroidStudioProjects\nirbi\android\gradlew.bat app:properties:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':map_view'.
> Failed to notify project evaluation listener.
   > java.lang.AbstractMethodError (no error message)

我认为map_view没有被正确接受...

更新 一些建议,可以简单地将此github软件包https://pub.dartlang.org导入pubspec.yaml?

当我使用

 flutter_google_map_view:
      git: git://github.com/Eimji/flutter_google_map_view.git

我遇到此错误...

Git error. Command: git clone --mirror git://github.com/munificent/map_view.git C:\Users\utilisateur\AppData\Roaming\Pub\Cache\git\cache\map_view-84b47933c6a730a2f0624a589576e53be480ad60
Cloning into bare repository 'C:\Users\utilisateur\AppData\Roaming\Pub\Cache\git\cache\map_view-84b47933c6a730a2f0624a589576e53be480ad60'...

更新 我尝试了最后的机会!导入map_view:^ 0.0.14(不兼容android X)并手动添加Eimji https://github.com/Eimji/flutter_google_map_view

所做的所有修改

我遇到此错误

* Error running Gradle:
Exit code 1 from: C:\Users\utilisateur\AndroidStudioProjects\nirbi\android\gradlew.bat app:properties:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':map_view'.
> Failed to notify project evaluation listener.
   > java.lang.AbstractMethodError (no error message)

1 个答案:

答案 0 :(得分:0)

请参见https://www.dartlang.org/tools/pub/dependencies#git-packages

dependencies:
  kittens:
    git:
      url: git://github.com/munificent/kittens.git
      ref: some-branch

如果pubspec.yaml不在根目录中,您还可以指定路径

dependencies:
  kittens:
    git:
      url: git://github.com/munificent/cats.git
      path: path/to/kittens