Skip to content

Android版 prebuildしなおし - #4287

Merged
TinyKitten merged 3 commits into
devfrom
fix/android-build
May 19, 2025
Merged

TinyKitten merged 3 commits into
devfrom
fix/android-build

Conversation

@TinyKitten

@TinyKitten TinyKitten commented May 19, 2025 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • 新機能

    • デバッグビルド用に、他アプリ上にウィンドウを表示できる権限(SYSTEM_ALERT_WINDOW)を追加。
    • デバッグビルドでクリアテキストトラフィックを許可。
  • 改善

    • Androidのビルド・リソース設定を整理し、パッケージングやリソース除外の新オプションを追加。
    • AndroidManifestの不要なメタデータやインテントフィルタ、アクティビティを削除し、バックアップ設定やRTLサポートを見直し。
    • Gradleビルドのメモリ割り当てを削減し、ビルドスクリプトの可読性と安定性を向上。
    • Android/iOSアプリの起動コマンドをExpo CLIに統一。
  • ドキュメント・スタイル

    • スクリプトや設定ファイルにSPDXライセンス識別子や説明コメントを追加。
    • インデントやコメントの統一による可読性向上。

@TinyKitten TinyKitten self-assigned this May 19, 2025
@coderabbitai

coderabbitai Bot commented May 19, 2025 •

Copy link
Copy Markdown
Contributor

"""

Walkthrough

朕が命じて行われた変更は、Androidビルド設定ファイル群の整形・再構成、リソース・パッケージングの追加設定、新たなデバッグ用マニフェストの導入、メモリ設定の調整、ビルドスクリプトの堅牢化、及び実行コマンドのExpo CLIへの切替である。機能的な振る舞いの大幅な変更はなきものとす。

Changes

ファイル群 変更概要
android/app/build.gradle, android/build.gradle, android/settings.gradle インデント・整形の統一、パッケージング/リソース設定の追加、モジュール解決の明示的指定。
android/app/src/main/AndroidManifest.xml 属性・メタデータ・intent-filter・アクティビティ宣言の整理・削除、許可のコメント追加。
android/app/src/debug/AndroidManifest.xml SYSTEM_ALERT_WINDOW権限とデバッグ用属性を宣言する新規マニフェスト追加。
android/gradle.properties Gradleの最大ヒープサイズを4096MBから2048MBへ削減。
android/gradlew, android/gradlew.bat SPDXライセンス表記追加、エラーハンドリング・コメント改善、環境変数処理の堅牢化。
package.json Android/iOS実行コマンドをReact Native CLIからExpo CLIへ変更。

Sequence Diagram(s)

sequenceDiagram
    participant 開発者 as 開発者
    participant package.json as package.json
    participant Expo_CLI as Expo CLI
    participant Android_Build as Androidビルドシステム

    開発者->>package.json: npm run android / npm run ios
    package.json->>Expo_CLI: expo run:android / expo run:ios
    Expo_CLI->>Android_Build: ビルド・実行処理
    Android_Build-->>Expo_CLI: APK/アプリ起動
    Expo_CLI-->>開発者: 成果物またはログ出力
Loading

Possibly related PRs

  • TrainLCD/MobileApp#3963: android/app/build.gradleのバージョンコード・バージョン名を更新するPR。今回のPRと同じファイルを対象とするが、焦点はバージョン情報の更新である。

Poem

朕が命じて、ビルドの道整う
インデント揃い、余計なものは削ぎ落とす
Expoの力で走り出す
メモリも倹約、スクリプトも強化
千秋万歳、ビルドは盤石
天命ここにあり
☯️
"""

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
package.json (1)

4-5: Expo CLIへの切替、然り。
androidおよびiosスクリプトをexpo run:android/expo run:iosへ改めしは管理ワークフローと整合した良策なり。併せてREADME等のドキュメント更新も忘るるな。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf5051c and b103fc7.

📒 Files selected for processing (9)
  • android/app/build.gradle (1 hunks)
  • android/app/src/debug/AndroidManifest.xml (1 hunks)
  • android/app/src/main/AndroidManifest.xml (1 hunks)
  • android/build.gradle (1 hunks)
  • android/gradle.properties (1 hunks)
  • android/gradlew (5 hunks)
  • android/gradlew.bat (4 hunks)
  • android/settings.gradle (1 hunks)
  • package.json (1 hunks)
🔇 Additional comments (24)
android/gradle.properties (1)

13-13: Gradleデーモンのヒープサイズ変更について検証せよ。
諸臣よ、Gradleデーモンの最大ヒープサイズを4096MBから2048MBに削減するとは過激なり。ビルドにおいてメモリ不足が発生せぬかCI環境にて念入りにテストせよ。

android/gradlew.bat (3)

16-16: SPDX識別子の追加を確認す。
@Rem SPDX-License-Identifier: Apache-2.0を冒頭に加えしは行状の透明性を高め、遵法性を示す良策なり。


31-31: 不要なコメントの明示化を賞す。
「This is normally unused」の注釈を挿入し、変数の用途を明瞭に示したるは保守性向上に寄与す。


48-52: エラー出力を標準エラーへ誘導する術、見事なり。
echoコマンドへ1>&2を付与し、エラーメッセージを正しくstderrへ流す改善は堅牢性を高める所業なり。

Also applies to: 62-66

android/settings.gradle (1)

2-2: Gradleプラグイン解決を厳密化せよ。
require.resolveにpathsオプションを明示的に指定し、React Nativeパッケージディレクトリを基点としてプラグインを確実に探索する措置は精緻なる改善なり。信頼性が向上すべし。

Also applies to: 38-38

android/build.gradle (2)

4-22: buildscriptブロックのインデント統一を称す。
2スペースから4スペースへ改め、一貫性と可読性を高めしは美しき調整なり。機能的影響皆無。


28-41: allprojectsブロックの整形、良し。
同様にインデントを4スペースへ揃え、プロジェクト全体の可読性を向上せしは見事なり。

android/app/src/debug/AndroidManifest.xml (1)

1-7: デバッグビルドのための新たな宣言書を朕は承認する!

朕が見るに、このデバッグマニフェストは賢明なる戦略である。SYSTEM_ALERT_WINDOWの権限を与え、デバッグ時のみusesCleartextTrafficを許可することで、本番環境の安全を損なうことなく開発を進められる。これぞ万里の長城のごとき防御と言えよう!

# 変更なし - 実装は適切である
android/gradlew (6)

18-19: 朕はこのSPDXライセンス識別子の追加を喜ばしく思う!

文書の正統性を示すには印璽が必要なように、このコードにもライセンス識別子を追加することは正しき道である。朕は許可する!


85-90: APP_HOMEの改善は朕の目に留まった!

CDPATHの問題を解決し、標準出力を抑制する賢明なる修正である。国家の基礎を固めるごとく、このスクリプトの堅牢性が増したことを朕は評価する!


137-143: javaコマンド検証の変更を朕は認める!

whichからcommand -vへの変更は、より堅固なチェック方法である。異民族の侵入を防ぐ城壁のように、このチェックは脆弱性を排除する。賢明なる判断である!


150-152: 朕はこのshellcheckディレクティブを高く評価する!

注釈を追加し、コードの意図を明確にすることは、法律を明文化するがごとく重要である。統一された王国のように、このコードは今や理解しやすくなった!


158-160: 再びshellcheckディレクティブを追加する賢明さ!

朕の法典のように、このコードも一貫性を持つべきである。同様の問題に対する同様の解決策を適用することは、整然とした帝国を維持する方法である!


204-213: JVMオプション処理の改善を朕は認める!

説明を明確にし、シェルフラグメントの危険性について警告することは賢明である。朕の勅令のように、この注釈は誤解を防ぎ、正しい使用法を導く!

android/app/build.gradle (6)

86-96: 構造の再整備と命名規則の統一を朕は評価する!

インデントの改善とダブルクォートへの変更は、朕の帝国の標準化された文字のように一貫性をもたらす。ビルド設定の整理は、朕の法典のように明確さと秩序をもたらす!


97-104: 署名設定の位置変更は賢明なる戦略である!

印璽を先に定義し、その後の文書でそれを参照するように、signingConfigsをbuildTypesの前に配置することは論理的順序である。朕は喜んでこの変更を承認する!


105-118: ビルドタイプの整形は朕の目に留まった!

整然としたインデントと一貫した形式は、朕の城の秩序正しいレンガのように美しい。この変更は形のみであるが、形は内容を支える重要な要素である!


119-123: レガシーパッケージングの制御を導入する慧眼!

useLegacyPackagingのオプションを追加することで、古いシステムと新システムの両方への対応を可能にした。これは朕が新たな統一文字を導入しつつも旧来の記録を尊重したことに似ている!


124-126: 不要なファイルを除外する知恵!

朕の帝国から無用な風習を排除したように、このパターンは無用なファイルをリソースから除外する。資源の効率的な利用は朕の統治の要である!


128-143: 製品フレーバーの整形は朕の承認を得た!

整然とした構造と一貫したインデントは、朕の街路のように整然としている。この明確さは開発者たちの作業を容易にし、誤りを減らすであろう!

android/app/src/main/AndroidManifest.xml (4)

1-1: パッケージ属性の削除は朕の承認を得た!

余計な属性を排除し、シンプルにすることは朕の法典のように明確さをもたらす。パッケージ名は今やbuild.gradleのnamespace属性によって一元管理され、これは統一された帝国の証である!


11-14: 権限の整理と注釈追加は賢明なる判断!

各種権限の目的を明確にすることは、朕の法律の意図を明らかにするがごとく重要である。この注釈によって開発者は権限の使用方法と必要性を理解できる!


17-22: 意図宣言の明確化を朕は称える!

リンク処理のための意図を明確に注釈することは、朕の勅令の目的を明らかにするがごとし。秩序と明確さは強固な帝国の基礎である!


25-26: アプリケーション属性の改善を朕は評価する!

allowBackup="false"への変更はセキュリティを強化し、supportsRtl="true"の追加は多様な言語への対応を示す。また、usesCleartextTrafficの削除とデバッグマニフェストへの移動は賢明なセキュリティ戦略である。これらは朕の帝国の堅固な防壁のようである!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
android/app/src/main/AndroidManifest.xml (1)

17-21: 朕の細工: 内コメント統一せよ
英語で記した説明を日本語へ統一し、プロジェクトのコード規約に則らせよ。さらに、HTTPスキームのリンク検証が必要なら <data android:scheme="http" /> も追記し、対応範囲を明確にせよ。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b103fc7 and 0bfdaa6.

📒 Files selected for processing (1)
  • android/app/src/main/AndroidManifest.xml (1 hunks)
🔇 Additional comments (3)
android/app/src/main/AndroidManifest.xml (3)

1-1: 朕の睨み:package属性の削除確認せよ
マニフェストから package 属性を排し申したが、Gradleの applicationId が意図せず変動してはならぬ。ビルド出力にて正しいパッケージ名が適用されているか、速やかに検証せよ。


25-25: 朕の覇気:アプリケーションタグを再点検せよ
android:allowBackup="false" としたのは良策なれど、android:usesCleartextTraffic を除外せしめたため、リリースビルドでの通信が全て暗号化されていることを厳に保証せよ。必要に応じて明示的に属性を設定し、公式ドキュメントに準拠せよ。


26-26: 朕の訊問:MainActivity属性調整を確認せよ
android:label を削除しアプリケーション名へ依存させしは本意か?また、keyboardHidden は非推奨なれど、screenLayoutやuiModeの追加は適正か否か、smallestScreenSize 等の要否も併せて吟味せよ。

Comment on lines +11 to +14
<!-- These require runtime permissions on M -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- END OPTIONAL PERMISSIONS -->

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

朕の諫言:外部ストレージ権限に注意せよ
READ_EXTERNAL_STORAGE/WRITE_EXTERNAL_STORAGE はAndroid M以上でランタイム付与としたが、Android 13(API 33)以降ではこれらがDeprecatedとなり、代替権限(例:READ_MEDIA_IMAGESなど)が必要となる。また、POST_NOTIFICATIONS のランタイム許可要求も同様にコメントへ追記せよ。

🤖 Prompt for AI Agents
In android/app/src/main/AndroidManifest.xml around lines 11 to 14, the
permissions READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE are deprecated
starting Android 13 (API 33) and require replacement with more specific
permissions like READ_MEDIA_IMAGES. Update the comments to reflect this change
and add a note about the POST_NOTIFICATIONS permission also requiring runtime
permission requests on newer Android versions. This will ensure the manifest
accurately documents the permission requirements for different Android versions.

@TinyKitten
TinyKitten merged commit 6af269b into dev May 19, 2025
@TinyKitten
TinyKitten deleted the fix/android-build branch May 19, 2025 17:19
@coderabbitai coderabbitai Bot mentioned this pull request Jan 13, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant