第一步:添加插件依赖
.android工程根目录下“build.gradle”文件中添加:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.github.ljhgithub:publish-flutter-aar:1.0.2"
}
}
第二步:使用插件
gradle配置
在Flutter module的“build.gradle”文件中添加(示例配置)
apply plugin: "com.github.ljhgithub.publish-flutter-aar"
mavenSupport{
useRemote=false //是否上传到远程仓库
remoteUrl="http://xxxx" //远程仓库地址
userName='xxx' //远程仓库用户名
password='xxx' //远程仓库用户密码
pomArtifactId='artifactId' //项目的唯一的标识符
pomGroupId='groudid' //项目组织唯一的标识符
}
第三步:上传maven测试
使用命令: flutter build aar --build-number=1.0.0 (--build-number指定版本号,不使用此参数,版本一直为1.0) 构建aar,构建成功后查看maven仓库是否上传成功
第四步:使用flutter项目的远程依赖
implementation 'groudid:artifactId:1.0.0'