※ 2022/8/25 から、 Windows Insider Program
への参加は不要になったようだ
スタート -> 設定 -> Windows Update ->
Windows Insider Program
使用を開始する ボタン押下
ウィザードに従って情報入力
アカウントと紐づけ
Microsoft アカウントに紐づけ
Insider チャネルを選択
ベータ チャネル を選択
WSA はDev またはベータで使える
デバイスの契約をレビューする
利用規約とプライバシーステートメントを読む
このデバイスを再起動して作業を完了します
今すぐ再起動 を押下
Amazon
アプリストアをインストール
スタート -> Microsoft Store ->
Amazon アプリストア で検索し、
Amazon アプリストア を選択し、インストール。
開発者モードをオン
adb コマンドで WSA
に接続できるようにするため、開発者モードをオンにする。
スタート -> Android™用 Windows サブシステム設定
を実行
開発者 -> 開発者モード
をオンにする
Yukari for Android
のインストール
adb で WSA に接続
adb は、Android Studio をインストールしていれば
~/AppData/Local/Android/Sdk/platform-tools
に入っているはず。
WSA が起動していないと、 adb で接続できないので、
Android™用 Windows サブシステム設定
を起動しておくこと。
Android™用 Windows サブシステム設定
を起動したうえで、以下コマンドで接続。
> C:\Users\mikoto\AppData\Local\Android\Sdk\platform-tools\adb.exe connect 127.0.0.1:58526* daemon not running;starting now at tcp:5037* daemon started successfullyfailed to authenticate to 127.0.0.1:58526
> ./gradlew build...(snip)FAILURE: Build failed with an exception.* What went wrong:A problem occurred configuring project ':gl-helpers'.> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at 'C:\Users\mikoto\project\Yukari\local.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.orgBUILD FAILED in 1m 22s
>$Env:ANDROID_SDK_ROOT="C:\\Users\\mikoto\\AppData\\Local\\Android\\Sdk"> ./gradlew build...(snip)> Task :twpfparser:test FAILEDinfo.shibafu528.twpfparser.TwiProfileImplTest> testGetTweetPerDay FAILEDjava.lang.AssertionError at TwiProfileImplTest.java:168info.shibafu528.twpfparser.TwiProfileImplTest> testGetElapsed FAILEDjava.lang.NumberFormatException at TwiProfileImplTest.java:173info.shibafu528.twpfparser.TwiProfileImplTest> testGetFavoritesCount FAILEDjava.lang.NullPointerException at TwiProfileImplTest.java:15229 tests completed, 3 failed> Task :Yukari:preAlphaDebugBuild FAILEDFAILURE: Build completed with 2 failures.1: Task failed with an exception.
テスト失敗。とりあえずテスト無視してみようか。
テストをスキップしてビルド
> ./gradlew build-x test...(snip)> Task :gl-helpers:lintRan lint on variant debug: 1 issues foundRan lint on variant release: 1 issues foundWrote HTML report to file:///C:/Users/mikoto/project/Yukari/gl-helpers/build/reports/lint-results.htmlWrote XML report to file:///C:/Users/mikoto/project/Yukari/gl-helpers/build/reports/lint-results.xml> Task :Yukari:preAlphaDebugBuild FAILEDFAILURE: Build failed with an exception....(snip)
lint でもエラーになるっぽい。これも無視。
lint をスキップしてビルド
> ./gradlew build-x test -x lint...(snip)Errors found:C:\Users\mikoto\project\Yukari\gl-helpers\build.gradle:9: Error: Google Play requires that apps target API level 26 or higher.[ExpiredTargetSdkVersion]targetSdkVersion 19...(snip)
> ./gradlew build-x test -x lint...(snip)FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':Yukari:preAlphaDebugBuild'.> Could not resolve all files for configuration ':Yukari:alphaDebugCompileClasspath'.> Could not find info.shibafu528.yukari:yukari-exvoice:20210923.011845.Required by:project :Yukari...(snip)
> ./gradlew build-x test -x lint...(snip)NDK is missing a "platforms" directory.If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\mikoto\AppData\Local\Android\Sdk\ndk-bundle.If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.FAILURE: Build failed with an exception.* What went wrong:A problem occurred configuring project ':yukari-exvoice'.> java.lang.NullPointerException (no error message)...(snip)
oh… java.lang.NullPointerException (no error
message)。
cd yukari-exvoicedocker build -t mikoto2000/y4a-buildkit .
…これ Yukari 自体のビルドもこのコンテナでやっちゃえるのでは???
後で試す。
> docker run-it--rm--mount type=bind,source=$(pwd),target=/work --mount type=bind,source=$HOME/.gradle,target=/root/.gradle --workdir /work mikoto2000/y4a-buildkit ./gradlew build...(snip)FAILURE: Build failed with an exception.* What went wrong:Could not create service of type FileHasher using GradleUserHomeScopeServices.createCachingFileHasher().> java.io.IOException: Input/output error...(snip)
# apt-get install -y autoconf# ./gradlew buildconfigure.ac:56: error: possibly undefined macro: AC_PROG_LIBTOOLIf this token and others are legitimate, please use m4_pattern_allow.See the Autoconf documentation.autoreconf: /usr/bin/autoconf failed with exit status: 1
libtool をインストールして再挑戦。
apt-get install -y libtool./gradlew build
ログとりわすれたが成功した。
Windows に戻ってビルド再挑戦
Docker コンテナでビルドしたビルド成果物を、 Windows のローカル Maven
リポジトリへパブリッシュする。
> ./gradlew publishToMavenLocalFAILURE: Build failed with an exception.* What went wrong:A problem occurred configuring project ':yukari-exvoice'.> java.lang.NullPointerException (no error message)
うーん?
コンテナに戻って publishToMavenLocal を試す。
# ./gradlew publishToMavenLocalConfiguration(s)specified but the install task does not exist in project :.BUILD SUCCESSFUL in 1s2 actionable tasks: 2 executed
成功してしまった…。
こっちの成果物を Windows 側にコピーするか。
Windows 側で docker cp を実行。
> docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESde2371b0e6d5 mikoto2000/y4a-buildkit "bash" 56 minutes ago Up 56 minutes elegant_merkle> docker cp de2371b0e6d5:/root/.m2/repository/info/shibafu528 ${HOME}/.m2/repository/info/shibafu528
> cd Yukari> ls ${HOME}/.m2/repository/info/shibafu528/yukari/yukari-exvoice>$EXVOICE_VERSION=$(ls${HOME}/.m2/repository/info/shibafu528/yukari/yukari-exvoice)[0].Name> sed.exe -i-e"s/20210923.011845/${EXVOICE_VERSION}/g" build.gradle> cd ..> ./gradlew build-x test -x lint...(snip)FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':Yukari:preAlphaDebugBuild'.> Could not resolve all files for configuration ':Yukari:alphaDebugCompileClasspath'.> Could not find info.shibafu528.yukari:yukari-exvoice:20220119.054547.Required by:project :Yukari...(snip)