সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
সর্বোত্তম ব্যবহারকারীর অভিজ্ঞতার জন্য, আপনার অ্যাপটিকে যতটা সম্ভব ছোট এবং দ্রুত করার জন্য অপ্টিমাইজ করা উচিত। আমাদের অ্যাপ অপ্টিমাইজার, যাকে বলা হয় R8, অব্যবহৃত কোড এবং সংস্থানগুলি সরিয়ে, রানটাইম পারফরম্যান্স অপ্টিমাইজ করতে কোড পুনরায় লেখা এবং আরও অনেক কিছুর মাধ্যমে আপনার অ্যাপটিকে স্ট্রীমলাইন করে। আপনার ব্যবহারকারীদের কাছে, এর মানে হল:
অ্যাপ অপ্টিমাইজেশান সক্ষম করতে, নিম্নলিখিত কোডে দেখানো হিসাবে আপনার রিলিজ বিল্ডের অ্যাপ-লেভেল বিল্ড স্ক্রিপ্টে isMinifyEnabled = true (কোড অপ্টিমাইজেশনের জন্য) এবং isShrinkResources = true (রিসোর্স অপ্টিমাইজেশানের জন্য) সেট করুন। আমরা সুপারিশ করি যে আপনি সর্বদা উভয় সেটিংস সক্ষম করুন৷ আমরা শুধুমাত্র আপনার অ্যাপের চূড়ান্ত সংস্করণে অ্যাপ অপ্টিমাইজেশন সক্ষম করার পরামর্শ দিই যা আপনি প্রকাশ করার আগে পরীক্ষা করেন—সাধারণত আপনার রিলিজ বিল্ড—কারণ অপ্টিমাইজেশানগুলি আপনার প্রোজেক্টের বিল্ড টাইম বাড়িয়ে দেয় এবং কোড পরিবর্তন করার কারণে ডিবাগিংকে আরও কঠিন করে তুলতে পারে।
উপরন্তু, আপনার প্রকল্পের gradle.properties ফাইল থেকে এই লাইনটি সরিয়ে R8 তার সম্পূর্ণ অপ্টিমাইজেশান ক্ষমতা ব্যবহার করে কিনা যাচাই করুন, যদি এটি বিদ্যমান থাকে:
android.enableR8.fullMode=false# Remove this line from your codebase.
মনে রাখবেন যে অ্যাপ অপ্টিমাইজেশান সক্ষম করা স্ট্যাক ট্রেস বোঝা কঠিন করে তোলে, বিশেষ করে যদি R8 ক্লাস বা পদ্ধতির নাম পরিবর্তন করে। আপনার সোর্স কোডের সাথে সঠিকভাবে সঙ্গতিপূর্ণ স্ট্যাক ট্রেস পেতে, মূল স্ট্যাক ট্রেস পুনরুদ্ধার করুন দেখুন।
এই পৃষ্ঠার কন্টেন্ট ও কোডের নমুনাগুলি Content License-এ বর্ণিত লাইসেন্সের অধীনস্থ। Java এবং OpenJDK হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-07-30 UTC-তে শেষবার আপডেট করা হয়েছে।
[[["সহজে বোঝা যায়","easyToUnderstand","thumb-up"],["আমার সমস্যার সমাধান হয়েছে","solvedMyProblem","thumb-up"],["অন্যান্য","otherUp","thumb-up"]],[["এতে আমার প্রয়োজনীয় তথ্য নেই","missingTheInformationINeed","thumb-down"],["খুব জটিল / অনেক ধাপ","tooComplicatedTooManySteps","thumb-down"],["পুরনো","outOfDate","thumb-down"],["অনুবাদ সংক্রান্ত সমস্যা","translationIssue","thumb-down"],["নমুনা / কোড সংক্রান্ত সমস্যা","samplesCodeIssue","thumb-down"],["অন্যান্য","otherDown","thumb-down"]],["2025-07-30 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# Enable app optimization\n\nFor the best user experience, you should optimize your app to make it as small\nand fast as possible. Our app optimizer, called R8, streamlines your app by\nremoving unused code and resources, rewriting code to optimize runtime\nperformance, and more. To your users, this means:\n\n- Faster startup time\n- Improved rendering and runtime performance\n- Fewer [ANRs](/topic/performance/anrs/keep-your-app-responsive)\n\n| **Important:** You should always enable optimization for your app's release build; however, you probably don't want to enable it for tests or libraries. For more information about using R8 with tests, see [Test and troubleshoot the\n| optimization](/topic/performance/app-optimization/test-and-troubleshoot-the-optimization). For more information about enabling R8 from libraries, see [Optimization for library authors](/topic/performance/app-optimization/library-optimization).\n\nTo enable app optimization, set `isMinifyEnabled = true` (for code optimization)\nand `isShrinkResources = true` (for resource optimization) in your [release\nbuild's](/studio/publish/preparing#turn-off-debugging) app-level build script as shown in the following code. We recommend\nthat you always enable both settings. We also recommend enabling app\noptimization only in the final version of your app that you test before\npublishing---usually your release build---because the optimizations increase the\nbuild time of your project and can make debugging harder due to the way it\nmodifies code. \n\n### Kotlin\n\n```kotlin\nandroid {\n buildTypes {\n release {\n\n // Enables code-related app optimization.\n isMinifyEnabled = true\n\n // Enables resource shrinking.\n isShrinkResources = true\n\n proguardFiles(\n // Default file with automatically generated optimization rules.\n getDefaultProguardFile(\"proguard-android-optimize.txt\"),\n\n ...\n )\n ...\n }\n }\n ...\n}\n```\n\n### Groovy\n\n```groovy\nandroid {\n buildTypes {\n release {\n\n // Enables code-related app optimization.\n minifyEnabled true\n\n // Enables resource shrinking.\n shrinkResources true\n\n // Default file with automatically generated optimization rules.\n proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')\n\n ...\n }\n }\n}\n```\n\nAdditionally, verify that R8 uses its full optimization capabilities by\nremoving this line from your project's `gradle.properties` file, if it exists: \n\n android.enableR8.fullMode=false # Remove this line from your codebase.\n\nNote that enabling app optimization makes stack traces difficult to understand,\nespecially if R8 renames class or method names. To get stack traces that\ncorrectly correspond to your source code, see\n[Recover the original stack trace](/topic/performance/app-optimization/test-and-troubleshoot-the-optimization#recover-original-stack-trace).\n\nIf R8 is enabled, you should also [create Startup Profiles](/topic/performance/baselineprofiles/dex-layout-optimizations) for even better\nstartup performance.\n\nIf you enable app optimization and it causes errors, here are some strategies to\nfix them:\n\n- [Add keep rules](/topic/performance/app-optimization/add-keep-rules) to keep some code untouched.\n- [Adopt optimizations incrementally](/topic/performance/app-optimization/adopt-optimizations-incrementally).\n- Update your code to [use libraries that are better suited for optimization](/topic/performance/app-optimization/choose-libraries-wisely).\n\n| **Caution:** Tools that replace or modify R8's output can negatively impact runtime performance. R8 is careful about including and testing many optimizations at the code level, in [DEX layout](/topic/performance/app-optimization/6), and in correctly producing Baseline Profiles - other tools producing or modifying DEX files may break these optimizations, or otherwise regress performance."]]