When using 1.0.2 of our Flutter SDK, some users that uses use_frameworks! in their podfiles (Swift projects) may see the following error:
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
In file included from /Users/bradhesse/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.0.2/ios/Classes/OneSignalPlugin.m:28:
/Users/bradhesse/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.0.2/ios/Classes/OneSignalPlugin.h:29:9: fatal error: 'OneSignal/OneSignal.h' file not found
#import <OneSignal/OneSignal.h>
^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
It appears to be an issue with how our Flutter SDK is unable to find headers for the native iOS SDK. I am working on this issue now.
Created an issue with Cocoapods here: https://github.com/CocoaPods/CocoaPods/issues/8090
When I run pod install from my terminal, I'm getting the following message...
[!] Unable to find a specification for
OneSignalDynamic (< 3.0, >= 2.8.8)depended upon byonesignal
@CharlesCleveJr Can you try running pod repo update?
@CharlesCleveJr Can you try running
pod repo update?
Thanks! This fixed the OneSignalDynamic (< 3.0, >= 2.8.8) for me.
I'm trying to use version 1.0.2 and I am not using Swift in my project. I do not see use_frameworks! in any of my project files. Getting a different header error about Flutter.h file not found when trying to run. Pod install completes just fine.
Is there a workaround for this? Reverting to version 1.0.0 and 1.0.1 did not help.
There was another strange problem I ran into while adding this plugin to my project after adding the OneSignal pod requirement as tracked here:
https://github.com/flutter/flutter/issues/19338
I'm not sure if that issue might be related to this problem? The only way I was able to work around the above issue was by creating a /Users/Projects folder. Then I also ran into this issue:
https://github.com/flutter/flutter/issues/20685
And used the workaround there to get to this missing header bug.
Also noting that I get the same problem when using the example app checked out from this repository. The only things I modified were the Bundle Identifiers to get the build to pass before blowing up on missing headers.
In file included from /Users/mose/Projects/OneSignal-Flutter-SDK/ios/Classes/OneSignalCategories.m:28:
/Users/user/Projects/OneSignal-Flutter-SDK/ios/Classes/OneSignalCategories.h:29:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
6 warnings and 1 error generated.
In file included from /Users/mose/Projects/OneSignal-Flutter-SDK/ios/Classes/OneSignalTagsController.m:28:
/Users/user/Projects/OneSignal-Flutter-SDK/ios/Classes/OneSignalTagsController.h:29:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
@CharlesCleveJr Can you try running
pod repo update?Thanks! This fixed the
OneSignalDynamic (< 3.0, >= 2.8.8)for me.
I also ran into this issue and only found the fix in this unrelated issue. Can the documentation be updated to include the pod repo update step?
https://documentation.onesignal.com/docs/flutter-sdk-setup
Any update?
Everything builds correctly in flutter but in XCode I'm getting the following error on my OneSignalExtension target ld: library not found for -lBolts
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I got around the lBolts clang error I think and now I'm getting this... ld: '/Users/charlesclevelandjr/Library/Developer/Xcode/DerivedData/Runner-fmmlmvhpgfjgwcaiisqyaplyqjvu/Build/Products/Debug-iphoneos/Bolts/libBolts.a(BFAppLink.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Users/charlesclevelandjr/Library/Developer/Xcode/DerivedData/Runner-fmmlmvhpgfjgwcaiisqyaplyqjvu/Build/Products/Debug-iphoneos/Bolts/libBolts.a' for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Never seen it before. Any ideas?
Any updates?
I got around the lBolts clang error I think and now I'm getting this...
ld: '/Users/charlesclevelandjr/Library/Developer/Xcode/DerivedData/Runner-fmmlmvhpgfjgwcaiisqyaplyqjvu/Build/Products/Debug-iphoneos/Bolts/libBolts.a(BFAppLink.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. file '/Users/charlesclevelandjr/Library/Developer/Xcode/DerivedData/Runner-fmmlmvhpgfjgwcaiisqyaplyqjvu/Build/Products/Debug-iphoneos/Bolts/libBolts.a' for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)Never seen it before. Any ideas?
Do you remove "use_frameworks!"?
No. I did disable bitcode on the Notification Service Target and it successfully built in XCode and Flutter. This wouldn't cause any errors when I archive and push to Apple would it?
@Nightsd01 any updates on this?
Try to comment "use_frameworks!"
Try to comment "use_frameworks!"
By then, Other plugins didn't work.
@Nightsd01 Any updates?
@Nightsd01 any update this is critical
I've done some more research recently and didn't make a lick of progress. For now, my only recommendation is to not use any Swift in your project and comment out use_frameworks! from your Podfile.
We will continue to investigate this since it doesn't seem like the issue in Cocoapods isn't making any headway
@Nightsd01 that is not an option firebase alone requires use_frameworks
@rlee1990 firebase does not requires it, I use firebase auth and database currently without any issues
@rostopira it does if you used swift when creating the project and other packages use swift and it can cause issues
@rlee1990 unfortunately if anything in your project requires use_frameworks! our SDK will not work until we manage to solve this issue. We have been working hard to resolve it but we still aren't sure if it's an issue with how our SDK is structured or a bug in Cocoapods. I will keep this issue updated with any developments.
I ended up and use firebase_messaging package.
@muarifer thats what i was using but their is not a way of handling foreground messages in ios the way it should be
any updates?
I asked the same question on the CocoaPods issue: I would appreciate any workaround ideas and am willing to try anything :) My project is Swift-based and uses use_frameworks!.
I'm not sure whether this post helps. You can upgrade your CocoaPods to 1.5.0 and you wouldn't need use_frameworks!
https://stackoverflow.com/a/49469205/8187386
@anderscheow I just tested this and it does not work still get the same error.
@Nightsd01 are there any updates?
I manually add the header file in the onesignal target, the error disappears, but now other swfti libraries show errors
@GustavoDMS I'm new to iOS. Could you please tell me how I can manually add the header to the onesignal target or point me to a resource I can study? Thank you.
Click in pods, change to onesignal, select buld phases, in headers click on plus and add the header
I have done some more investigation into this issue. Here is a basic explanation:
Our iOS SDK native framework is a _universal_ framework, meaning it supports multiple CPU architectures (x86, arm64, etc) so that it can run in both simulator and real devices.
When you build your app, however, Cocoapods strips any unused architectures from our framework since they are not necessary. So for example, when you are trying to run your app on a real iOS device, Cocoapods has a script that strips out the x86 portion of our framework since it is unneeded.
The problem is, their script appears to be breaking our framework, it causes it to have an invalid framework structure. I've posted a new/more detailed issue in the Cocoapods repo, hopefully we can see some movement on this problem!
I've updated our SDK to resolve issues with both Android and iOS (1.0.3). I've also changed our Flutter SDK to use our static iOS framework to resolve issues we've been having with Cocoapods.
Unfortunately this breaks Flutter projects that use Swift (use_frameworks! in the Podfile), but it should unblock everyone else. I've been working with Cocoapods to resolve the issue as quickly as possible but in the mean time this should work for most developers.
@Nightsd01 Hi, did something change on how the flutter app should be set up? :)
Hi @vmihalachi yes, I've updated our setup docs for the time being so that when you set up the OneSignalNotificationServiceExtension you add it to your Podfile like this:
target 'OneSignalNotificationServiceExtension' do
pod 'OneSignal', '>= 2.9.3', '< 3.0'
end
Thanks for the update!
@Nightsd01 thanks for your hard work!
I was running a Flutter project with Swift enabled, since I had no Swift projects yet, I reverted the iOS project back to not supporting Swift. However then I saw the bitcode problem that @CharlesCleveJr also mentions (thanks Charles!), and indeed setting enable_bitcode to NO build setting for the OneSignalNotificationServiceExtension, solved the problem.
Maybe you should consider adding that to the documentation for OneSignal in Flutter. :)
@Nightsd01 thanks for your hard work!
I was running a Flutter project with Swift enabled, since I had no Swift projects yet, I reverted the iOS project back to not supporting Swift. However then I saw the bitcode problem that @CharlesCleveJr also mentions (thanks Charles!), and indeed setting enable_bitcode to NO build setting for the OneSignalNotificationServiceExtension, solved the problem.
Maybe you should consider adding that to the documentation for OneSignal in Flutter. :)
How do you revert the iOS project to not supporting Swift?
hi
I am still having this issue, I cannot remove use_framework! line since I already use another plugin in swift which requires. "use_framework!" line.
Xcode's output:
↳
In file included from /Users/vivekmohan/Work/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.0.3/ios/Classes/OneSignalCategories.m:28:
/Users/vivekmohan/Work/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.0.3/ios/Classes/OneSignalCategories.h:28:9: fatal error: 'OneSignal/OneSignal.h' file not found
#import
^~~~~~~
1 error generated.
pod file attached
Podfile.zip
Any update? Is it currently possible to use OneSignal Flutter SDK with other Swift-related plugins in Flutter project?
@Nightsd01 why can't we reference OneSignal sources instead of framework?
With everything updated, currently, attempt to enable use_frameworks results in in following error
[!] The 'Pods-Runner' target has transitive dependencies that include static binaries: (/Users/this/StudioProjects/my_project/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework)
hello @Nightsd01
I am still having this issue, I cannot remove use_framework! line since I already use another plugin.
Xcode's output:
↳
In file included from /Users/vivekmohan/Work/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.0.3/ios/Classes/OneSignalCategories.m:28:
/Users/vivekmohan/Work/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.0.3/ios/Classes/OneSignalCategories.h:28:9: fatal error: 'OneSignal/OneSignal.h' file not found
same problem with @vmwsree
@gofur we are aware of the issue as you can see. Currently you will unfortunately have to decide which plugin you want to use. You cannot currently use our Flutter SDK while using use_frameworks! in the Podfile.
@Nightsd01
we are aware of the issue
Your awareness of the issue doesn't help, _unfortunately_
Currently you will _unfortunately_ have to decide which plugin you want to use.
I've moved to FCM with Cloud Functions, good luck with doing nothing
@Nightsd01 thanks for reply.. i hope i'm still using use_framework!.. may be u can solve this issue.. Now, i'm using FCM for push notifications,, until one_signal solve this problem :)
Please do something about this issue.
Is this issue ever going to be solved? I would love to use your service, but know that everyone using use_framework! will all be using FCM now.
Same Error,
Hydra:FlutterGoogleMaps roger$ flutter run
Launching lib/main.dart on iPhone Xs Max in debug mode...
Running pod install... 4.8s
Xcode build done. 2.6s Failed to build iOS app
Error output from Xcode build:
↳
* BUILD FAILED *
Xcode's output:
↳
Files/OneSignal/onesignal-prefix.pch"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#include "/Users/roger/flutter/FlutterGoogleMaps/ios/Pods/Target Support Files/onesignal/onesignal-prefix.pch"
^~~~~~~~~~~~~~~~~~~~~
"/Users/roger/flutter/FlutterGoogleMaps/ios/Pods/Target Support Files/OneSignal/onesignal-prefix.pch"
In file included from
/Users/roger/development/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.1.0/ios/Classes/OneSignalCategories.m:28:
/Users/roger/development/flutter/.pub-cache/hosted/pub.dartlang.org/onesignal-1.1.0/ios/Classes/OneSignalCategories.h:28:9: fatal error:
'OneSignal/OneSignal.h' file not found
#import
^~~~~~~
1 warning and 1 error generated.
After a few days researching and debugging I think I found the bug.
Both the pod and the framework are called "OneSignal" (well, actually one is called "onesignal" and another "OneSignal.) But it seems that clang is case insensitive, so consider that they are the same framework and when compiling / link and it uses the first occurrence of the framework.
I have created a fork and renaming from "onesignal" to "onesignalflutter" and now compiles well.
Fork here: https://github.com/jmrobles/OneSignal-Flutter-SDK
KR
@jmrobles Thanks, it works.
thx a lot! @jmrobles works fine
@jmrobles i'll try and share results. Thanks!
@jmrobles Thanks for digging in and finding the root of this issue!
I can confirm as well this fixes the issue. Unfortunately however it looks like we will need create a new dart package under the name onesignalflutter to get this to work. As it seems flutter and cocoapods are convention over configuration so I don't see a way to customize only the internal name for the cocoapods library. I'll try doing a bit more digging to see if there is a way to avoid this however we might have to depreciate the current onesignal package and create a new onesignal_flutter package to replace it.
@jkasten2 Yes, that's it. That's why I have not did PR.
My first attempt was just rename the podspec file and some internal references.
Apparently the plugin used to be called "OneSignalFlutter" (https://github.com/OneSignal/OneSignal-Flutter-SDK/commit/79bce99db042058977aec0e1c142f105a8fa2c4a).
KR
I Couldn't resolve this issue, How to proceed? What file needs be changed ?
After a few days researching and debugging I think I found the bug.
Both the pod and the framework are called "OneSignal" (well, actually one is called "onesignal" and another "OneSignal.) But it seems thatclangis case insensitive, so consider that they are the same framework and when compiling / link and it uses the first occurrence of the framework.I have created a fork and renaming from "onesignal" to "onesignalflutter" and now compiles well.
Fork here: https://github.com/jmrobles/OneSignal-Flutter-SDK
KR
@AlbCM while the new plugin is being created, you can use my fork. To do this in the pubspec.yaml you must remove the reference to "onesignal" and add
onesignalflutter:
     git: git://github.com/jmrobles/OneSignal-Flutter-SDK.git
Hope this can help you.
KR
@AlbCM while the new plugin is being created, you can use my fork. To do this in the pubspec.yaml you must remove the reference to "onesignal" and add
onesignalflutter: Â Â Â Â Â git: git://github.com/jmrobles/OneSignal-Flutter-SDK.gitHope this can help you.
KR
Thanks, it works like a charm!!!!
Any update? I wish to use use_frameworks! in pod. Build fail:
fatal error: 'OneSignal/OneSignal.h' file not found
using
onesignalflutter:
git: git://github.com/jmrobles/OneSignal-Flutter-SDK.git
did not help.
@westlinkin ,
We will be releasing a fix sometime in the next two weeks! Thank you so much for your patience.
News for this? I need this feature for iOS push notifications :(
Any news on this bug? We also need this for iOS notifications :)
the "next two weeks" passed
we are waiting.....
Switching to FCM
Hi everyone,
We, unfortunately, fell behind in our release schedule due to some unforeseen problems. We are working super hard to get this out as soon as possible. Thanks for your patience while we resolve. In the meantime, please use the workaround offered by jmrobles. Thanks!
Hello,
can anyone estimate when there will be a version of the Flutter Plugin?
In the meantime, please use the workaround offered by jmrobles. Thanks!
Any update? I tried the workaround mentioned but was still getting some issues.
@chrispratt
I'm sorry to hear this. Can you include some details regarding your issues?
Same error..
fatal error: 'OneSignal/OneSignal.h' file not found
using
onesignalflutter:
git: git://github.com/jmrobles/OneSignal-Flutter-SDK.git
Anyone?
I have the same error that @rdgoutiyama when using the workaround :(
@rdgoutiyama @leonardohklaus
We just released onesignal_flutter 2.0.0 which should fix the header issue when you have use_frameworks! in your Podfile. Make sure to follow the migration guide in the release notes.
If you are still seeing an issue please run flutter doctor -v and report back the relevant sections.
For reference I have tried the following latest versions without issues.
[✓] Flutter (Channel beta, v1.7.8+hotfix.4, on Mac OS X 10.14.5 18F132, locale en-US)
• Flutter version 1.7.8+hotfix.4 at /Users/josh/flutter
• Framework revision 20e59316b8 (4 days ago), 2019-07-18 20:04:33 -0700
• Engine revision fee001c93f
• Dart version 2.4.0
....
[✓] Xcode - develop for iOS and macOS (Xcode 10.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.2.1, Build version 10E1001
• CocoaPods version 1.6.1
[✓] iOS tools - develop for iOS devices
• ios-deploy 1.9.4
@chrispratt
I'm sorry to hear this. Can you include some details regarding your issues?
Sorry it took so long to get back! I just tried release version 2.0.0 and I get the error:
error: Build input file cannot be found:
'/Users/Chris/Savour-Flutter/build/ios/Debug-iphonesimulator/OneSignalNotificationServiceExtension.appex/OneSignalN
otificationServiceExtension'
I dug around and thought this may be a plist issue so I tried adding the info.plist from the OneSignalNotificationServiceExtension folder in the copy bundle resources phase of the OneSignalNotificationServiceExtension target's build phases. the produced the error:
Multiple commands produce '/Users/Chris/Library/Developer/Xcode/DerivedData/Runner-bzakjwxalmanlqbdgevkfxfuaqmd/Build/Products/Debug-iphoneos/OneSignalNotificationServiceExtension.appex/Info.plist':
1) Target 'OneSignalNotificationServiceExtension' (project 'Runner') has copy command from '/Users/Chris/Savour-Flutter/ios/OneSignalNotificationServiceExtension/Info.plist' to '/Users/Chris/Library/Developer/Xcode/DerivedData/Runner-bzakjwxalmanlqbdgevkfxfuaqmd/Build/Products/Debug-iphoneos/OneSignalNotificationServiceExtension.appex/Info.plist'
2) Target 'OneSignalNotificationServiceExtension' (project 'Runner') has process command with output '/Users/Chris/Library/Developer/Xcode/DerivedData/Runner-bzakjwxalmanlqbdgevkfxfuaqmd/Build/Products/Debug-iphoneos/OneSignalNotificationServiceExtension.appex/Info.plist'
I'm not sure if any of that helps but I appreciate any guidance you have.
Also for reference, my output from flutter doctor is:
flutter doctor -v
[!] Flutter (Channel stable, v1.7.8+hotfix.3, on Mac OS X 10.15 19A487l, locale en-US)
• Flutter version 1.7.8+hotfix.3 at /Users/Chris/development/flutter
• Framework revision b712a172f9 (13 days ago), 2019-07-09 13:14:38 -0700
• Engine revision 54ad777fd2
• Dart version 2.4.0
✗ Downloaded executables cannot execute on host.
See https://github.com/flutter/flutter/issues/6207 for more information
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/Chris/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
• Xcode at /Applications/Xcode-beta.app/Contents/Developer
• Xcode 11.0, Build version 11M336w
• CocoaPods version 1.7.1
[✓] iOS tools - develop for iOS devices
• ios-deploy 1.9.4
[✓] Android Studio (version 3.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 31.3.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[✓] VS Code (version 1.36.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.2.0
[✓] Connected device (1 available)
• iPhone Xʀ • 7EDD8F8C-5339-45B5-BE31-40B885B1F314 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-0 (simulator)
! Doctor found issues in 1 category.
My podfile is:
# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
pods_ary = []
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary
end
target 'Runner' do
use_frameworks!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
end
generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
end
}
# Plugin Pods
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
pod p[:name], :path => File.join(symlink, 'ios')
}
end
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true
target 'OneSignalNotificationServiceExtension' do
use_frameworks!
pod 'OneSignal', '>= 2.9.3', '< 3.0'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end
I get this error when trying to build for android:
[√] Flutter (Channel stable, v1.7.8+hotfix.3, on Microsoft Windows [Version 10.0.18362.239], locale en-SI)
• Flutter version 1.7.8+hotfix.3 at C:\flutter
• Framework revision b712a172f9 (13 days ago), 2019-07-09 13:14:38 -0700
• Engine revision 54ad777fd2
• Dart version 2.4.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
• Android SDK at C:\Users\sdukaric\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[!] Android Studio (version 3.4)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[√] VS Code (version 1.36.1)
• VS Code at C:\Users\sdukaric\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.2.0
[√] Connected device (1 available)
• SM G955F • ce06171679052b2601 • android-arm64 • Android 9 (API 28)
! Doctor found issues in 2 categories.
Note: C:\flutter\.pub-cache\hosted\pub.dartlang.org\connectivity-0.4.3+6\android\src\main\java\io\flutter\plugins\connectivity\ConnectivityPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\flutter\.pub-cache\hosted\pub.dartlang.org\onesignal_flutter-2.0.0\android\src\main\java\com\onesignal\flutter\FlutterRegistrarResponder.java:4: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
^
C:\flutter\.pub-cache\hosted\pub.dartlang.org\onesignal_flutter-2.0.0\android\src\main\java\com\onesignal\flutter\OneSignalPlugin.java:4: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
^
C:\flutter\.pub-cache\hosted\pub.dartlang.org\onesignal_flutter-2.0.0\android\src\main\java\com\onesignal\flutter\OneSignalTagsController.java:3: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
^
C:\flutter\.pub-cache\hosted\pub.dartlang.org\onesignal_flutter-2.0.0\android\src\main\java\com\onesignal\flutter\FlutterRegistrarResponder.java:57: error: cannot find symbol
protected void runOnMainThread(@NonNull final Runnable runnable) {
^
symbol: class NonNull
location: class FlutterRegistrarResponder
C:\flutter\.pub-cache\hosted\pub.dartlang.org\onesignal_flutter-2.0.0\android\src\main\java\com\onesignal\flutter\FlutterRegistrarResponder.java:61: error: cannot find symbol
protected void invokeMethodOnUiThread(@NonNull final String methodName, @NonNull final HashMap map) {
^
symbol: class NonNull
location: class FlutterRegistrarResponder
C:\flutter\.pub-cache\hosted\pub.dartlang.org\onesignal_flutter-2.0.0\android\src\main\java\com\onesignal\flutter\FlutterRegistrarResponder.java:61: error: cannot find symbol
^
symbol: class NonNull
location: class FlutterRegistrarResponder
C:\flutter\.pub-cache\hosted\pub.dartlang.org\onesignal_flutter-2.0.0\android\src\main\java\com\onesignal\flutter\OneSignalPlugin.java:69: error: cannot find symbol
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
^
symbol: class NonNull
location: class OneSignalPlugin
C:\flutter\.pub-cache\hosted\pub.dartlang.org\onesignal_flutter-2.0.0\android\src\main\java\com\onesignal\flutter\OneSignalPlugin.java:69: error: cannot find symbol
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
^
symbol: class NonNull
location: class OneSignalPlugin
C:\flutter\.pub-cache\hosted\pub.dartlang.org\onesignal_flutter-2.0.0\android\src\main\java\com\onesignal\flutter\OneSignalTagsController.java:34: error: cannot find symbol
@NonNull private AtomicBoolean replySubmitted = new AtomicBoolean(false);
^
symbol: class NonNull
location: class OSFlutterChangeTagsHandler
C:\flutter\.pub-cache\hosted\pub.dartlang.org\onesignal_flutter-2.0.0\android\src\main\java\com\onesignal\flutter\OneSignalTagsController.java:87: error: cannot find symbol
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
^
symbol: class NonNull
location: class OneSignalTagsController
C:\flutter\.pub-cache\hosted\pub.dartlang.org\onesignal_flutter-2.0.0\android\src\main\java\com\onesignal\flutter\OneSignalTagsController.java:87: error: cannot find symbol
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
^
symbol: class NonNull
location: class OneSignalTagsController
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
11 errors
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 5.5s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.
*******************************************************************************************
Gradle task assembleRelease failed with exit code 1
@chrispypatt Did you get any other errors before the "error: Build input file cannot be found:" error? I don't believe that error is related to the .plist file. You shouldn't have to add your .plist file to copy bundle resources.
Can you check the example project for reference?
https://github.com/OneSignal/OneSignal-Flutter-SDK/tree/master/example/ios
Some things to compare would be your Podfile. These lines specifically.
https://github.com/OneSignal/OneSignal-Flutter-SDK/blob/master/example/ios/Podfile#L57-L59
https://github.com/OneSignal/OneSignal-Flutter-SDK/blob/master/example/ios/Podfile#L69-L70
I noticed you have use_frameworks! in the OneSignalNotificationServiceExtension target which might be the issue.
@dukaric1991 Since the original issue is related to an iOS build issue can you open a new issue related to this Android build issue?
To save some back and forth though before creating a new issue, do you have anything custom in your build.gradle that could be removing the android.support.annotation library? Can you share you build.gradle in your new issue if you are not sure?
@jkasten2
androidbuild.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android\appbuild.gradle:
buildscript {
repositories {
// ...
maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
}
dependencies {
// ...
// OneSignal-Gradle-Plugin
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.tennboardflutter"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
gradle.properties:
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
@chrispypatt Did you get any other errors before the "error: Build input file cannot be found:" error? I don't believe that error is related to the .plist file. You shouldn't have to add your .plist file to
copy bundle resources.
I'm not at my personal computer right now so I can't double-check the errors I was getting but don't believe there was anything else related to this issue. The only other Xcode output I have been getting is typical for my project where it occasionally warns me about issues related to my target device. This is because I am using Flutter with Xcode11. I can post what I am seeing there tonight in case it is related.
Can you check the example project for reference?
https://github.com/OneSignal/OneSignal-Flutter-SDK/tree/master/example/ios
I can check the project settings tonight when I'm at my personal computer. The only other difference I see off the bat is I'm using swift instead of Obj-C.
Some things to compare would be your Podfile. These lines specifically.
https://github.com/OneSignal/OneSignal-Flutter-SDK/blob/master/example/ios/Podfile#L57-L59
https://github.com/OneSignal/OneSignal-Flutter-SDK/blob/master/example/ios/Podfile#L69-L70I noticed you have
use_frameworks!in theOneSignalNotificationServiceExtensiontarget which might be the issue.
I have other dependencies that rely on use_frameworks!. I originally tried to run pod install without it in the OneSignalNotificationServiceExtension target but cocoapods complains that both OneSignalNotificationServiceExtension and Runner targets have to either both use it or not. When I use use_frameworks!, pod install runs without an issue, I just get the build error.
Does it matter where I put the line?:
# Fixes Flutter.framework in shell script build phase '[CP] Embed Pods Frameworks' error
install! 'cocoapods', :disable_input_output_paths => true
I have mine before the post_install.
@rgomezp Thanks for the help getting this working. I compared my project line for line in build settings and build phases and got it working. Mine had several differences but finally got it working!
@chrispypatt Good to hear, sounds like the 2.0.0 SDK update has resolve the cocoapods issues!
Locking this issue, please open a new issue for there are any further iOS Cocoapod issues. Thanks.
Most helpful comment
After a few days researching and debugging I think I found the bug.
Both the pod and the framework are called "OneSignal" (well, actually one is called "onesignal" and another "OneSignal.) But it seems that
clangis case insensitive, so consider that they are the same framework and when compiling / link and it uses the first occurrence of the framework.I have created a fork and renaming from "onesignal" to "onesignalflutter" and now compiles well.
Fork here: https://github.com/jmrobles/OneSignal-Flutter-SDK
KR