-
Notifications
You must be signed in to change notification settings - Fork 273
Closed
Labels
AndroidIssues specific to the Android PlatformIssues specific to the Android Platformpending-close-response-requiredThe issue will be closed if details necessary to reproduce the issue are not provided within 7 days.The issue will be closed if details necessary to reproduce the issue are not provided within 7 days.pending-triageThis issue is in the backlog of issues to triageThis issue is in the backlog of issues to triageto-be-reproducedIssues that have not been reproduced yet, but have reproduction steps providedIssues that have not been reproduced yet, but have reproduction steps provided
Description
Issue created from comment on #2551.
Comment
Hi Jordan - I actually have a very similar issue. I'm following an AWS tutorial, which up until today, after I updated my Android SDK, I haven't had too much of an issue.
Here's my stuff - I'm a beginner at this so I might have messed something up, but it had been working fine until today.
Launching lib\main.dart on SM S901U in debug mode...
Running Gradle task 'assembleDebug'...
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk...
Debug service listening on ws://127.0.0.1:57740/L4njAY89pIo=/ws
Syncing files to device SM S901U...
I/ionsapplication( 7893): Compiler allocated 6075KB to compile void android.view.ViewRootImpl.performTraversals()
I/flutter ( 7893): Amplify plugin was not added
E/flutter ( 7893): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: AmplifyException(message: Amplify plugin AmplifyAuthCognitoMethodChannel was not added successfully., recoverySuggestion: We currently don't have a recovery suggestion for this exception., underlyingException: AmplifyException(message: MissingPluginException(No implementation found for method addPlugin on channel com.amazonaws.amplify/auth_cognito), recoverySuggestion: null, underlyingException: null))
E/flutter ( 7893): #0 MethodChannelAmplify.addPlugin (package:amplify_flutter/src/method_channel_amplify.dart:66:7)
E/flutter ( 7893): <asynchronous suspension>
E/flutter ( 7893): #1 Future.wait.<anonymous closure> (dart:async/future.dart:522:21)
E/flutter ( 7893): <asynchronous suspension>
E/flutter ( 7893): #2 _configureAmplify (package:reaqtionsapplication/main.dart:28:3)
E/flutter ( 7893): <asynchronous suspension>
E/flutter ( 7893): #3 main (package:reaqtionsapplication/main.dart:12:5)
E/flutter ( 7893): <asynchronous suspension>
E/flutter ( 7893):
Here's my main dart file
import 'package:reaqtionsapplication/reaqtions_app.dart';
import 'package:flutter/material.dart';
import 'package:amplify_flutter/amplify_flutter.dart';
import 'package:amplify_auth_cognito/amplify_auth_cognito.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'amplifyconfiguration.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
bool isAmplifySuccessfullyConfigured = false;
try {
await _configureAmplify();
isAmplifySuccessfullyConfigured = true;
} on AmplifyAlreadyConfiguredException {
debugPrint('Amplify configuration failed.');
}
runApp(
ProviderScope(
child: ReAQtionsApp(
isAmplifySuccessfullyConfigured: isAmplifySuccessfullyConfigured,
),
),
);
}
Future<void> _configureAmplify() async {
await Amplify.addPlugins([
AmplifyAuthCognito(),
]);
await Amplify.configure(amplifyconfig);
}And here is the app file
import 'package:reaqtionsapplication/features/airquality/ui/aqi_list/aqi_list_page.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:amplify_authenticator/amplify_authenticator.dart';
import 'package:reaqtionsapplication/common/navigation/router/routes.dart';
import 'package:reaqtionsapplication/common/utils/colors.dart' as constants;
class ReAQtionsApp extends StatelessWidget {
const ReAQtionsApp({
required this.isAmplifySuccessfullyConfigured,
Key? key,
}) : super(key: key);
final bool isAmplifySuccessfullyConfigured;
@override
Widget build(BuildContext context) {
final router = GoRouter(
routes: [
GoRoute(
path: '/',
name: AppRoute.home.name,
builder: (context, state) => isAmplifySuccessfullyConfigured
? const AQIListPage()
: const Scaffold(
body: Center(
child: Text(
'Tried to reconfigure Amplify; '
'this can occur when your app restarts on Android.',
),
),
),
),
],
errorBuilder: (context, state) => Scaffold(
body: Center(
child: Text(state.error.toString()),
),
),
);
return Authenticator(
child: MaterialApp.router(
routeInformationParser: router.routeInformationParser,
routeInformationProvider: router.routeInformationProvider,
routerDelegate: router.routerDelegate,
builder: Authenticator.builder(),
theme: ThemeData(
primarySwatch: constants.primaryColor,
backgroundColor: const Color(0xff82CFEA),
),
),
);
}
}Finally, here are the dependencies:
version: 1.0.0+1
environment:
sdk: ">=2.18.4 <3.0.0"
dependencies:
amplify_api: ^0.6.0
amplify_auth_cognito: ^0.6.0
amplify_authenticator: ^0.2.2
amplify_datastore: ^0.6.0
amplify_flutter: ^0.6.0
amplify_storage_s3: ^0.6.0
cached_network_image: ^3.2.1
cupertino_icons: ^1.0.2
flutter:
sdk: flutter
flutter_hooks: ^0.18.5+1
flutter_riverpod: ^1.0.4
go_router: ^4.1.0
hooks_riverpod: ^1.0.4
image_picker: ^0.8.5+3
intl: ^0.17.0
dev_dependencies:
flutter_lints: ^2.0.1
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
plugin:
platforms:
android:
package: io.github.edufolly.flutterbluetoothserial
pluginClass: FlutterBluetoothSerialPluginThanks so much
Originally posted by @nabram in #2551 (comment)
Metadata
Metadata
Assignees
Labels
AndroidIssues specific to the Android PlatformIssues specific to the Android Platformpending-close-response-requiredThe issue will be closed if details necessary to reproduce the issue are not provided within 7 days.The issue will be closed if details necessary to reproduce the issue are not provided within 7 days.pending-triageThis issue is in the backlog of issues to triageThis issue is in the backlog of issues to triageto-be-reproducedIssues that have not been reproduced yet, but have reproduction steps providedIssues that have not been reproduced yet, but have reproduction steps provided