実現したいこと
ローカルで動いているプロジェクトを、GithubActions上でもビルドができるようにすること
発生している問題・分からないこと
初めてGithubActionsでCIをしようと思い、Androidプロジェクトで開発を進めながらCIの導入をしてみました。Androidプロジェクトで実装している下記の2行の依存関係が解決できないと言われています。その2行はGradleに依存関係を追加しないと使えないもの(1つ目のコードの下に記述)で、ローカルではその依存関係を追加していますが、GithubActions上ではそれらが解決できないみたいです。ymlファイルを初めて書いたので、エラーの内容も完全に理解できていません。エラーメッセージの内容はLintでのエラーになっていますが、Lintチェックを行わなくてもビルドでエラーになります。
kotlin
1import androidx.compose.material.icons.filled.AccessTime 2import androidx.compose.material.icons.filled.EditCalendar
kotln
1dependencies { 2 implementation(libs.androidx.material.icons.extended) 3}
エラーメッセージ
error
1Run ./gradlew lint 2Downloading https://services.gradle.org/distributions/gradle-8.7-bin.zip 3............10%.............20%.............30%.............40%............50%.............60%.............70%.............80%.............90%............100% 4Welcome to Gradle 8.7! 5Here are the highlights of this release: 6 - Compiling and testing with Java 22 7 - Cacheable Groovy script compilation 8 - New methods in lazy collection properties 9For more details see https://docs.gradle.org/8.7/release-notes.html 10Starting a Gradle Daemon (subsequent builds will be faster) 11Checking the license for package Android SDK Platform-Tools in /usr/local/lib/android/sdk/licenses 12License for package Android SDK Platform-Tools accepted. 13Preparing "Install Android SDK Platform-Tools v.35.0.2". 14"Install Android SDK Platform-Tools v.35.0.2" ready. 15Installing Android SDK Platform-Tools in /usr/local/lib/android/sdk/platform-tools 16"Install Android SDK Platform-Tools v.35.0.2" complete. 17"Install Android SDK Platform-Tools v.35.0.2" finished. 18> Task :app:preBuild UP-TO-DATE 19> Task :app:preDebugBuild UP-TO-DATE 20> Task :app:generateDebugResValues 21> Task :app:checkDebugAarMetadata 22> Task :app:mapDebugSourceSetPaths 23> Task :app:generateDebugResources 24> Task :app:packageDebugResources 25> Task :app:mergeDebugResources 26> Task :app:createDebugCompatibleScreenManifests 27> Task :app:extractDeepLinksDebug 28> Task :app:parseDebugLocalResources 29> Task :app:processDebugMainManifest 30> Task :app:processDebugManifest 31> Task :app:preDebugAndroidTestBuild SKIPPED 32> Task :app:generateDebugAndroidTestResValues 33> Task :app:javaPreCompileDebug 34> Task :app:extractProguardFiles 35> Task :app:preDebugUnitTestBuild UP-TO-DATE 36> Task :app:processDebugManifestForPackage 37> Task :app:processDebugResources 38> Task :app:compileDebugKotlin FAILED 39e: file:///home/runner/work/WeatherAlarm/WeatherAlarm/app/src/main/java/com/example/weatheralarm/ui/alarm/ToggleTimePicker.kt:14:47 Unresolved reference: AccessTime 40e: file:///home/runner/work/WeatherAlarm/WeatherAlarm/app/src/main/java/com/example/weatheralarm/ui/alarm/ToggleTimePicker.kt:15:47 Unresolved reference: EditCalendar 41e: file:///home/runner/work/WeatherAlarm/WeatherAlarm/app/src/main/java/com/example/weatheralarm/ui/alarm/ToggleTimePicker.kt:63:26 Unresolved reference: EditCalendar 42e: file:///home/runner/work/WeatherAlarm/WeatherAlarm/app/src/main/java/com/example/weatheralarm/ui/alarm/ToggleTimePicker.kt:65:26 Unresolved reference: AccessTime 43e: file:///home/runner/work/WeatherAlarm/WeatherAlarm/app/src/main/java/com/example/weatheralarm/ui/common/ExpandButton.kt:4:47 Unresolved reference: ExpandLess 44e: file:///home/runner/work/WeatherAlarm/WeatherAlarm/app/src/main/java/com/example/weatheralarm/ui/common/ExpandButton.kt:5:47 Unresolved reference: ExpandMore 45e: file:///home/runner/work/WeatherAlarm/WeatherAlarm/app/src/main/java/com/example/weatheralarm/ui/common/ExpandButton.kt:27:54 Unresolved reference: ExpandLess 46e: file:///home/runner/work/WeatherAlarm/WeatherAlarm/app/src/main/java/com/example/weatheralarm/ui/common/ExpandButton.kt:27:83 Unresolved reference: ExpandMore 47Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. 48You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. 49For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. 50FAILURE: Build failed with an exception. 51* What went wrong: 52Execution failed for task ':app:compileDebugKotlin'. 53> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction 5417 actionable tasks: 17 executed 55 > Compilation error. See log for more details 56* Try: 57> Run with --stacktrace option to get the stack trace. 58> Run with --info or --debug option to get more log output. 59> Run with --scan to get full insights. 60> Get more help at https://help.gradle.org. 61BUILD FAILED in 1m 15s 62Error: Process completed with exit code 1.
該当のソースコード
yml
1name: Android CI 2 3on: 4 push: 5 branches: 6 - feature/** 7 pull_request: 8 branches: 9 - develop 10jobs: 11 build: 12 runs-on: ubuntu-latest 13 14 steps: 15 - name: Check out the repository 16 uses: actions/checkout@v4 17 18 - name: Set up JDK 11 19 uses: actions/setup-java@v4 20 with: 21 distribution: 'temurin' 22 java-version: '22' 23 24 - name: Cache Gradle packages 25 uses: actions/cache@v4 26 with: 27 path: | 28 ~/.gradle/caches 29 ~/.gradle/wrapper 30 key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}-v4 31 restore-keys: ${{ runner.os }}-gradle- 32 33 - name: Lint check 34 run: ./gradlew lint 35 36 - name: Build 37 run: ./gradlew assemble 38
試したこと・調べたこと
- teratailやGoogle等で検索した
- ソースコードを自分なりに変更した
- 知人に聞いた
- その他
上記の詳細・結果
javaバージョンは22でないとGradleの別のエラーが出る
補足
特になし
あなたの回答
tips
プレビュー