无法将GoAR中的AAR导入到我的应用中(尝试了先前的答案,但它们不起作用)

I am trying to make a golang package that can be included in an Android app.

So I have

  • created a golang module and built it using go bind to an aar
  • used 'new module' in Android Studio to import the aar
  • gone to project structure/dependencies/... to connect up the aar, but the aar was not listed so I could not add it.
  • the module appears to be in android/mobile; how do I tell Android Studio? Do I need to?

So

  • does anyone know what the exact command line is that I need for go bind? Assuming, say that I am trying for a module 'mobile' in a project 'hk.nurke.fred'.
  • also, how do I refer to my package in the java import statement?

Save your file in lib folder then import it by using it

compile( name : 'Name of AAR' , ext : 'aar' )

and

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven { url "https://jitpack.io" }
        flatDir {
            dirs 'libs'
        }
    }
}

Check it i hope you get solution

I also got this issue today. Apparently the writer forgot to mention this in the doc Mobile#building-and-deploying-to-android.

Below is the missing step:

  1. copy "yourgolangmodule.aar" and "yourgolangmodule.jar" to "yourreactnativeproject\android\app";

  2. in "yourreactnativeproject\android\app\build.gradle" file, add below:

(how to get the clue: compare between this file in the example project from doc and the one in your project.)

enter image description here

  1. click File -> Sync Project with Gradle Files