You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 3, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 3, 2026. It is now read-only.
DetectModerationLabels Rekognition - No Direct Equivalent in Amplify Android v2 #3691
I am currently migrating from the AWS Mobile SDK for Android to Amplify Android v2. A key feature of my app is content moderation using DetectModerationLabels through Amazon Rekognition. In the legacy AWS Mobile SDK, this functionality was available via the AWSRekognitionClient.
However, in the new Amplify Android v2 SDK, there is no direct equivalent for this feature. The only mention I've found is in the Gen 1 documentation, where an "escape hatch" through AWSPredictionsPlugin.getEscapeHatch().getRekognitionClient() is provided for accessing the Rekognition client directly (see Use AWS SDK - Android - AWS Amplify Gen 1 Documentation).
My question is: What is the recommended approach to using DetectModerationLabels with Amplify Android v2? Is there a new API or category that replaces this? Has it been intentionally left out, or is there a plan to include it in future releases?
For functionality not supported through AWSPredictionsPlugin, using the getEscapeHatch() to get the RekognitionClient directly is the recommended approach.
Could you please guide me on how to achieve this same content moderation functionality using Amplify Gen 2?
Specifically, would the exact same Android client code that I use to call DetectModerationLabels in Gen 1 still work for a Gen 2 project, or does this implementation change completely under the new Gen 2?
Also, should I continue using the same dependency, implementation 'com.amplifyframework:aws-predictions:2.36.0',
or is there a different dependency/approach required for Gen 2?
I am asking because when I use my current configuration with the Gen 2 amplify_outputs.json:
Authentication and Storage work perfectly fine, but initialization crashes on the Predictions plugin with this exact error:
textPredictionsException{message=AWSPredictionsPlugin is not supported when using Amplify Gen2, cause=null, recoverySuggestion=This plugin is not supported by Amplify Gen2. Remove this plugin to use Gen2.}
Given this explicit error stating that the plugin is not supported in Gen 2, what is the recommended way to perform content moderation from an Android app using Gen 2?
considering the official warning on the Gen 1 documentation stating:"Amplify Gen 1 has entered maintenance mode and will reach end of life on May 1, 2027. New projects should use Amplify Gen 2" between now and May 2027, is there a plan to release a new version or alternative dependency (similar to com.amplifyframework:aws-predictions) that fully supports Gen 2 ?
Hi @hvar90, you probably just don't need to use Amplify for your use case. The PredictionsPlugin is simply a pass through to the Kotlin SDK's RekognitionClient, so you should be able to use that directly.
You can still use Amplify v2 Auth to provide credentials for the RekognitionClient using the following. This is what the Predictions Plugin is doing internally.
val client =RekognitionClient {
region ="us-east-1"// or whatever your region is
credentialsProvider =CognitoCredentialsProvider() // uses Amplify.Auth to provide credentials for making requests
}
// make a requestval result = client.detectModerationLabels {
image = { ... }
}
Since my Android app is fully written in Java, I would appreciate your advice on the best library choice for this approach.
Which one do you recommend for a Java-based Android project?
software.amazon.awssdk:rekognition (AWS SDK for Java v2)
aws.sdk.kotlin:rekognition (AWS SDK for Kotlin)
If I should go with the Kotlin SDK as you snippet suggests, what is the best way to call it from Java code while maintaining compatibility with CognitoCredentialsProvider()?
On the other hand, if I use the Java v2 SDK, is there an equivalent way to easily bridge Amplify v2 Auth credentials into it?
Hi @jvh-aws ,Just wanted to thank you for the recommendation! Moving to the AWS Kotlin SDK totally fixed my issues on older Android versions. Appreciate the help! Everything is working perfectly now, so I'll close this case.
This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
Activity
thisisabhash commentedon May 14, 2026
Hello,
Thank you for posting this issue.
Currently, Amplify Android v2 supports these features: https://docs.amplify.aws/gen1/android/build-a-backend/more-features/predictions/
For functionality not supported through
AWSPredictionsPlugin, using thegetEscapeHatch()to get theRekognitionClientdirectly is the recommended approach.hvar90 commentedon May 15, 2026
Thank you for the clarification regarding Gen 1.
Could you please guide me on how to achieve this same content moderation functionality using Amplify Gen 2?
Specifically, would the exact same Android client code that I use to call DetectModerationLabels in Gen 1 still work for a Gen 2 project, or does this implementation change completely under the new Gen 2?
Also, should I continue using the same dependency,
implementation 'com.amplifyframework:aws-predictions:2.36.0',or is there a different dependency/approach required for Gen 2?
I am asking because when I use my current configuration with the Gen 2 amplify_outputs.json:
Authentication and Storage work perfectly fine, but initialization crashes on the Predictions plugin with this exact error:
textPredictionsException{message=AWSPredictionsPlugin is not supported when using Amplify Gen2, cause=null, recoverySuggestion=This plugin is not supported by Amplify Gen2. Remove this plugin to use Gen2.}Given this explicit error stating that the plugin is not supported in Gen 2, what is the recommended way to perform content moderation from an Android app using Gen 2?
considering the official warning on the Gen 1 documentation stating:"Amplify Gen 1 has entered maintenance mode and will reach end of life on May 1, 2027. New projects should use Amplify Gen 2" between now and May 2027, is there a plan to release a new version or alternative dependency (similar to
com.amplifyframework:aws-predictions) that fully supports Gen 2 ?mattcreaser commentedon May 22, 2026
Hi @hvar90, you probably just don't need to use Amplify for your use case. The PredictionsPlugin is simply a pass through to the Kotlin SDK's
RekognitionClient, so you should be able to use that directly.You can still use Amplify v2 Auth to provide credentials for the
RekognitionClientusing the following. This is what the Predictions Plugin is doing internally.Hope that helps!
hvar90 commentedon May 24, 2026
Hi @mattcreaser ,
Thank you for the workaround! It clarifies a lot.
Since my Android app is fully written in Java, I would appreciate your advice on the best library choice for this approach.
Which one do you recommend for a Java-based Android project?
software.amazon.awssdk:rekognition (AWS SDK for Java v2)
aws.sdk.kotlin:rekognition (AWS SDK for Kotlin)
If I should go with the Kotlin SDK as you snippet suggests, what is the best way to call it from Java code while maintaining compatibility with CognitoCredentialsProvider()?
On the other hand, if I use the Java v2 SDK, is there an equivalent way to easily bridge Amplify v2 Auth credentials into it?
Thank you again for your guidance!
jvh-aws commentedon May 28, 2026
@hvar90, I'd using the Kotlin SDK (
aws.sdk.kotlin:rekognition), which should work best for AndroidEven in a Java project, you can call it via a small Kotlin helper. E.g.:
Then from Java:
CognitoCredentialsProvider()bridges your Amplify Auth credentials automatically.hvar90 commentedon May 28, 2026
Hi @jvh-aws ,Just wanted to thank you for the recommendation! Moving to the AWS Kotlin SDK totally fixed my issues on older Android versions. Appreciate the help! Everything is working perfectly now, so I'll close this case.
github-actions commentedon May 28, 2026
This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.