[Native app shell] couldn't resolve package


Trying to go beyond running debug version of my app and running into problems while trying to build the Android version.

Here is the whole error block after running flutter build apk --split-per-abi (same errors with flutter built apk --release)

💪 Building with sound null safety 💪

Error: Couldn't resolve the package 'native_app_shell_mobile' in 'package:native_app_shell_mobile/configurator.dart'.
lib/main.dart:5:8: Error: Not found: 'package:native_app_shell_mobile/configurator.dart'
import 'package:native_app_shell_mobile/configurator.dart';
lib/src/web_view/web_view_container.dart:2:8: Error: Not found: 'package:native_app_shell_mobile/configurator.dart'
import 'package:native_app_shell_mobile/configurator.dart';
Error: Couldn't resolve the package 'native_app_shell_mobile' in 'package:native_app_shell_mobile/src/bridge/bridge_ui_builder_functions.dart'.
lib/src/web_view/web_view_container.dart:3:8: Error: Not found: 'package:native_app_shell_mobile/src/bridge/bridge_ui_builder_functions.dart'
import 'package:native_app_shell_mobile/src/bridge/bridge_ui_builder_functions.dart';
lib/src/bridge/bridge_manager.dart:2:8: Error: Not found: 'package:native_app_shell_mobile/src/bridge/bridge_ui_builder_functions.dart'
import 'package:native_app_shell_mobile/src/bridge/bridge_ui_builder_functions.dart';
Error: Couldn't resolve the package 'native_app_shell_mobile' in 'package:native_app_shell_mobile/src/utils/request_container.dart'.
lib/src/bridge/bridge_manager.dart:3:8: Error: Not found: 'package:native_app_shell_mobile/src/utils/request_container.dart'
import 'package:native_app_shell_mobile/src/utils/request_container.dart';
lib/src/bridge/bridge_manager.dart:70:17: Error: Type 'RequestContainer' not found.
      {required RequestContainer data, dynamic response, String? error}) {
lib/main.dart:13:9: Error: Undefined name 'AppConfigurator'.
  await AppConfigurator.initializePermissions();
lib/src/web_view/web_view_container.dart:237:9: Error: The getter 'AppConfigurator' isn't defined for the class '_WebViewContainerState'.
 - '_WebViewContainerState' is from 'package:Ready4Sea/src/web_view/web_view_container.dart' ('lib/src/web_view/web_view_container.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'AppConfigurator'.
    if (AppConfigurator.USE_GEOLOCATION) _geoInit();
lib/src/web_view/web_view_container.dart:239:9: Error: The getter 'AppConfigurator' isn't defined for the class '_WebViewContainerState'.
 - '_WebViewContainerState' is from 'package:Ready4Sea/src/web_view/web_view_container.dart' ('lib/src/web_view/web_view_container.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'AppConfigurator'.
lib/src/web_view/web_view_container.dart:240:7: Error: The getter 'BridgeUIBuilderFunctions' isn't defined for the class '_WebViewContainerState'.
 - '_WebViewContainerState' is from 'package:Ready4Sea/src/web_view/web_view_container.dart' ('lib/src/web_view/web_view_container.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'BridgeUIBuilderFunctions'.
../../flutter/.pub-cache/hosted/pub.dartlang.org/overlay_support-1.2.1/lib/src/overlay_entry.dart:101:24: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../flutter/packages/flutter/lib/src/widgets/binding.dart').
        WidgetsBinding.instance?.scheduleFrameCallback((_) => animateRemove());
lib/src/bridge/bridge_manager.dart:13:9: Error: Method not found: 'RequestContainer'.
        RequestContainer(data['payload']['id'], data['payload']['type']);
lib/src/bridge/bridge_manager.dart:21:23: Error: Undefined name 'BridgeUIBuilderFunctions'.
                await BridgeUIBuilderFunctions.registerForPushNotifications(
lib/src/bridge/bridge_manager.dart:47:30: Error: Undefined name 'BridgeUIBuilderFunctions'.
              result = await BridgeUIBuilderFunctions.socialLogin(
lib/src/bridge/bridge_manager.dart:70:17: Error: 'RequestContainer' isn't a type.
      {required RequestContainer data, dynamic response, String? error}) {
Unhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:package%3Anative_app_shell_mobile%2Fconfigurator.dart; message=StandardFileSystem only supports file:* and data:* URIs)
#0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7)
#1      asFileUri (package:vm/kernel_front_end.dart:652:37)
#2      writeDepfile (package:vm/kernel_front_end.dart:792:21)
<asynchronous suspension>
#3      FrontendCompiler.compile (file:///opt/s/w/ir/cache/builder/sdk/pkg/frontend_server/lib/frontend_server.dart:615:9)
<asynchronous suspension>
#4      starter (file:///opt/s/w/ir/cache/builder/sdk/pkg/frontend_server/lib/frontend_server.dart:1433:12)
<asynchronous suspension>
#5      main (file:///opt/s/w/ir/cache/builder/sdk/pkg/frontend_server/bin/frontend_server_starter.dart:10:14)
<asynchronous suspension>

FAILURE: Build failed with an exception.

* Where:
Script 'xxx/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1156

* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command 'xxx/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Running Gradle task 'assembleRelease'...                            7.2s
Gradle task assembleRelease failed with exit code 1

I have searched and can’t find any mention of native_app_shell_mobile elsewhere than in the lib folder. I have tried to substitute lib for native_app_shell_mobile and many other combinations, but none worked.

Any clue @Nikita_Fedorishchev ?

Hi Nicolas,

I am not an expert in Flutter, but simply trying to help… I see a reference to native_app_shell_mobile here:

Do you have it in there?


Hi Mark,

In the instructions at step 1. of Build for Release on page GitHub - Backendless/native-mobile-app-shell: Mobile native app shell is a native wrapper for a UI Builder application. It can be used to package a UI Builder app so it can run on a mobile device in a hybrid mode. The app can be published to the Apple and Google Play stores. , it says to Change the app name here in your pubspec.yaml file, so I put my app name instead. But maybe I misunderstood ?

And if it is right, then I don’t understand what all these other references to native_app_shell_mobile are doing in the remaining code and config files.

@Nikita_Fedorishchev could you please take a look?

OK, found what was wrong. @mark-piller , your question got me thinking again that it was not normal for references to remain there, so I tried some more stuff and found that I had to change the following for it to work:

  1. In main.dart :
    package:native_app_shell_mobile/configurator.dart :point_right: simply configurator.dart

  2. In /lib/src/web_view/web_view_container.dart , /lib/src/bridge/bridge_manager.dart and /lib/src/bridge/bridge_ui_builder_functions.dart :
    package:native_app_shell_mobile/src/ :point_right: ../
    package:native_app_shell_mobile/ :point_right: ../../

I have no clue if this can work for debug builds as well, and if so perhaps it could be corrected in the repo. Otherwise, if it has to be changed when building for release only, then perhaps add it to the instructions ?

By the way, @Nikita_Fedorishchev , while I’m suggesting enhancements to the documentation for the mobile app shell, I stumbled onto another one :

My app would build all the way and I could even install it to the device, but on launch it would crash instantly. Reading through this thread :

I found that there was another place the package id had to be modified : in file android/app/src/main/kotlin/com/backendless/native_app_shell/MainActivitiy.kt

After correcting that, I am please to share with you that my app is now running on the device just fine :star_struck: It took me a while, but I got there. Just needed to share that and thank the Backendless team for building a great product !

Hello, @Nicolas_REMY.

Thank you very much for the feedback. I will pay attention to these issues and fix them as soon as possible :slight_smile:
We’ve created an internal ticket BKNDLSS-28473.

Best Regards, Nikita.

I’ve updated the README.md, fixed the bug with different package names. Also fixed bug with static import link.

Glad I could help.