플러터 앱 - 안드로이드 쪽 자동배포를 해봤는데, 이번에는 iOS 쪽도 해본다.

testFlight 로 업로드 하는 코드.

# IPA 파일 생성
flutter build ipa --release --export-options-plist=ios/exportOptions.plist

# TestFlight에 업로드 
xcrun altool --upload-app --type ios \
 --file build/ios/ipa/*.ipa \
 --username "{your-apple-develper-id}" \
 --password "{your-app-password}" \
 --primary-bundle-id "{your-app-bundle-id}"

코드 자체는 심플하다. 관련 인증 부분이 좀 어려울 수 있다.

일단 앱 암호는 https://appleid.apple.com/account/manage 애플 계정쪽에서 설정한다.

그외 다른 인증 방식으로 몇가지 시도해봤는데, 유일하게 위 방법만 동작하였다.
( --apiKey --apiIssuer 방법 , --upload-package 방법 , xcrun notarytool 방법 => 모두 실패 )
위 다른 방식들이 좀더 안전(?)한 방법인 듯 해서 시도해봤었는데, 실패.

 

다음 부분에서도 좀 헤맸다.

# cat ios/exportOptions.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>destination</key>
    <string>export</string>
    <key>method</key>
    <string>app-store</string>
    <key>teamID</key>
    <string>{your-developer-team-ID}</string>
    <key>teamName</key>
    <string>{your-developer-team-Name}</string>
    <key>provisioningProfiles</key>
    <dict>
        <key>{your-app-bundle-id}</key>
        <string>{your-project-provisioning-profile}</string>
    </dict>
    <key>signingCertificate</key>
    <string>Apple Distribution</string>
    <key>signingStyle</key>
    <string>manual</string>
    <key>stripSwiftSymbols</key>
    <true/>
    <key>uploadBitcode</key>
    <false/>
    <key>uploadSymbols</key>
    <true/>
</dict>
</plist>

위 입력사항 중 2개 teamName / bundle id 는 금방 찾았고 , 그외 2가지 항목을 찾아야 한다.

teamID / provisioning profile 은 어디?

open ios/Runner.xcworkspace 
# 플러터 프로젝트를 Xcode 를 열어본다.

Runner 쪽을 보면 Signing 부분에 있다. ( 지금 살펴보니, 모든 항목이 다 여기에 있다. )

내 경우는 계정소유자가 아니라 (앱 관리자? )권한으로 참여하는 것이라 Signing Certificate 쪽 설정하는데 고생을 좀 했다.

위 설정까지 문제없이 했다면, 맨 위 코드로 빌드 => 배포 가 정상적으로 될 것이다.

 

반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

플러터 를 안드로이드 로 개발중인데 - 새버전이 나와서 업그레이드 하였다.

에러가 생길 것은 예상은 했다. 빌드해보니.

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> A problem occurred starting process 'command '/..../flutter/bin/flutter''

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
Error: Gradle task assembleDebug failed with exit code 1
Error executing devicectl: ProcessException: Process exited abnormally with exit code 3:

User cancelled
  Command: /usr/bin/arch -arm64e xcrun devicectl list devices --timeout 5 --json-output /var/folders/d7/4qd968hd0kzc21y8jggx2qcr0000gn/T/flutter_tools.w7hJCy/core_devices.D5JYTk/core_device_list.json
Error executing devicectl: ProcessException: Process exited abnormally with exit code 3:

User cancelled
  Command: /usr/bin/arch -arm64e xcrun devicectl list devices --timeout 5 --json-output /var/folders/d7/4qd968hd0kzc21y8jggx2qcr0000gn/T/flutter_tools.w7hJCy/core_devices.AHDMpc/core_device_list.json

다음과 같은 에러가 발생하였다.

flutter doctor 해봐도 특별한 이상은 안 보였다.

 


iOS 쪽을 시도 해봤다.

# xcodebuild -downloadPlatform iOS

Downloading iOS 17.5 Simulator (21F79): 83.1% (6.09 GB of 7.34 GB)2024-05-27 00:10:48.511 xcodebuild[38139:36929395]  DVTDownloadable: Download Failed. Downloadable: https://download.developer.apple.com/Developer_Tools/iOS_17.5_Simulator_Runtime/iOS_17.5_Simulator_Runtime.dmg. Error Domain=NSPOSIXErrorDomain Code=28 "No space left on device" UserInfo={NSErrorFailingURLStringKey=https://download.developer.apple.com/Developer_Tools/iOS_17.5_Simulator_Runtime/iOS_17.5_Simulator_Runtime.dmg, NSErrorFailingURLKey=https://download.developer.apple.com/Developer_Tools/iOS_17.5_Simulator_Runtime/iOS_17.5_Simulator_Runtime.dmg, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDownloadTask <D677E7D4-290F-4ABB-AE5D-98AAF40F70BC>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDownloadTask <D677E7D4-290F-4ABB-AE5D-98AAF40F70BC>.<1>}
Downloading iOS 17.5 Simulator (21F79): Error: Error Domain=NSPOSIXErrorDomain Code=28 "No space left on device" UserInfo={NSErrorFailingURLStringKey=https://download.developer.apple.com/Developer_Tools/iOS_17.5_Simulator_Runtime/iOS_17.5_Simulator_Runtime.dmg, NSErrorFailingURLKey=https://download.developer.apple.com/Developer_Tools/iOS_17.5_Simulator_Runtime/iOS_17.5_Simulator_Runtime.dmg, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDownloadTask <D677E7D4-290F-4ABB-AE5D-98AAF40F70BC>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDownloadTask <D677E7D4-290F-4ABB-AE5D-98AAF40F70BC>.<1>}

여기도 에러.

하드 공간이 없다.  오랜만에 봤더니, 6기가 정도 밖에 안 남았네. ㅜㅜ

용량이 부족하다. 조금 정리하고 다시 시도..

Registering simulator runtime with CoreSimulator failed.
Domain: DVTDownloadableErrorDomain
Code: 29
User Info: {
    DVTErrorCreationDateKey = "2024-05-26 15:36:28 +0000";
}
--
Registering simulator runtime with CoreSimulator failed.
Domain: DVTDownloadableErrorDomain
Code: 29
--
Cannot copy the image because the disk is almost full
Domain: com.apple.CoreSimulator.simdiskimaged.SimDiskImageError
Code: 14
--


System Information

macOS Version 14.4.1 (Build 23E224)
Xcode 15.4 (22622) (Build 15F31d)
Timestamp: 2024-05-27T00:36:28+09:00

더 줄여야 겠다.

하드 좀 정리하고, 다시 해보니 정상 다운로드 되었다.
그리고, 안드로이드 스튜디오에서 다시 빌드 해보니 정상 동작 했다.

이제 안드로이드 쪽 빌드를 해결해보자.(즉, iOS 쪽은 정상)

android / gradle 빌드 쪽 이슈로 좁혀졌다.


[다시 시도]

flutter upgrade --force 로 플러터 SDK 를 업그레이드 해봤다.

* What went wrong:
Execution failed for task ':gradle:compileGroovy'.
> Failed to run Gradle Worker Daemon
   > A problem occurred starting process 'Gradle Worker Daemon 1'

에러가 나지만, 메시지가 달라졌다.

android/ 에서 gradle 을 콘솔에서 명령을 내려봤다.

# ./gradlew app:installDebug

FAILURE: Build failed with an exception.

* Where:
Build file '.../android/app/build.gradle' line: 2


What went wrong:
An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
   > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
      Your current JDK is located in /Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/jre
      You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 24s
4 actionable tasks: 2 executed, 2 up-to-date

다른 프로젝트에서 1.8 오래된 버전이 필요해서 바꿨었는데, 그것이 영향을 준것 같다.
근데, 안드로이드 스튜디오 젤리피시 버전업 하기까지는 이상이 없었는데..??

android/gradle.properties
파일에 JAVA_HOME 패스를 넣었다.(.bash_profile 등에 넣어도 된다.)

org.gradle.java.home=/Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home/

 

다시 빌드...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':connectivity_plus:compileDebugJavaWithJavac'.
> error: invalid source release: 17

 

이거 점점 미궁으로 가는거 아닌가? ㅜㅜ

java 버전 17 으로 맞춰준다.

# brew install openjdk@17

sudo ln -s  /opt/homebrew/Cellar/openjdk\@17/17.0.11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk

gradle.properties 나 IDE 세팅등에 버전을 맞춘다.

org.gradle.java.home=/Library/Java/JavaVirtualMachines/openjdk-17.jdk/Contents/Home/

 

일단 여기까지 해보니, 정상 빌드 된다.

반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

예전 공부(?)하다가 중단했었는데, 다시 시도 해보려 한다.
이슈가 생기면 처음부터 정리하면서 진행하고자 한다.

flutter doctor 를 한후 다음과 같은 메시지

[!] Xcode - develop for iOS and macOS (Xcode 15.2)
    ✗ Unable to get list of installed Simulator runtimes.
    
..
..
! Doctor found issues in 1 category.

Xcode 의 시뮬레이터를 설치해준다.

xcodebuild -downloadPlatform iOS

 

다시 flutter doctor 를 해보면 정상적으로 나올 것이다.

 

[추가 - 결론 - 아래 효과 없음 - 맥 재부팅 하니, 정상 동작]

다시 저런현상이 발생했는데, 위 명령으로 해도 안된다. 시뮬레이터 리스트에 아무것도 안보인다.

혹시나 해서 다른 조치를 해봤다. (시스템 설정 => 저장공간 => 개발자 )

Xcode 캐시를 삭제 해봤다.

그래도 안된다.

반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

간만에 노트북에서 git 프로젝트를 실행하려고 보니 다음과 같은 에러가 발생한다.

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), 
missing xcrun at: ...

그동안 데스크탑(맥미니)에서 하다보니, 노트북 설정이 꼬였나 했다.

검색해보니 xcode 관련 이슈인 듯 하다.

일단 xcode 를 업그레이드 한다.

xcode-select --install

... 느리네.

OO minutes later ..

완료된 후 다시 시도하면 OK

반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,