Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Headers <OneSignal/OneSignal.h> (Cocoapods issue) #21

Closed
Nightsd01 opened this issue Sep 13, 2018 · 78 comments
Closed

Missing Headers <OneSignal/OneSignal.h> (Cocoapods issue) #21

Nightsd01 opened this issue Sep 13, 2018 · 78 comments

Comments

@Nightsd01
Copy link
Contributor

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.

@Nightsd01
Copy link
Contributor Author

Created an issue with Cocoapods here: CocoaPods/CocoaPods#8090

@CharlesCleveJr
Copy link

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 by onesignal

@Nightsd01
Copy link
Contributor Author

@CharlesCleveJr Can you try running pod repo update?

@cspags
Copy link

cspags commented Sep 17, 2018

@CharlesCleveJr Can you try running pod repo update?

Thanks! This fixed the OneSignalDynamic (< 3.0, >= 2.8.8) for me.

@hayatae
Copy link

hayatae commented Sep 23, 2018

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:
flutter/flutter#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:
flutter/flutter#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> ^~~~~~~~~~~~~~~~~~~

@hayatae
Copy link

hayatae commented Sep 23, 2018

@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

@lubritto
Copy link

Any update?

@CharlesCleveJr
Copy link

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)

@CharlesCleveJr
Copy link

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?

@muarifer
Copy link

muarifer commented Oct 1, 2018

Any updates?

@muarifer
Copy link

muarifer commented Oct 2, 2018

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!"?

@CharlesCleveJr
Copy link

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?

@rlee1990
Copy link

rlee1990 commented Oct 9, 2018

@Nightsd01 any updates on this?

@anderscheow
Copy link

Try to comment "use_frameworks!"

@muarifer
Copy link

muarifer commented Oct 9, 2018

Try to comment "use_frameworks!"

By then, Other plugins didn't work.

@rostopira
Copy link

@Nightsd01 Any updates?

@rlee1990
Copy link

@Nightsd01 any update this is critical

@Nightsd01
Copy link
Contributor Author

Nightsd01 commented Oct 11, 2018

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

@rlee1990
Copy link

@Nightsd01 that is not an option firebase alone requires use_frameworks

@rostopira
Copy link

@rlee1990 firebase does not requires it, I use firebase auth and database currently without any issues

@rlee1990
Copy link

@rostopira it does if you used swift when creating the project and other packages use swift and it can cause issues

@Nightsd01
Copy link
Contributor Author

@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.

@muarifer
Copy link

I ended up and use firebase_messaging package.

@rlee1990
Copy link

@muarifer thats what i was using but their is not a way of handling foreground messages in ios the way it should be

@GustavoDMS
Copy link

any updates?

@andreidiaconu
Copy link

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!.

@anderscheow
Copy link

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

@rlee1990
Copy link

rlee1990 commented Nov 2, 2018

@anderscheow I just tested this and it does not work still get the same error.
@Nightsd01 are there any updates?

@westlinkin
Copy link

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.

@rgomezp
Copy link
Contributor

rgomezp commented Jun 21, 2019

@westlinkin ,
We will be releasing a fix sometime in the next two weeks! Thank you so much for your patience.

@leonardohklaus
Copy link

News for this? I need this feature for iOS push notifications :(

@dukaric1991
Copy link

Any news on this bug? We also need this for iOS notifications :)

@muhammad369
Copy link

the "next two weeks" passed
we are waiting.....

@westlinkin
Copy link

Switching to FCM

@rgomezp
Copy link
Contributor

rgomezp commented Jul 8, 2019

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!

@os20
Copy link

os20 commented Jul 12, 2019

Hello,

can anyone estimate when there will be a version of the Flutter Plugin?

@chrispypatt
Copy link

In the meantime, please use the workaround offered by jmrobles. Thanks!

Any update? I tried the workaround mentioned but was still getting some issues.

@rgomezp
Copy link
Contributor

rgomezp commented Jul 18, 2019

@chrispratt
I'm sorry to hear this. Can you include some details regarding your issues?

@rdgoutiyama
Copy link

Same error..

fatal error: 'OneSignal/OneSignal.h' file not found
using

onesignalflutter:
git: git://github.com/jmrobles/OneSignal-Flutter-SDK.git

Anyone?

@leonardohklaus
Copy link

I have the same error that @rdgoutiyama when using the workaround :(

@jkasten2
Copy link
Member

jkasten2 commented Jul 23, 2019

@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

@chrispypatt
Copy link

@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

@dukaric1991
Copy link

dukaric1991 commented Jul 23, 2019

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

Capture

@jkasten2
Copy link
Member

@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.

@jkasten2
Copy link
Member

@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?

@dukaric1991
Copy link

@jkasten2

android\build.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\app\build.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
Copy link

@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-L70

I noticed you have use_frameworks! in the OneSignalNotificationServiceExtension target 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.

@chrispypatt
Copy link

@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!

@jkasten2
Copy link
Member

@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.

@OneSignal OneSignal locked as resolved and limited conversation to collaborators Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests