Web Analytics

ResChiper

⭐ 106 stars Japanese by goldfish07

ResChiper

failed to load artifacts/logo.png

AABリソース難読化ツール

License Android Gradle Plugin BundleTool JDK Version Gradle Version ResChiper Version

目次

はじめに

ResChiperはAndroid AABリソースの難読化を目的としたツールです。 リソースの不正アクセスを防ぎ、アプリのAABサイズを削減することができます。

始め方

この手順に従って、AndroidプロジェクトにAABリソース難読化ツールを統合してください。

要件

ResChiperを使用する前に、アプリが以下の要件を満たしていることを確認してください。

インストール

#### 1. ResChiper Gradleプラグインを追加

プロジェクトのルートレベルのbuild.gradleファイルのbuildscriptセクションにResChiper Gradleプラグインを追加します:

buildscript {
  dependencies {
    classpath "io.github.goldfish07.reschiper:plugin:"
  }
  
  repositories {
    mavenCentral()
    google()
   }
}

#### 2. プラグインの適用

アプリレベルの build.gradle ファイルで、ResChiper プラグインを適用します:

apply plugin: "io.github.goldfish07.reschiper"

#### 3. プラグインの設定

app/build.gradle ファイルで、ResChiper プラグインを設定し、希望する設定を指定します。以下は設定例です:

resChiper {
    enableObfuscation = true //by default res obfuscate is enabled
    obfuscationMode = "default" //["dir", "file", "default"]
    obfuscatedBundleName = "reschiper-app.aab" // Obfuscated file name, must end with '.aab'
    //mappingFile = file("path/to/your/mapping.txt").toPath() // Mapping file used for incremental obfuscation
    whiteList = [
                  //Whitelist rule (directory name to exclude)
                  "res/raw", // raw dir will not be obfuscated
                  "res/xml", // xml dir will not be obfuscated

//Whitelist rule (file name to exclude) "res/raw/*", // all files inside raw directory will not be obfuscated "res/raw/success_tick.json", // success_tick.json file will not be obfuscated "res/xml/*", // all files inside xml directory will not be obfuscated

// White list rules (resource name to exclude) ".R.raw.", ".R.xml.",

// for google-services "*.R.string.google_api_key", "*.R.string.google_app_id", "*.R.string.default_web_client_id", "*.R.string.gcm_defaultSenderId", "*.R.string.ga_trackingId", "*.R.string.firebase_database_url", "*.R.string.google_crash_reporting_api_key", "*.R.string.google_storage_bucket", "*.R.integer.google_play_services_version", //firebase "*.R.string.project_id", //firebase crashlytics "*.R.string.com.google.firebase.crashlytics.mapping_file_id", "*.R.bool.com.crashlytics.useFirebaseAppId", "*.R.string.com.crashlytics.useFirebaseAppId", "*.R.string.google_app_id", "*.R.bool.com.crashlytics.CollectDeviceIdentifiers", "*.R.string.com.crashlytics.CollectDeviceIdentifiers", "*.R.bool.com.crashlytics.CollectUserIdentifiers", "*.R.string.com.crashlytics.CollectUserIdentifiers", "*.R.string.com.crashlytics.ApiEndpoint", "*.R.string.com.crashlytics.android.build_id", "*.R.bool.com.crashlytics.RequireBuildId", "*.R.string.com.crashlytics.RequireBuildId", "*.R.bool.com.crashlytics.CollectCustomLogs", "*.R.string.com.crashlytics.CollectCustomLogs", "*.R.bool.com.crashlytics.Trace", "*.R.string.com.crashlytics.Trace", "*.R.string.com.crashlytics.CollectCustomKeys" ] mergeDuplicateResources = true // allow the merge of duplicate resources enableFileFiltering = true enableFilterStrings = true fileFilterList = [ // file filter rules "META-INF/*", // "/armeabi-v7a/", // "/arm64-v8a/", // "/x86/", // "/x86_64/" ] unusedStringFile = "path/to/your/unused_strings.txt" // strings will be filtered in this file localeWhiteList = ["en", "in", "fr"] //keep en,en-xx,in,in-xx,fr,fr-xx and remove others locale. }

使い方

リソースを難読化し、難読化されたAABを生成するには、プロジェクトのルートディレクトリで以下のGradleコマンドを実行してください。:

./gradle clean :app:resChiperDebug --stacktrace
このコマンドはプロジェクトのルートから難読化プロセスを実行し、難読化されたAABは app/build/outputs/bundle/debug ディレクトリに生成されます。

設定オプション

ResChiper拡張機能は、リソース難読化のための様々な設定オプションを提供しており、難読化の有効/無効、 マッピングファイルの指定、リソースのホワイトリスト設定などが含まれます。

obfuscationMode = "file"、ディレクトリとファイルの両方を難読化する場合は obfuscationMode = "default" を設定します。

設定例の一部はこちらで確認できます。

ホワイトリスト

ビルドプロセス中に難読化されないリソースです。
ホワイトリストの設定はこちらで確認可能です。

出力

難読化プロセスの実行後、以下の出力ファイルが生成されます:

インクリメンタルな難読化を実現します。これは、継続的に管理したい場合に特に有用です。

異なるビルド間での一貫性を確保します。

重複リソースを特定し追跡するのに役立ちます。

これらの出力ファイルはResChiperツールを実行した結果生成され、プロジェクトのビルド出力内の該当ディレクトリに 配置されます。

謝辞

ResChiperは以下のプロジェクトおよびツールに触発されています:

ライセンス

Apache License v2.0 logo

Copyright (C) 2023 goldfish07 (Ayush Bisht) 本ファイルはResChiperの一部です。

ResChiperはフリーソフトウェアです。Apache License バージョン2.0に基づき、 再配布および改変が可能です。ライセンスはApache Software Foundationにより 公開されており、バージョン2.0またはそれ以降の任意のバージョンを適用できます。

Apache License バージョン2.0(「ライセンス」)の条件に従いライセンスされており、 本ファイルを使用する際はライセンスに従う必要があります。 ライセンスの全文は以下のURLから入手可能です。

http://www.apache.org/licenses/LICENSE-2.0

適用法令により要求される場合や書面での合意がない限り、 本ソフトウェアは「現状のまま」提供され、明示または黙示の保証は一切ありません。 ライセンスに基づく特定の権利および制限についてはライセンス文書を参照してください。

--- Tranlated By Open Ai Tx | Last indexed: 2026-06-02 ---