顯示具有 📱Android 標籤的文章。 顯示所有文章
顯示具有 📱Android 標籤的文章。 顯示所有文章

2025-09-04

紀錄一下自己接手一個 android app 時遇到的問題

我接手一個 android app,他有使用一個 lib:PageIndicatorview

dependencies {
        implementation 'com.romandanylyk:pageindicatorview:1.0.2'
}

執行 gradlew.bat assembleDebug --warning-mode all 後,會回復以下 2 個錯誤訊息

The RepositoryHandler.jcenter() method has been deprecated. This is scheduled to be removed in Gradle 9.0. JFrog announced JCenter's sunset in February 2021. Use mavenCentral() instead. Consult the upgrading guide for further information: https://docs.gradle.org/8.10.2/userguide/upgrading_version_6.html#jcenter_deprecation
        at build_c0uup8fmroz422c6id7ruwe51$_run_closure1$_closure2.doCall$original(D:\workspace\app\build.gradle:4)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
        at build_c0uup8fmroz422c6id7ruwe51$_run_closure1.doCall$original(D:\workspace\app\build.gradle:2)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
WARNING: The option setting 'android.defaults.buildfeatures.buildconfig=true' is deprecated.
The current default is 'false'.
It will be removed in version 9.0 of the Android Gradle plugin.
To keep using this feature, add the following to your module-level build.gradle files:
    android.buildFeatures.buildConfig = true
or from Android Studio, click: `Refactor` > `Migrate BuildConfig to Gradle Build Files`.
> Task :app:checkDebugAarMetadata FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.romandanylyk:pageindicatorview:1.0.2.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/github/romandanylyk/PageIndicatorView/v1.0.2/PageIndicatorView-v1.0.2.pom
       - https://repo.maven.apache.org/maven2/com/github/romandanylyk/PageIndicatorView/v1.0.2/PageIndicatorView-v1.0.2.pom
       - https://jitpack.io/com/github/romandanylyk/PageIndicatorView/v1.0.2/PageIndicatorView-v1.0.2.pom
     Required by:
         project :app

2025-06-04

使用指令編譯 Android

紀錄一下如何純粹使用終端機指令,編譯 android APK

事前準備

  1. Java,儘量使用最新版的 Java
  2. Android SDK
    • 如果已經安裝 Android Studio,那就不用另外安裝
    • 如果不想安裝 Android Studio,那可以到Android Studio 下載頁下方的《僅限指令列工具》那可以下載。但使用這方法,要另行設 ANDROID_HOME 的環境變數
    • 如果是用 CI/CD, Github Action 已經有人寫好了:android-actions/setup-android
    • 使用 Docker ,可以使用thyrlian/android-sdk