Reputation: 8899
I am running integration tests with Flutter application. I am also using Flavors
in Flutter. The problem is it is giving me this error:
Gradle build failed to produce an .apk file. It's likely that this file was generated under /home/khamidjon/Desktop/android_flutter_projects/my-project/build, but the tool couldn't find it.
pubspec.yaml
.test_driver/integration_test.dart:
import 'package:integration_test/integration_test_driver.dart';
Future<void> main() => integrationDriver();
integration_test/main_functions_test.dart:
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidgets("failing test example", (WidgetTester tester) async {
expect(2 + 2, equals(5));
});
}
Then run following command in terminal:
flutter drive \
--driver=test_driver/integration_test.dart \
--target=integration_test/main_functions_test.dart
Upvotes: 4
Views: 3298
Reputation: 1790
This helped me to fix the same problem.
Build Configuration
of the added scheme:integration_test/app_test.dart
should look like this:flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart --flavor e2e
Upvotes: 2
Reputation: 8899
Because you are using flavors, you need to specify which flavor you want to run your app:
flutter drive \
--driver=test_driver/integration_test.dart \
--target=integration_test/main_functions_test.dart --flavor development
Upvotes: 2