When I try and run my project in xcode, I am getting the following error:
'auto_orientation/AutoOrientationPlugin.h' file not found.
If I remove this plugin, it will then go to the next plugin and fail on the .h file for that plugin and so on for every single plugin.
Previously this issue only used to happen when I attempted to make an archive, but it would always run without issues. Now it will not even run.
There are many threads about this and I have run through these but have so far been unable to find any suggestion that is working.
Pubspec.yaml file, as requested:
name: app_name
description: My application.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org.
version: 6.0.0
environment:
sdk: ">=2.3.0-dev.0.5 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: 0.1.2
firebase_admob: 0.5.5
screen: 0.0.5
image_picker: 0.6.1
firebase_auth: 0.11.1+7
shared_preferences: 0.4.3
rflutter_alert: 1.0.2
url_launcher: 5.0.3
in_app_purchase: 0.2.0
firebase_dynamic_links: 0.4.0+4
app_review: 1.1.0+1
auto_orientation: 1.0.4
vibration: 1.2.1
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
assets:
- lib/images/
- lib/images/example1.png
- lib/images/example2.png
- lib/images/example3.png
uses-material-design: true
Screenshot for Cenk:
you definitely do not need to wipe out your whole ios/ folder.
1) flutter cleancause why not
2) rm ios/Podfile.lock
3) rm -rf ios/Pods
4) rm -rf ~/.pub-cache/hosted/pub.dartlang.org/ (or wherever you set this up to live)
5) flutter packages get
then run/build your app however you normally do it.
Sometimes I also get ios compilation error in my project working properly, I create a clean project with the same name, copy my codes there and it gets better.
I suggest you try if you can't find a solution.
I have had such issues before. The error was because I deleted a package dependency from my pubspec.yaml. As we know deleting a package as such will remove all the flutter files it downloaded form pub.dev but forgot to delete the permission and method I added into Info.plist and AppDelegate.swift manually as dependencies for that package.
When Xcode see this methods in the AppDelegate.switf, it searches for the required files but it can't find them because the package was deleted from pubspec.yaml.
So cross-check if the content of those 2 files matches the packages that require them.
Hope it helps.
Edit
Based on your pubspec.yaml, they are some keys that need to be added to your AndroidManifest and info.plist files respectively. I assume you haven't done that from your comment.
Locations
AndroidManifist is found in android/app/src/main/AndroidManifiest.xml
info.plist is found in iso/Runner/Info.plist
For the firebase_admob package you need to add the following to your AndroidManifest
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="[ADMOB_APP_ID]"/>
Where [ADMOD_APP_ID] is your App ID. Check firebase_admod to see how to initialize an app ID and how to initialize the plugin
Then you need to add the following to your info.plist
<key>GADApplicationIdentifier</key>
<string>[ADMOB_APP_ID]</string>
For screen 0.0.5 you need to add the following permission to your 'AndroidManifest`
<uses-permission android:name="android.permission.WAKE_LOCK" />
For image_picker: 0.6.1, you also need some permission added to the info.plist.
Add the following keys to your Info.plist file, located in /ios/Runner/Info.plist:
NSPhotoLibraryUsageDescription - describe why your app needs
permission for the photo library. This is called Privacy - Photo
Library Usage Description in the visual editor.
NSCameraUsageDescription - describe why your app needs access to the
camera. This is called Privacy - Camera Usage Description in the visual editor.
NSMicrophoneUsageDescription - describe why your app needs access to
the microphone if you intend to record videos. This is called Privacy
Microphone Usage Description in the visual editor.
Android No configuration required - the plugin should work out of the box
Not to be redundant, you need to browse you the package in you pubspec.yaml pub.dev page and follow the instruction to add all the dependencies for the packages to work.
I hope you project compiles now!
I guess you have some files missing for some reason.
I hope this steps maybe solve it:
backup your flutter project folder
delete "ios" folder from your your flutter project
run flutter create -i swift , this command will recreate new 'ios' folder
run your flutter project
In the end I found a fix for this in another forum:
Seems like by opening up the project by double clicking Runner.xcworkspace instead of Runner.xcodeproj xcode can finally figure out where everything is.
I tried this and it literally works. Now my app will run with a new error (because of course):
malloc: can't allocate region securely
But I will make a new question for that one.
Related
I am trying to integrate firebase_crashlytics in my Flutter App.
https://pub.dartlang.org/packages/firebase_crashlytics#-readme-tab-
I am facing an issue with iOS integration. In the docs, it is specified that If on Xcode 10 Add your app's built Info.plist location to the Build Phase's Input Files field. Eg: $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)
I have already created the Firebase project and did the initial setup required on the iOS part like pod install for Firebase and adding code in AppDelegate File.
I am not able to figure out what does this means? does it mean the literal path of info.plist file. I downloaded the sample project mentioned in the docs but it does not have anything related to the above point. I did something as below
I literally added the path to my info.plist file as below $(BUILT_PRODUCTS_DIR)/$(/Users/priitshsawant/Desktop/firebase_crashltics/firebase_crashltics/ios/Runner/Info.plist). I tried crashing my app but it is not showing up in Firebase Crashlytics
You should be perfectly fine by just leaving it as $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)
This will resolve to your absolute path of the Info.plist once Xcode is building.
Just like so:
I fixed this problem following these steps.
Make sure that Run Script is added as mention by the Robin Reiter
Run Flutter Clean
Run Pod install
Then use Xcode to build and run
if it's not working with the actual device use the simulator
it's work for me in firebase_crashlytics: 2.5.1:
${PODS_ROOT}/FirebaseCrashlytics/run
not use
"${PODS_ROOT}/FirebaseCrashlytics/run"
How to use local flutter package in another flutter application?
I created a package using following command:
flutter create --template=package my_new_package
and then in my application source code => main.dart
import "package:my_new_package/my_new_package.dart" // can not find the package
Find this file in your flutter application => pubspec.yaml
Use local dependency
dependencies:
flutter:
sdk: flutter
my_new_package:
path: ./my_new_package
Note: The ./my_new_package above means that the my_new_package directory containing the pubspec.yaml for the package is a sub-directory of the app.
If you have the package as a directory at the same level as the app, in other words one level higher up in the directory tree, you can use ../my_new_package (note the double dot) or a full path to the package directory.
Path dependency: A Flutter app can depend on a plugin via a file system path: dependency. The path can be either relative or absolute. For example, to depend on a plugin plugin1 located in a directory next to the app, use the following syntax:
dependencies:
plugin1:
path: ../your_package/
For the full process:
Download the code for the plugin you want to use and place it at the "same" level as your flutter project directory
-- plugin-name
-- your flutter directory -- lib
-- android
-- ios etc etc
Add the plugin path to pubspec.yaml. *If you are unsure of the correct plugin name to use, look at the name: attribute in the plugin's pubspec.yaml file. The plugin directory must also be saved with the same name:
dependencies:
plugin-name:
path: ../plugin-name
Run Pub get and you can import just like any other plugin. Only difference is when you click on any of the plugin classes during development, it will point to the local file.
Hey I had same problem once I started using flutter.
I have implemented example of pdf_view plugin in my app for making changes for Shimmer effect instead of CircularProgressIndicator().
Some Knowledge
You can edit plugins which are get by flutter pub get but they might be replaced when you create app bundle by flutter.
Now your answer with sample plugin suppose take an example of advance_pdf_viewer
GitHub Link
Download zip file and extract it in pdf_viewer/
Make sure pdf_viewer/ has all files including lib, Android, iOS and all related files.
Copy your pdf_viewer folder in your project directory for example
my project is invoice_viewer so it's root directory have all folders such as lib, Android, iOS etc. copy it in this root directory along with lib, Android, iOS.
Now open your pubsec.yaml and write code as follows
dependencies:
flutter:
sdk: flutter
# advance_pdf_viewer: ^2.0.0
advance_pdf_viewer:
path: ./pdf_viewer
In comment I have replaced server version with local one and make changes in plugin's viewer.dart file to achieve desired changes.
Hope you and other got some information from this finding!
I need to have a webview inside my context body, but not to cover the entire screen space as I have to display a listview below it.
I checked flutter_webview_plugin but it did not work
Getting the error :
That library is in a package that is not known. Maybe you forgot to mention it in your pubspec.yaml file?
dependencies:
flutter:
sdk: flutter
url_launcher: ^0.4.1
async_loader: "^0.1.1"
json_annotation: ^0.2.2
flutter_webview_plugin: "^0.1.5"
cupertino_icons: ^0.1.0
#url_launcher: ^3.0.0
dev_dependencies:
flutter_test:
sdk: flutter
json_serializable: ^0.4.0`
I have written below line in my dart file
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
If you add a new package to your dependencies, then do a hot reload, you get the following misleading message:
Performing hot reload...
Your application could not be compiled, because its dependencies could not be
established.
The following Dart file:
/usr/local/google/home/ianh/dev/release/startup_namer/lib/main.dart
...refers, in an import, to the following library:
package:package:flutter_webview_plugin/flutter_webview_plugin.dart
That library is in a package that is not known. Maybe you forgot to mention it in
your pubspec.yaml file?
Try again after fixing the above error(s).
Kill your application and start it again. This might solve your issue.
For more references please visit this git hub discussion
Go to the build directory, which will be located at the top level of your app along with lib, ios, android, etc.
If a flutter_webview_plugin folder is not there, then you need to run flutter pub get to download the package.
If the folder is there, then it has already been downloaded. If that is the case and your IDE is still telling you that it does not recognize the package, then try restarting your IDE.
Under Getting Started > Getting Flutter at https://dart-atom.github.io/dartlang/:
"And from Atom, open the dartlang plugin’s preferences and set the Flutter SDK path to where the Flutter repo was cloned locally."
I have opened the settings for the dartlang plugin in Atom. There is no setting for Flutter SDK path. There is however a setting for Dart SDK Location. Is that the value that I should change to "where the flutter repo was cloned locally"? If not, where is the setting? Are the Dart docs wrong / in need of an update?
I should probably note that the Dartlang: Create Flutter Project command in Atom works even if this step is skipped. So I am more confused because I don't know if it's unnecessary, or I did something extra/right by accident, or this is expected but I'll run into issues later from not being able to update a setting that doesn't exist.
those instructions were updated slightly before the lastest version of the atom plugin was published; you should see the Flutter SDK field in the settings now.
The process for developing with Flutter did change a bit over the weekend. You'll probably want to:
pub global deactivate flutter
clone the flutter repo (see http://flutter.io/getting-started/)
set that Flutter SDK field in the atom plugin, and
add the flutter/bin location to your system path
That first deactivate step is to ensure that you don't have copies of the pub globally activated app on your path. The new workflow instead uses a 'flutter' shell script.
I'm trying to build a system which can compile a project given the source code (the Cordova SDK app project) and the optional provision settings, similiar to PhoneGap's Build. Behind the scenes I try to use the xcodebuild command to create the final IPA and return it to the user. All the projects developed using Cordova and prepared to be compiled with XCode with the following commands:
cordova platform add ios
cordova prepare ios
The problem is that the xcodebuild requires the project's schemes, which according to my search on the subject are generated only when you open the project with the XCode GUI.
Is there any way to generate the schemes for the project using command line tools only? Are the schemes are the same for every project so I can copy a static one to each project I want to compile?
I'm not really a XCode guy or Mac guy for that matter, so I'd be happy for a clear explanation for how and why the solution works, if there is one...
Edit:
Just to clarify my final intestions:
When I open the project using the XCode GUI (double click the .xcodeproj) it generates the schemes and then I can use the xcodebuild command successfully without any problem. But I need this system to be completely automated, so that the user can upload he's project built with the Cordova framework and have this system generate the IPA for him if he choose so. (He can also choose other platforms which are supported by the Cordova framework). Much like PhoneGap's build eventually.
You can generate the schemes programmatically using a build hook script that the Cordova CLI will run before building for iOS. I wrote a blog post on this here but here's a summary:
I chose to use the xcodeproj Ruby gem, you can get this with:
sudo gem install xcodeproj
Then create a hook script "fix_xcode_schemes.rb" in the hooks folder of your Cordova project, set it to 755 file permissions so that it is executable and put this in the script:
#!/usr/bin/env ruby
require 'xcodeproj'
xcproj = Xcodeproj::Project.open("platforms/ios/schemedemo.xcodeproj")
xcproj.recreate_user_schemes
xcproj.save
Adjust the platforms/ios/schemedemo.xcodeproj to match your project name.
Then to run the script edit your project's config.xml and add:
<platform name="ios">
<hook type="after_platform_add" src="hooks/fix_xcode_schemes.rb" />
...
</platform>
Full code and Github on the blog post I linked to. Here I use after_platform_add so the Cordova CLI will add the schemes after the iOS platform is added. For an existing project you may want to swap this for before_prepare or before_build to add the schemes if you don't want to remove and re-add the ios platform to use my original example. Cordova Hook documentation is here.