Skip to content
koji ishii edited this page Nov 6, 2019 · 11 revisions

Trouble Shooting

ios

Your AppDelegate is the case of Objective-C

If you did not select swift in Platform channel language, you will see one of the following errors.

=== BUILD TARGET image_downloader OF PROJECT Pods WITH CONFIGURATION Debug ===
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 3.0, 4.0, 4.2. This setting can be set in the build settings editor.
=== BUILD TARGET image_downloader OF PROJECT Pods WITH CONFIGURATION Debug ===
~/.pub-cache/hosted/pub.dartlang.org/image_downloader-0.11.2/ios/Classes/ImageDownloaderPlugin.m:2:9: fatal error: 'image_downloader/image_downloader-Swift.h' file not found
#import <image_downloader/image_downloader-Swift.h>
[!] Unable to determine Swift version for the following pods:

- `image_downloader` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

This problem is on the flutter side, so all plugins created with swift have the same problem. https://github.com/flutter/flutter/issues/25676#issuecomment-449543241

You need to make some settings to solve this.

  1. Bridging Header must be created.
    Open the project with XCode.
    Then choose File -> New -> File -> Swift File on Runner holder.
    Create the swift file(), then also create Bridging Header, click it on a dialog.

This will set SWIFT_VERSION, SWIFT_OBJC_BRIDGING_HEADER and so on in XCode -> Build Settings.

  1. Make sure you have use_frameworks! in the Runner block, in ios/Podfile.
target 'Runner' do
  use_frameworks!

Basically this is just OK, but if it doesn't work it's better to do the following

  1. Execute flutter clean
  2. Go to your ios folder, delete Podfile.lock and Pods folder and then execute pod install --repo-update

I made a working sample so please refer to it. https://github.com/ko2ic/sample_image_downloder_objc

'image_downloader/image_downloader-Swift.h' file not found, though AppDelegate is Swift

Probably commented out use_frameworks!.
Please don't do that.

If you have to comment out, most of the library lacks support. For Example, flutter_twitter_login.
In this case, it is better to use here because there is Pull Request .

If there is an application that is not supported, let's put out a Pull Requet.

In case of BUILD FAILED with Simulator deployment target is set to 7.0 warning

What to do if you get the following error:

Launching lib / main.dart on iPhone Xʀ in debug mode ...
Running pod install ...
Running Xcode build ...
Xcode build done. 19.6s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    warning: The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.4.99. (in target 'Flutter')
    1 error generated.
    note: Using new build systemnote: Planning buildnote: Constructing build description

Please add use_frameworks! in Podfile.
It is usually written, but it may not be for some reason.

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."

This happens when url is http.
It is the specification that is App Transport Security policy(ATS) of ios.

Please refer to here.

Android

compileSdkVersion is old

Most of the questions on Android are for older versions.

For example, I get the following error

error: resource android:attr/fontVariationSettings not found. 
error: resource android:attr/ttcIndex not found.

Please update your app's version on build.gradle.

Use a library that does not use AndroidX

Please use v.0.9.2.

Compilation error in Kotlin (random)

For example, I get the following error

...
android/src/main/kotlin/com/ko2ic/imagedownloader/ImageDownloaderPlugin.kt: (354, 41): Unresolved reference: random

This is due to the low Kotlin version(ext.kotlin_version) of your app. Please refer to the following.

https://github.com/ko2ic/image_downloader/blob/master/example/android/build.gradle