IoTReady / flutter-aws-iot

AWS IoT plugin for flutter, intended to fit nicely with flutter_cognito_plugin
Other
11 stars 2 forks source link

Unhandled Exception: RuntimeException: Failed to read awsconfiguration.json please check that it is correctly formed. #5

Open gs74340 opened 3 years ago

gs74340 commented 3 years ago

I/flutter (13327): Configured D/EGL_emulation(13327): eglMakeCurrent: 0xe66698c0: ver 3 1 (tinfo 0xcf619910) I/flutter (13327): {USERNAME: xxxxx0@gmail.com, PASSWORD: *******, POLICY_NAME: mobile-policy, REGION: ap-south-1, ENDPOINT: xxxxxxxxxxx-ats.iot.ap-south-1.amazonaws.com, CLIENT_ID: xxxxxxxxx3kvea4v6v} D/PluginScaffold(13327): invoke { channel: com.pycampers.flutter_cognito_plugin, method: initialize(), args: null } E/ebthings.app.i(13327): Invalid ID 0x00000000. E/flutter (13327): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: RuntimeException: Failed to read awsconfiguration.json please check that it is correctly formed. E/flutter (13327): java.lang.RuntimeException: Failed to read awsconfiguration.json please check that it is correctly formed. E/flutter (13327): at com.amazonaws.mobile.config.AWSConfiguration.readInputJson(AWSConfiguration.java:125) E/flutter (13327): at com.amazonaws.mobile.config.AWSConfiguration.<init>(AWSConfiguration.java:109) E/flutter (13327): at com.amazonaws.mobile.config.AWSConfiguration.<init>(AWSConfiguration.java:94) E/flutter (13327): at com.amazonaws.mobile.config.AWSConfiguration.<init>(AWSConfiguration.java:71) E/flutter (13327): at com.amazonaws.mobile.client.AWSMobileClient.initialize(AWSMobileClient.java:444) E/flutter (13327): at com.pycampers.flutter_cognito_plugin.Cognito.initialize(Cognito.kt:22) E/flutter (13327): at java.lang.reflect.Method.invoke(Native Method) E/flutter (13327): at com.pycampers.plugin_scaffold.PluginScaffoldPluginKt$createPluginScaffold$1$$special$$inlined$let$lambda$1.invoke(PluginScaffoldPlugin.kt:75) E/flutter (13327): at com.pycampers.plugin_scaffold.PluginScaffoldPluginKt$createPluginScaffold$1$$special$$inlined$let$lambda$1.invoke(Unknown Source:0) E/flutter (13327): at com.pycampers.plugin_scaffold.PluginScaffoldPluginKt.catchErrors(PluginScaffoldPlugin.kt:169) E/flutter (13327): at com.pycampers.plugin_scaffold.PluginScaffoldPluginKt.catchErrors(PluginScaffoldPlugin.kt:176) E/flutter (13327): at com.pycampers.plugin_scaffold.PluginScaffoldPluginKt$createMethodWrapper$2$1.invoke(PluginScaffoldPlugin.kt:129) E/flutter (13327): at com.pycampers.plugin_scaffold.PluginScaffoldPluginKt$createMethodWrapper$2$1.invoke(Unknown Source:0) E/flutter (13327): at com.pycampers.plugin_scaffold.DoAsync.doInBackground(PluginScaffoldPlugin.kt:284) E/flutter (13327): at com.pycampers.plugin_scaffold.DoAsync.doInBackground(PluginScaffoldPlugin.kt:278) E/flutter (13327): at android.os.AsyncTask$2.call(AsyncTask.java:333) E/flutter (13327): at java.util.concurrent.FutureTask.run(FutureTask.java:266) E/flutter (13327): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) E/flutter (13327): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) E/flutter (13327): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) E/flutter (13327): at java.lang.Thread.run(Thread.java:764) E/flutter (13327): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0 E/flutter (13327): at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:216) E/flutter (13327): at android.content.res.ResourcesImpl.openRawResource(ResourcesImpl.java:324) E/flutter (13327): at android.content.res.Resources.openRawResource(Resources.java:1281) E/flutter (13327): at android.content.res.Resources.openRawResource(Resources.java:1225) E/flutter (13327): at com.amazonaws.mobile.config.AWSConfiguration.readInputJson(AWSConfiguration.java:114) E/flutter (13327): ... 20 more E/flutter (13327): E/flutter (13327): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:582:7) E/flutter (13327): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:18) E/flutter (13327): <asynchronous suspension> E/flutter (13327): #2 Cognito.invokeMethodWithChannel (package:flutter_cognito_plugin/flutter_cognito_plugin.dart:70:16) E/flutter (13327): <asynchronous suspension> E/flutter (13327): #3 Cognito.initialize (package:flutter_cognito_plugin/flutter_cognito_plugin.dart:107:5) E/flutter (13327): <asynchronous suspension> E/flutter (13327): #4 AwsConnect.main (package:webthings/aws_iot.dart:16:11) E/flutter (13327): <asynchronous suspension> E/flutter (13327):

tejpochiraju commented 3 years ago

I think there's an error in your awsconfiguration.json file. Can you confirm that it's valid JSON by running it through a JSON validator?

gs74340 commented 3 years ago

awsconfiguration.json is a valid file. Where should i put that file ?

tejpochiraju commented 3 years ago

@KaranRajPradhan @AMMAR187 - can you help here?

KaranRajPradhan commented 3 years ago

@gs74340 This plugin uses flutter_cognito_plugin for authentication that needs the awsconfiguration.json file. Please go through this: https://github.com/scientifichackers/flutter_cognito_plugin#android and verify if your awsconfiguration.json matches it.