How to use local aar inside flutter plugin?

前端 未结 3 1221
再見小時候
再見小時候 2020-12-29 13:41

I\'ve create a flutter plugin with:

flutter create --template plugin flutter_plugin

I\'ve put my aar file inside flutter_plugin/android/src

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-29 13:57

    I created a libs directory in the android directory of my plugin. I placed the aar I generated in the libs directory:

    I updated the build.gradle file for the android code to include the following:

    rootProject.allprojects {
        repositories {
            google()
            jcenter()
            flatDir {
                dirs 'libs'
            }
        }
    }
    

    And in the dependencies section:

    implementation fileTree(dir: 'libs', include: ['*.aar'])

提交回复
热议问题