6
apply plugin: 'kotlin-android-extensions'. 

नहीं मिला जब मैं एंड्रॉयड स्टूडियो पूर्वावलोकन में इस एक्सटेंशन जोड़ने, मुझे इस त्रुटि दे "त्रुटि: (1, 0) प्लगइन के साथ आईडी 'कोटलिन-एंड्रॉइड-एक्सटेंशन' नहीं मिला। "त्रुटि: (1, 0) आईडी के साथ प्लगइन 'kotlin-android-एक्सटेंशन'

मेरे निर्माण Gradle

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.1" 
    defaultConfig { 
     applicationId "com.example.mohamed_elbaz.myapplication" 
     minSdkVersion 15 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    implementation fileTree(dir: 'libs', include: ['*.jar']) 
    implementation 'com.android.support:appcompat-v7:26.0.2' 
    implementation 'com.android.support.constraint:constraint-layout:1.0.2' 
    testImplementation 'junit:junit:4.12' 
    androidTestImplementation 'com.android.support.test:runner:1.0.1' 
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 
} 
+0

अपने build.gradle दिखाएं। – jdv

उत्तर

8

build.gradle स्निपेट को अपनी एप्लिकेशन मॉड्यूल के अंदर config की तरह दिखता था। आपकी प्रोजेक्ट की रूट निर्देशिका में build.gradle क्या दिखता है? kotlin प्लगइन निर्भरता को जोड़ने के लिए यह कुछ इस तरह दिखना चाहिए:

buildscript { 
    ext.kotlin_version = '1.1.50' 
    repositories { 
     jcenter() 
     google() 

    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.0-beta6' 
     classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
     google() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

महत्वपूर्ण हिस्सा लाइन classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" जो kotlin प्लगइन्स कहते हैं किया जा रहा है।

+0

मेरे लिए काम किया, बाद में एसडीके को 26 में अपडेट करने के लिए कहा। – Leon

6

To use the plugin, you have to add it in your root build.gradle file

buildscript { 
ext.kotlin_version = '1.1.60' 
    repositories { 
     jcenter() 
     maven { 
      url 'https://maven.google.com' 
     } 
    } 

    dependencies { 
     classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 
    } 
} 
संबंधित मुद्दे