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

标签 github flutter

map_view 插件不再维护,如果 min sdk 达到 28,就会让用户遇到问题,所以幸运的是 Eimji fork 了一个修改版本的包,但它只在 github 上 https://github.com/Eimji/flutter_google_map_view而不是 https://pub.dartlang.org我搜索将他的分支添加到我的 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://github.com/Eimji/flutter_google_map_view到 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/commit/5b631c499783936dfc462039274a6f5c59323068#diff-7ae5a9093507568eabbf35c3b0665732

我有这个错误

* 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)

最佳答案

参见 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

关于github - 如何将 fork github 包添加到 pubspec.yaml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55299599/

相关文章:

ruby-on-rails - 从 Github 更新 Ruby gem

Android Studio 如何推送到新的存储库

git - 身份验证失败 Github 桌面

eclipse - 使用 EGit 克隆存储库导入但不允许我导入项目

Flutter 自定义画家类

flutter - 如何在 Flutter Web 中渲染 SVG?

flutter - flutter_bloc 库中的存储库提供程序在推送新路由时不提供存储库

flutter - 在Flutter中的Drawer小部件上更改顶部颜色

python - 为什么 pip install -e git-repo 在第二次调用时将 HEAD 更改为 master

dart - 如何将小部件放置在行中包含的卡片内?