संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
Android Gradle प्लग इन 3.1.0 (मार्च 2018)
Android प्लगिन के इस वर्शन के लिए, ये ज़रूरी हैं:
|
कम से कम वर्शन |
डिफ़ॉल्ट वर्शन |
नोट |
Gradle |
4.4 |
4.4 |
ज़्यादा जानने के लिए, Gradle को अपडेट करने का तरीका देखें. |
एसडीके बिल्ड टूल |
27.0.3 |
27.0.3 |
एसडीके बिल्ड टूल इंस्टॉल करें या कॉन्फ़िगर करें. ध्यान रखें कि अब आपको android.buildToolsVersion प्रॉपर्टी का इस्तेमाल करके, बिल्ड टूल के लिए वर्शन तय करने की ज़रूरत नहीं है. प्लगिन, डिफ़ॉल्ट रूप से ज़रूरी कम से कम वर्शन का इस्तेमाल करता है. |
नया DEX कंपाइलर, D8
डिफ़ॉल्ट रूप से, Android Studio अब D8 नाम के नए DEX कंपाइलर का इस्तेमाल करता है. DEX कंपाइलेशन, .class
बाइटकोड को Android रनटाइम (या Android के पुराने वर्शन के लिए Dalvik) के लिए .dex
बाइटकोड में बदलने की प्रोसेस है. DX नाम के पिछले कंपाइलर की तुलना में, D8 तेज़ी से कंपाइल करता है और छोटी DEX फ़ाइलें आउटपुट करता है. साथ ही, ऐप्लिकेशन के रनटाइम की परफ़ॉर्मेंस पहले जैसी या उससे बेहतर होती है.
D8 से, ऐप्लिकेशन डेवलपमेंट के आपके रोज़मर्रा के वर्कफ़्लो में कोई बदलाव नहीं होना चाहिए. हालांकि, अगर आपको नए कंपाइलर से जुड़ी कोई समस्या आती है, तो कृपया गड़बड़ी की शिकायत करें. D8 को कुछ समय के लिए बंद किया जा सकता है और DX का इस्तेमाल किया जा सकता है. इसके लिए, अपने प्रोजेक्ट की gradle.properties
फ़ाइल में यह कोड शामिल करें:
android.enableD8=false
जिन प्रोजेक्ट में Java 8 की भाषा से जुड़ी सुविधाओं का इस्तेमाल किया जाता है उनमें इंक्रीमेंटल डिसुगरिंग की सुविधा डिफ़ॉल्ट रूप से चालू होती है. इसे बंद करने के लिए, अपने प्रोजेक्ट की gradle.properties
फ़ाइल में यह जानकारी दें:
android.enableIncrementalDesugaring=false.
प्रीव्यू वर्शन का इस्तेमाल करने वाले लोग: अगर D8 के प्रीव्यू वर्शन का इस्तेमाल किया जा रहा है, तो ध्यान दें कि अब यह SDK बिल्ड टूल में शामिल लाइब्रेरी के साथ कंपाइल होता है, न कि JDK के साथ.
इसलिए, अगर JDK में मौजूद एपीआई को ऐक्सेस किया जा रहा है, लेकिन SDK बिल्ड टूल लाइब्रेरी में मौजूद एपीआई को ऐक्सेस नहीं किया जा रहा है, तो आपको कंपाइल करने से जुड़ी गड़बड़ी का मैसेज मिलेगा.
व्यवहार में बदलाव
-
अलग-अलग एबीआई को टारगेट करने वाले कई APK बनाते समय, अब डिफ़ॉल्ट रूप से इन एबीआई के लिए APK जनरेट नहीं करता:
mips
, mips64
, और armeabi
.
अगर आपको इन एबीआइ को टारगेट करने वाले APK बनाने हैं, तो आपको NDK r16b या इससे पहले के वर्शन का इस्तेमाल करना होगा. साथ ही, यहां दिखाए गए तरीके से अपनी build.gradle
फ़ाइल में एबीआइ तय करने होंगे:
splits {
abi {
include 'armeabi', 'mips', 'mips64'
...
}
}
splits {
abi {
include("armeabi", "mips", "mips64")
...
}
}
-
Android प्लगिन का बिल्ड
कैश अब 30 दिन से ज़्यादा पुरानी कैश मेमोरी की एंट्री हटा देता है.
-
"auto"
को resConfig
में पास करने पर, अब स्ट्रिंग रिसॉर्स अपने-आप नहीं चुने जाते. इसलिए, उन्हें आपके APK में पैकेज नहीं किया जाता.
"auto"
का इस्तेमाल जारी रखने पर, प्लगिन आपके ऐप्लिकेशन और उसकी डिपेंडेंसी से मिलने वाले सभी स्ट्रिंग रिसॉर्स को पैकेज करता है. इसलिए, आपको हर उस स्थान-भाषा के बारे में बताना चाहिए जिसे आपको प्लग इन के ज़रिए अपने APK में पैकेज करना है.
-
लोकल मॉड्यूल, आपके ऐप्लिकेशन के टेस्ट APK पर निर्भर नहीं हो सकते. इसलिए, androidTestImplementation
के बजाय androidTestApi
कॉन्फ़िगरेशन का इस्तेमाल करके, इंस्ट्रुमेंट किए गए टेस्ट में डिपेंडेंसी जोड़ने पर, Gradle यह चेतावनी जारी करता है:
WARNING: Configuration 'androidTestApi' is obsolete
and has been replaced with 'androidTestImplementation'
WARNING: Configuration 'androidTestApi' is obsolete
and has been replaced with 'androidTestImplementation'
समाधान
- इस अपडेट से उस समस्या को ठीक किया गया है जिसमें Android Studio, कंपोज़िट बिल्ड में डिपेंडेंसी को ठीक से पहचान नहीं पाता था.
- इस अपडेट में, उस समस्या को ठीक किया गया है जिसमें एक ही बिल्ड में Android प्लगिन को कई बार लोड करने पर, प्रोजेक्ट सिंक करने से जुड़ी गड़बड़ी दिखती है. उदाहरण के लिए, जब कई सबप्रोजेक्ट में से हर एक में, Android प्लगिन को अपने buildscript classpath में शामिल किया जाता है.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-09-03 (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-09-03 (UTC) को अपडेट किया गया."],[],[],null,["\u003cbr /\u003e\n\nAndroid Gradle Plugin 3.1.0 (March 2018)\n\nThis version of the Android plugin requires the following:\n\n| | Minimum version | Default version | Notes |\n|----------------:|:---------------:|:---------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|\n| Gradle | 4.4 | 4.4 | To learn more, see [updating Gradle](/build/releases/gradle-plugin?buildsystem=ndk-build#updating-gradle). |\n| SDK Build Tools | 27.0.3 | 27.0.3 | [Install](/studio/intro/update#sdk-manager) or [configure](/tools/releases/build-tools) SDK Build Tools. Keep in mind, you no longer need to specify a version for the build tools using the android.buildToolsVersion property---the plugin uses the minimum required version by default. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nNew DEX compiler, D8\n\nBy default, Android Studio now uses a new DEX compiler called D8. DEX\ncompilation is the process of transforming `.class` bytecode into\n`.dex` bytecode for the Android Runtime (or Dalvik, for older\nversions of Android). Compared to the previous compiler, called DX, D8\ncompiles faster and outputs smaller DEX files, all while having the same or\nbetter app runtime performance.\n\nD8 shouldn't change your day-to-day app development workflow. However, if\nyou experience any issues related to the new compiler, please\n[report a bug](/studio/report-bugs). You can temporarily\ndisable D8 and use DX by including the following in your project's\n`gradle.properties` file: \n\n android.enableD8=false\n \nFor projects that\n[use Java 8 language features](/studio/write/java8-support),\nincremental desugaring is enabled by default. You can disable it by\nspecifying the following in your project's `gradle.properties` file: \n\n android.enableIncrementalDesugaring=false.\n \n\n**Preview users:** If you're already using a preview version of D8, note\nthat it now compiles against libraries included in the\n[SDK build tools](/studio/releases/build-tools)---not the JDK.\nSo, if you are accessing APIs that exist in the JDK but not in the SDK build\ntools libraries, you get a compile error.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nBehavior changes\n\n- When building multiple APKs that each target a different ABI, the\n no longer generates APKs for the following ABIs by default:\n `mips`, `mips64`, and `armeabi`.\n\n If you want to build APKs that target these ABIs, you must use\n [NDK r16b or lower](/ndk/downloads/revision_history) and\n specify the ABIs in your `build.gradle` file, as shown below: \n\n ```groovy\n splits {\n abi {\n include 'armeabi', 'mips', 'mips64'\n ...\n }\n }\n \n ``` \n\n ```kotlin\n splits {\n abi {\n include(\"armeabi\", \"mips\", \"mips64\")\n ...\n }\n }\n \n ```\n- The Android plugin's [build\n cache](/studio/build/build-cache) now evicts cache entries that are older than 30 days.\n\n- Passing `\"auto\"` to\n [`resConfig`](https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.ProductFlavor.html#com.android.build.gradle.internal.dsl.ProductFlavor:resConfig(java.lang.String))\n no longer automatically picks string resources to package into your APK.\n If you continue to use `\"auto\"`, the plugin packages all string\n resources your app and its dependencies provide. So, you should instead\n specify each locale that you want the plugin to package into your APK.\n\n- Because local modules can't depend on your app's test APK, adding\n dependencies to your instrumented tests using the\n `androidTestApi` configuration, instead of\n `androidTestImplementation`, causes Gradle to issue the\n following warning:\n\n ```groovy\n WARNING: Configuration 'androidTestApi' is obsolete\n and has been replaced with 'androidTestImplementation'\n \n ``` \n\n ```kotlin\n WARNING: Configuration 'androidTestApi' is obsolete\n and has been replaced with 'androidTestImplementation'\n \n ```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nFixes\n\n- Fixes an issue where Android Studio doesn't properly recognize dependencies in composite builds.\n- Fixes an issue where you get a project sync error when loading the Android plugin multiple times in a single build--for example, when multiple subprojects each include the Android plugin in their buildscript classpath.\n\n\u003cbr /\u003e"]]