Android Golang绑定刷新* .aar

I am importing an aar file using the new module > import JAR or AAR package option. Initially I was able call a method from my library. However after updating the library and running Gomobile bind again, I can't figure out how to update the aar file. The new methods are not shown after updating the .aar file manually. Importing again causes "Project already contains subproject with name mobilelib".

Android Studio 2.2.3 How do I refresh the .aar file?

build.gradle(app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "23.0.2"
    defaultConfig {
        applicationId "com.testing.testgolanglib"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.1'
    testCompile 'junit:junit:4.12'
    compile project(':mobilelib')
}

mobilelib

configurations.maybeCreate("default")
artifacts.add("default", file('mobilelib.aar'))

Project build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        flatDir{
            dirs '/Users/abc/projects/go/src/com.abc/mobilelib'
        }

    }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}

In theory, you have two options:

  1. Run gomobile bind manually each time you change the library, then copy the AAR file from your Go source directory to the mobilelib directory, replacing the old AAR file. And, finally rebuild the project;

  2. Use the org.golang.mobile.bind Gradle plugin, that is supposed to do all of this work for you.

But, as far as I know, the plugin is not up-to-date with the latest Gradle tools and doesn't work properly.