Native mobile app shell build issues (iOS and Android)

Hi,

Trying out the newly announced native mobile app shell, which could be a game changer for me. I was going to start development on another platform when I saw this. I figured I should try it out because if Backendless allows me to build both back- and frontend in the same place, it seems better. I really need to validate that this can and will work, though, because my target is a mobile app and a web app is not my objective.

However, I am having one or more issues (don’t know if they’re linked and if they are specific to Backendless or not).

I followed the steps at https://github.com/Backendless/native-mobile-app-shell , starting with seting up my IDE. I got the Flutter demo app to work fine on Android emulator and hardware, and on iOS simulator and hardware

Issue 1
when running flutter build ios or flutter run with an iPhone connected

Failed to build iOS app
Error output from Xcode build:
↳
    objc[48382]: Class AMSupportURLConnectionDelegate is implemented in both
    /usr/lib/libauthinstall.dylib (0x1f7c56b90) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice
    (0x107bb02c8). One of the two will be used. Which one is undefined.
    objc[48382]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib
    (0x1f7c56be0) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice
    (0x107bb0318). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **

I understand that something comes as a duplicate. Any clue as to what ?

Issue 2

I get warnings about

/Dev/backendless/native-mobile-app-shell/ios/Pods/Pods.xcodeproj: warning: The iOS
    deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported
    deployment target versions is 9.0 to 15.2.99. (in target 'Starscream' from project 'Pods')
/Dev/backendless/native-mobile-app-shell/ios/Pods/Pods.xcodeproj: warning: The iOS
    deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported
    deployment target versions is 9.0 to 15.2.99. (in target 'OrderedSet' from project 'Pods')

Even when I try to change the value from 8.0 to 9.0 in the files, it seems to come back next time. I suppose these files are rebuilt automatically and not persistent.

Issue 3

Could not build the precompiled application for the device.
Error (Xcode): No profiles for 'com.backendless.native-app-shell' were found: Xcode couldn't find
any iOS App Development provisioning profiles matching 'com.backendless.native-app-shell'. Automatic
signing is disabled and unable to generate a profile. To enable automatic signing, pass
-allowProvisioningUpdates to xcodebuild.

It appears that there was a problem signing your application prior to installation on the device.

Verify that the Bundle Identifier in your project is your signing id in Xcode
  open ios/Runner.xcworkspace

Also try selecting 'Product > Build' to fix the problem:

Error launching application on iPhone.

For this one, I understand that building with the Backendless bundle identifier is probably not allowed since my Apple profile is not part of that team. Could you provide guidance as to whether it would be appropriate to change the references to that bundle to my own ? I have found them in the ios/Runner.xcodeproj file.

Issue 4
when running flutter run with an Android connected

../../flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.2/lib/src/interface/local_platform.dart:46:19: Error: Member not found: 'packageRoot'.
      io.Platform.packageRoot; // ignore: deprecated_member_use
                  ^^^^^^^^^^^

FAILURE: Build failed with an exception.

* Where:
Script '/Users/bibou/Dev/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1102

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

I don’t have any clue about this one.

Note : I am running a MacBook with an Apple Silicon M1 ARM chip if that has anything to do with it.

Thanks for any help which could get me to build and run a simple app in order to prove that this new possibility is indeed an opportunity.

Hello, @Nicolas_REMY.

  1. Make sure the iOS deployment target is 10.0. Then run these commands:
flutter clean
flutter pub get
cd ios
pod install
cd ..
flutter build ios
flutter upgrade pub
  1. To avoid the warning, try replace the code of post_install listener in your podfile with this one:
post_install do |installer|
 installer.pods_project.targets.each do |target|
   flutter_additional_ios_build_settings(target)
  target.build_configurations.each do |config|
   config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
  end
 end
end
  1. You can read about these settings here: Build and release an iOS app | Flutter.
  2. Delete your pubspec.lock , and press ‘Pub Get’ in your pubspec.yaml , it’ll regenerate pubspec.lock file again and should fix the problem.

All problems, with the exception of the command, and warnings, are some kind of incorrectly cached data.

Try the steps above and describe if it solved your problem.

Best Regards, Nikita.

Hello Nikita,

Thank you very much for your reply and for taking the trouble of providing guidance.

I restarted from scratch, pulling the latest version of the native-mobile-app-shell, and inserting the ui assets therein.

I then followed your recommendation 1. instead of step 6. of these instructions : https://github.com/Backendless/native-mobile-app-shell

When you say “Make sure the iOS deployment target is 10.0” I understood that to be in Xcode > Runner > General > Deployment Info. Or should that be elsewhere ?

I also did not have to apply the replacement code in your recommendation 2. since it had already been modified in the latest version of the native-mobile-app-shell.

I checked afterwards in the project and it seems indeed that all IPHONEOS_DEPLOYMENT_TARGET values are set to 10.0. The warnings reported in my Issue 2 disappeared. Hooray ! Thanks. :raised_hands: :tada: :pray:

Issue 1 remains, though, as well as Issue 3 :

Here is the full output of flutter run.

Running "flutter pub get" in native-mobile-app-shell...          1,816ms
Launching lib/main.dart on iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project:
24G84UVS9Y
Running pod install...                                           1,054ms
Running Xcode build...                                                  
Xcode build done.                                            4.2s
Failed to build iOS app
Error output from Xcode build:
↳
    objc[15896]: Class AMSupportURLConnectionDelegate is implemented in both
    /usr/lib/libauthinstall.dylib (0x1ea95ab90) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice
    (0x105f642c8). One of the two will be used. Which one is undefined.
    objc[15896]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib
    (0x1ea95abe0) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice
    (0x105f64318). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **


Xcode's output:
↳
    Writing result bundle at path:
    	/var/folders/pd/tch93hcd7ns_95756x81w9th0000gn/T/flutter_tools.YKNYRa/flutter_ios_build_temp_di
    	rxAHzPE/temporary_xcresult_bundle

    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    error: No profiles for 'com.backendless.native-app-shell' were found: Xcode couldn't find any
    iOS App Development provisioning profiles matching 'com.backendless.native-app-shell'. Automatic
    signing is disabled and unable to generate a profile. To enable automatic signing, pass
    -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner')

    Result bundle written to path:
    	/var/folders/pd/tch93hcd7ns_95756x81w9th0000gn/T/flutter_tools.YKNYRa/flutter_ios_build_temp_di
    	rxAHzPE/temporary_xcresult_bundle


Could not build the precompiled application for the device.
Error (Xcode): No profiles for 'com.backendless.native-app-shell' were found: Xcode couldn't find
any iOS App Development provisioning profiles matching 'com.backendless.native-app-shell'. Automatic
signing is disabled and unable to generate a profile. To enable automatic signing, pass
-allowProvisioningUpdates to xcodebuild.



It appears that there was a problem signing your application prior to installation on the device.

Verify that the Bundle Identifier in your project is your signing id in Xcode
  open ios/Runner.xcworkspace

Also try selecting 'Product > Build' to fix the problem:

Error launching application on iPhone.

As I understand it, the flutter run command should run a debug version of the app on my iPhone, right ? You guided me in your recommendation 3. to a page about building for release, yet here I am trying to run and debug, not release. At the end of the native-mobile-app-shell instructions, in the section “Setup” it said “After that, your application will be ready for testing.” I thought that was the same.

Can you confirm that I have to go through all the steps in the “Build for release” section before being able to debug ?

About your last step 4, I am afraid I will need more guidance. Where am I supposed to press ‘Pub Get’ ? To me pubspec.yaml is but a code file. I am using the VS Code IDE if that is of any help.

Also, how could this all be due to some kind of incorrectly cached data, since I restarted absolutely from scratch. All commands were executed for the first time.

:pray: Thanks again for your help in moving forward. I would really need to validate that the shell does work, otherwise I will need to find some other way of building my codeless app.

Hi Nicolas,

I am sure Nikita will get back to you, but I wanted to ask if you tried building and running any other flutter project? It seems to me the majority of the issues are unrelated to our native shell and have something to do with your environment configuration. Just a thought…

Mark

Hi Mark,

Thanks for the quick reply.

Indeed I wondered, just like you, whether the issues I was facing were linked to Flutter more generally or to the mobile app shell.

However, as stated in the opening, I installed Flutter and did get their demo app to work fine on Android emulator and hardware, and on iOS simulator and hardware.

This led me to believe that the issues were not general to Flutter, but rather more specific.

Now, I am not competent to build another app to test this hypothesis - this is why I am trying to go for a codeless app !

Would be glad to get your feeling on this one.

Best regards

Hi again,

Just wanted to let you know that I finally managed to run the app on a simulated iPhone.

I erased the pubspec.lock file and recreated it through :

flutter clean
flutter pub get

This was suggested by Nikita above, but I had not gone fully gone though because the way to regenerate the lock file was unclear (see my previous posts). I finally found the way forward elsewhere and it worked.

The lock file actually comes with the git release, and for some reason did not seem to work for me. Since the two commands above, also listed in step 6. of https://github.com/Backendless/native-mobile-app-shell, seem to rebuild the lock file, may I suggest that it is not needed in the release ? Because it indeed seems to introduce “some kind of incorrectly cached data” as suspected by Nikita, it would seem reasonable to not deploy it and to actually rebuild it locally through clean and pub get.

Nikita,

Here is a follow up on where I stand.

I have been able to run on both Android and iPhone simulators.

However, running on a real iPhone has not been possible. I am still encountering the signing issue, even though I am running flutter run, which should run in debug mode.

I also keep having the duplicate implementation message, but from what I understand that is just parasitic information from flutter which means there is something wrong later on (the signing issue).

Hi @Nicolas_REMY.
This problem occurs because you are using the default package ID from the project in the GitHub.


You need to provide your own Team and Bundle ID.
Here are the instructions on how to do this from the Flutter documentation I mentioned earlier:

Every iOS application is associated with a Bundle ID, a unique identifier registered with Apple. To register a Bundle ID for your app, follow these steps:

Open the App IDs page of your developer account.
Click + to create a new Bundle ID.
Enter an app name, select Explicit App ID, and enter an ID.
Select the services your app uses, then click Continue.
On the next page, confirm the details and click Register to register your Bundle ID.

Thanks for the feedback, I took this information into account and removed pubspec.lock file from the git repository.

The lock file actually comes with the git release, and for some reason did not seem to work for me. Since the two commands above, also listed in step 6. of https://github.com/Backendless/native-mobile-app-shell, seem to rebuild the lock file, may I suggest that it is not needed in the release ? Because it indeed seems to introduce “some kind of incorrectly cached data” as suspected by Nikita, it would seem reasonable to not deploy it and to actually rebuild it locally through clean and pub get.

Best Regards, Nikita.

Hi and thank you for your reply.

From the instructions at https://github.com/Backendless/native-mobile-app-shell I had understood that after setup steps 1-6, it said “After that, your application will be ready for testing.”

If I understand correctly what you are saying, you mean I do have to go through the “Build for Release” steps even though I only want to test, and not release. Can you confirm, please ? If so, I would suggest adapting the documentation so that it does not lead to believe that after Setup tests 1-6 the application can be tested on a device.

Best regards, Nicolas

Yes, you are right, I will transfer the information about setting the bundle id and team to the previous block.