2

I'm referring to this code lab here: Cloud Functions for Android

apply plugin:'com.huawei.agconnect' 
...
dependencies { 
    implementation 'com.huawei.agconnect:agconnect-function:1.4.1.300'
}

Besides that "configure the following address" appears to be a wrongful CN to EN translation
and that I'm using the current version 1.6.0.300 instead; the IDE gives me these imports:

enter image description here


Please don't close for requesting a library; because it is "simply not there" (see the screenshot), despite the AAR is being located at: ~/.gradle/caches/modules-2/files-2.1/com.huawei.agconnect/agconnect-function/1.6.0.300/ed356f3bc516e39734b8a6b1dd7ec9a680d3bffd/agconnect-function-1.6.0.300.aar and can be extracted, from which I know for certain that it should be called:

import com.huawei.agconnect.function.AGConnectFunction;

And there's also com.huawei.agconnect.function.FunctionRegistrar, but I have no clue how to obtain an instance. Therefore the question is, how to import class AGConnectFunction?

AGConnectFunction function = AGConnectFunction.getInstance();
Martin Zeitler
  • 1
  • 19
  • 155
  • 216

1 Answers1

1

Thank you for your feedback, the team confirms that the codelab you mentioned will be updated in the near future.

implementation 'com.huawei.agconnect:agconnect-function:1.6.2.300'

enter image description here It is recommended that you use this version to call cloud functions. For details, see docs.

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
  • This is correct. Some other dependencies were at `1.6.2.300`, but this one was still at `1.6.0.300`; must have missed that. For some reason Android Studio does not flag these packages as outdated - which may come from repository meta-data. If it would flag the packages as outdated, this might prevent subsequent issues; likely [Maven](https://maven.apache.org) repository index related. – Martin Zeitler Jan 05 '22 at 10:47
  • The example should prevent unchecked assignment by adding `<>`: `new HashMap<>()`. – Martin Zeitler Jan 05 '22 at 11:02