Failed to find code-generated model provider - AWS Amplify - android

I'm getting the below error:
Failed to find a code-generated model provider.
AWS amplify code which throwing this error:
Amplify.addPlugin(new AWSApiPlugin());
Amplify.addPlugin(new AWSDataStorePlugin());
Amplify.configure(context);
I am following the below tutorials:
https://docs.amplify.aws/start/getting-started/generate-model/q/integration/android
https://docs.amplify.aws/cli/graphql-transformer/overview
I have tried generating models and models get generated successfully but still while running the app I am getting above exception.

When you generate models, you should expect to find various code-generated files in your application project. One of them will be app/src/main/java/com/amplifyframework/datastore/generated/model/AmplifyModelProvider.java.
When you build your app, Android Studio will compile that java file into a class file, and include it into your binary.
At runtime, on the phone, the AWSDataStorePlugin() constructor will attempt to find that same AmplifyModelProvider by means of reflection.
I would verify that:
You do actually have the code-generated AmplifyModelProvider;
It is being built successfully;
It is not being stripped out by ProGuard/R8 minification.
If you're still not able to get it working, just use the one-argument version of the AWSDataStorePlugin(...) constructor, instead. That version allows you to explicitly specify the model provider, and does not use runtime reflection.
Amplify.addPlugin(AWSDataStorePlugin(AmplifyModelProvider.getInstance()))

Your datasource needs to be updated:
Try running modelGen, then amplifyPush tasks:
Category
Resource name
Operation
Provider plugin
Api
amplifyDatasource
Update
awscloudformation

Related

Unknown directive "model" when setting up AWS Amplify GraphQL in Android

I've been trying to set up GraphQL for my android kotlin project with AWS Amplify, but I am getting red warning for #model as well as AuthRule & allow in:
This is the example TODO GraphQL schema, but when I do edit the schema, the issue still occurs. I'm wondering if I am missing something else that I didn't see in the documentation?
When I hover over #model, I see a Unknown directive "model" error message.
I tried to uninstalling and installing again the amplify add api. The error continues, and after searching through online, I don't see any solutions that are recent that can help with this.

Unity Auth Error With Firebase

I implemented Firebase into a Unity app I am creating. There are two buttons that will run the two functions to create a new user and login an existing user. So far this functionality works on my PC, however whenever I try to deploy it to my android phone or Mac I end up getting the following error in the console.
DllNotFoundException: FirebaseCppApp-5.1.0
Firebase.AppUtilPINVOKE+SWIGExceptionHelper..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for SWIGExceptionHelper
Firebase.AppUtilPINVOKE..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Firebase.AppUtilPINVOKE
Firebase.AppUtil.SetLogFunction (Firebase.LogMessageDelegate arg0)
It appears there is a missing .dll file, however I cannot for the life of me find out how to include it within the project file. I also have double checked the package name and it is the exact same name as the one made for my Firebase project, the google-services JSON in the root of the project, and the Api compatibility level is set to .NET 2.0. On top of that I also uninstalled and reinstalled the app a few times. I also tried using the Play Services Resolver which didn't help much at all either.
Similar error here, only with Firebase Cloud Messaging. After tinkering around in a fashion similar to yours I concluded that it was caused by corruption during import of Firebase Package.
What worked for me:
Deleted each and every folder created while importing Firebase Package.
Reimported Firebase Package

#hide class not found

The ContentResolver class has a hidden method called getSyncStatus(...).
To make it public visible I try to add a wrapper method in ContentResolverCompat from support v4 lib.
This works so far in Eclipse but when I call make it fails with the following errors:
ERROR: /development/android/frameworks/support/v4/java/android/support/v4/content/SyncStatusInfo.java:91: android.content.SyncStatusInfo cannot be resolved to a type
ERROR: /development/android/frameworks/support/v4/java/android/support/v4/content/ContentResolverCompat.java:19: The import android.accounts cannot be resolved
ERROR: /development/android/frameworks/support/v4/java/android/support/v4/content/ContentResolverCompat.java:137: Account cannot be resolved to a type
ERROR: /development/android/frameworks/support/v4/java/android/support/v4/content/ContentResolverCompat.java:138: android.content.SyncStatusInfo cannot be resolved to a type
ERROR: /development/android/frameworks/support/v4/java/android/support/v4/content/ContentResolverCompat.java:146: Account cannot be resolved to a type
ERROR: /development/android/frameworks/support/v4/java/android/support/v4/content/ContentResolverCompat.java:148: android.content.SyncStatusInfo cannot be resolved to a type
My thought was that #hide is a documentation thing only and I can access it from within AOSP classes. But why I can't build my changes when I want to access hidden classes / methods?
Note: I don't want to build an Android app, I want to change / build the Android source code itself.
Edit: This isn't a duplicate of #hide class not found because #hide means that it is removed from JavaDoc but it is still accessible from Android source code itself.

Error:Execution failed for task ':backend:appengineEndpointsGetClientLibs

When adding a Google Cloud Endpoint backend to a Android app using the Google App Engine Java Module Template, two classes (amongst other things) are added to the project.
We are then encouraged to modify these classes to our own requirements. So, I decided to delete the model class (MyBean) and the endpoint class (MyEndpoint) and replace them with my own classes. When I tried to rebuild/clean the project, I get the error message:
Error:Execution failed for task ':backend:appengineEndpointsGetClientLibs'.
There was an error running endpoints command get-client-lib:
<package-name>.MyEndpoint
I looked for a couple of hours for a solution to this problem until I found the cause.So I decided to share it since this question does not even exist on SO (Please correct me if I am wrong)
Go to backend\src\main\webapp\WEB-INF\web.xml
In the web.xml file, look for the init-param and change the parameter value to the new endpoint class you've just added.
<init-param>
<param-name>services</param-name>
<param-value>com.mycompany.backend.New-Endpoint-Class-Name</param-value>
</init-param>
Rebuild the project and everything should be just fine.

NUnitLite in Xamarin (Android). Unable to load Mono.Data.Sqllite.dll

I'm currently experimenting with Xamarin for the first time, as well as NUnitLite for the first time. I've set up a small Android project and a test project. In the Android project I make use of SqlLite, and in my test project I want to write some integration tests for my database insert/update/select methods.
However, when I run tests which includes a call to my class "GroupRepository" (which includes a type from the Mono.Data.Sqllite.dll in its constructor) I get the following exception. Note that I've also added the mentioned dll to my test-project.
TestInsertWithLegalValues (IntegrationTests.Repository.RepositoryTests.TestInsertWithLegalValues)
System.IO.FileLoadException : Could not load file or assembly 'Mono.Data.Sqlite, version=2.0.5.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
----> System.Security.SecurityException : Strong name validation failed. (Exception from HRESULT: 0x8013141A)
at Repository.GroupRepository..ctor()
at IntegrationTests.Repository.RepositoryTests.SetUp()
--SecurityException
The Android project targets API 8 using Xamarin 2.0. The test project is a Windows Console Application .NET 4.5.
Why is this failing the way it is?
Thanks for any input!

Categories

Resources