Skip to content
Advertisement

Cannot instance AGConnectFunction

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();

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement