9

Otrzymuję ten błąd, gdy próbuję użyć projektu biblioteki w Android Studio. Specyficzna linia build.gradle które daje ten błąd jestPlugin with id "com.android.library" nie znaleziono

apply plugin: 'com.android.library' 

Próbowałem nawet zmieniając go do

apply plugin: 'android-library' 

Bu to nadal nie działa, zamiast tego mówi: Error:(7, 0) Plugin with id 'android-library' not found.

Próbowałem nawet Aby dodać:

classpath 'com.android.tools.build:gradle:1.2.3.+' 

w ramach zależności w build.gradle i nadal nic ...

Każda pomoc?

EDIT: Cały build.gradle

// This buildscript will assemble the MoPub SDK into an AAR. 

repositories { 
    jcenter() 
} 

apply plugin: 'android-library' 

group = 'com.mopub' 

description = '''MoPub SDK''' 

android { 
    compileSdkVersion 22 
    buildToolsVersion '22.0.1' 

    defaultConfig { 
     versionCode 25 
     versionName "3.8.0" 
     minSdkVersion 9 
     targetSdkVersion 22 
     consumerProguardFiles 'proguard.txt' 
    } 

    sourceSets { 
     main { 
      manifest.srcFile 'AndroidManifest.xml' 
      java.srcDirs = ['src/main/java'] 
      resources.srcDirs = ['src/main/java'] 
      aidl.srcDirs = ['src/main'] 
      renderscript.srcDirs = ['src/main'] 
      res.srcDirs = ['res'] 
      assets.srcDirs = ['assets'] 
     } 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), file('proguard.txt') 
     } 
    } 

    // Note: You will also need a local.properties file to set the location of the SDK in the same 
    // way that the existing SDK requires, using the sdk.dir property. 
    // Alternatively, you can set an environment variable called ANDROID_HOME. There is no 
    // difference between the two methods, you can use the one you prefer. 
} 

dependencies { 
    classpath 'com.android.tools.build:gradle:1.2.3.+' 
    compile 'com.android.support:support-v4:22.0.0' 
    compile 'com.android.support:support-annotations:22.0.0' 
    compile 'com.mopub.volley:mopub-volley:1.1.0' 
} 

// Don't run the Robolectric Unit Tests. 
check.dependsOn.remove("test") 
check.dependsOn.remove("unitTest") 
check.dependsOn.remove("testDebug") 
check.dependsOn.remove("unitTestDebug") 
+0

opublikować build.gradle w głównym katalogu głównym i build.gradle w folderze modułu. –

Odpowiedz

6

Musisz napisać tak:

apply plugin: 'com.android.application' 

Wymień ten kod w pliku zbyt:

buildscript { 
    repositories { 
     mavenCentral() // or jcenter() 
    } 

    dependencies { 
     classpath 'com.android.tools.build:gradle:1.2.3' // 1.3.0-beta2 
    } 
} 
+1

i teraz otrzymuję to: Błąd: (7, 0) Nie znaleziono wtyczki o identyfikatorze "com.android.application". – Borislav

+1

Mam nadzieję, że dodajesz do build.gradle aplikacji, musisz edytować globalnie. Wyszukaj kolejny build.gradle w projekcie! @Borislav –

+0

Edytuję plik build.gradle znajdujący się w katalogu skryptów Gradle projektu – Borislav

Powiązane problemy