flutter ビルドできないときに確認すること

Android Studioでflutterアプリを実機にインストールできないときの備忘録

xcodeのSigning Teamが選択されていない

・現象
iOSの実機にインストールできない

エラー

2019-10-17 13:16:41.773 ios-deploy[39315:228336] [ !! ] Error 0xe80000be: This application's application-identifier entitlement does not match that of the installed application. These values must match for an upgrade to be allowed. AMDeviceSecureInstallApplication(0, device, url, options, install_callback, 0)
Could not install build/ios/iphoneos/Runner.app on 53d01d7b3b0eb6a24f2adb9d9f99c212573a7d16.
Try launching Xcode and selecting "Product > Run" to fix the problem:
  open ios/Runner.xcworkspace

Error launching application on xxxxxのiPhone.

・解決策
xcodeの「Signing & Capabilities」より「Team」を選択する

flutter が違う証明書を使用している

・現象
xcodeから直接ビルドはできるが、AndroidStudioからビルドできない

エラー

Error output from Xcode build:
↳
    2019-10-17 13:21:23.638 xcodebuild[40625:235490]  DVTProvisioningProfileManager: Failed to load profile "/Users/xxxxx/Library/MobileDevice/Provisioning Profiles/xxxxx.mobileprovision" (Error Domain=DVTProvisioningProfileProviderErrorDomain Code=1 "Failed to load profile." UserInfo={NSLocalizedDescription=Failed to load profile., NSLocalizedRecoverySuggestion=Profile is missing the required UUID property.})
    2019-10-17 13:21:29.655 xcodebuild[40625:235483]  DVTPortal: Service '<DVTPortalAppIDService: 0x7f9fc2ef4680; action='addAppId'>' encountered an unexpected result code from the portal ('9401')
    2019-10-17 13:21:29.655 xcodebuild[40625:235483]  DVTPortal: Error:
    Error Domain=DVTPortalServiceErrorDomain Code=9401 "An App ID with Identifier 'xxx.yyy.zzz' is not available. Please enter a different string." UserInfo={payload=<CFBasicHash 0x7f9fc2ef5260 [0x7fff9505d8e0]>{type = mutable dict, count = 10,
    entries =>
    	0 : <CFString 0x7f9fc2ef5f70 [0x7fff9505d8e0]>{contents = "requestId"} = <CFString 0x7f9fc2ef53f0 [0x7fff9505d8e0]>{contents = "C94C1E95-4601-46B6-919C-09E769FAA274"}
    	1 : responseId = <CFString 0x7f9fc2ef5670 [0x7fff9505d8e0]>{contents = "c0e66a1e-a862-4052-9988-5a8c0c8d2165"}
    	2 : <CFString 0x7fff950ba5b8 [0x7fff9505d8e0]>{contents = "protocolVersion"} = QH65B2
    	3 : <CFString 0x7f9fc2ef5550 [0x7fff9505d8e0]>{contents = "requestUrl"} = <CFString 0x7f9fc2ef5590 [0x7fff9505d8e0]>{contents = "https://developerservices2.apple.com/services/QH65B2/ios/addAppId.action"}
    	6 : <CFString 0x7f9fc2ef54f0 [0x7fff9505d8e0]>{contents = "userLocale"} = en_US
    	8 : resultCode = <CFNumber 0x160cc8f9a965e017 [0x7fff9505d8e0]>{value = +9401, type = kCFNumberSInt64Type}
    	9 : userString = <CFString 0x7f9fc2ef3d80 [0x7fff9505d8e0]>{contents = "An App ID with Identifier 'xxx.yyy.zzz' is not available. Please enter a different string."}
    	10 : <CFString 0x7f9fc2ef2a80 [0x7fff9505d8e0]>{contents = "resultString"} = <CFString 0x7f9fc2ef3d80 [0x7fff9505d8e0]>{contents = "An App ID with Identifier 'xxx.yyy.zzz' is not available. Please enter a different string."}
    	11 : httpCode = <CFNumber 0x160cc8f9a9419117 [0x7fff9505d8e0]>{value = +200, type = kCFNumberSInt64Type}
    	12 : <CFString 0x7f9fc2ef5eb0 [0x7fff9505d8e0]>{contents = "creationTimestamp"} = <CFString 0x7f9fc2ef5f10 [0x7fff9505d8e0]>{contents = "2019-10-17T04:21:29Z"}
    }
    , NSLocalizedDescription=An App ID with Identifier 'xxx.yyy.zzz' is not available. Please enter a different string.}
    ** BUILD FAILED **


Xcode's output:
↳
    note: Using new build systemnote: Planning buildnote: Constructing build descriptionerror: Failed to register bundle identifier. The app identifier "xxx.yyy.zzz" cannot be registered to your development team. Change your bundle identifier to a unique string to try again. (in target 'Runner' from project 'Runner')error: Provisioning profile "iOS Team Provisioning Profile: *" doesn't support the Associated Domains and Push Notifications capability. (in target 'Runner' from project 'Runner')error: Provisioning profile "iOS Team Provisioning Profile: *" doesn't include the aps-environment and com.apple.developer.associated-domains entitlements. (in target 'Runner' from project 'Runner')warning: The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target. (in target 'Runner' from project 'Runner')

Could not build the precompiled application for the device.

Error launching application on xxxxxのiPhone.

・解決策
flutter run コマンドで証明書が選択できる

$ flutter run -t lib/main.dart

Launching lib/main.dart on xxxxxのiPhone in debug mode...
Multiple valid development certificates available (your choice will be saved):
  1) iPhone Developer: xxxxx (xxxxx)
  2) iPhone Developer: xxxxx (xxxxx)
  3) iPhone Developer: xxxxx (xxxxx)
  a) Abort
Please select a certificate for code signing [1|2|3|a]: 

設定されている証明書を変更したい場合は1度クリアしてからflutter runする

$ flutter config --clear-ios-signing-cert

AndroidStudioのRunボタンが押せない

・現象
Runボタン(右向三角の再生ぽいやつ)が押せない
Run/Debug Configurationsが設定されていないから

・ここで設定
f:id:yoppy0066:20191018120225p:plain

Dart Endpointを設定
f:id:yoppy0066:20191018120246p:plain

以上です