2017-07-26 68 views
1

我有一箇舊項目,我在我的Android工作室導入這個項目,我收到這個錯誤。 是的,我從互聯網上搜索它,我發現了很多解決方案,但沒有解決我的問題。ID爲'com.android.application'的插件未找到

這裏是我的build.gradle文件

// Top-level build file where you can add configuration options common to all sub-projects/modules. 


buildscript { 
repositories { 
    jcenter() 
} 
apply plugin: 'com.android.application' 

dependencies { 
    classpath 'com.android.tools.build:gradle:2.2.1' 

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

allprojects { 
repositories { 
    jcenter() 
} 
} 

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

這裏是我的模塊級的build.gradle 這裏是我的build.gradle這是在應用程序>來源>的build.gradle

apply plugin: 'com.android.application' 
//apply plugin: 'com.google.gms.google-services' 

android { 
compileSdkVersion 23 
buildToolsVersion '23.0.1' 
defaultConfig { 
    applicationId "com.pedrocarrillo.expensetracker" 
    minSdkVersion 16 
    targetSdkVersion 23 
    versionCode 3 
    versionName "1.2" 
} 

signingConfigs { 
    release { 
     def Properties localProps = new Properties() 
     localProps.load(new FileInputStream(file('../local.properties'))) 
     storeFile file("tracker_expense.jks") 
     storePassword localProps["storePass"] 
     keyAlias localProps["alias"] 
     keyPassword localProps["pass"] 
    } 
} 

buildTypes { 
    release { 
     signingConfig signingConfigs.release 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro' 
    } 
} 
} 

repositories { 
maven { url "https://jitpack.io" } 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
testCompile 'junit:junit:4.12' 
// compile 'com.google.android.gms:play-services:7.8.0' 
compile 'com.android.support:gridlayout-v7:23.0.1' 
compile 'com.android.support:support-annotations:23.0.1' 
compile 'com.android.support:appcompat-v7:23.0.1' 
compile 'com.android.support:design:23.0.1' 
compile 'com.android.support:recyclerview-v7:23.0.1' 
compile 'com.android.support:cardview-v7:23.0.1' 
compile 'fr.avianey.com.viewpagerindicator:library:[email protected]' 
compile 'io.realm:realm-android:0.82.2' 
compile 'com.github.PhilJay:MPAndroidChart:v2.1.4' 
} 
+0

是該項目級別構建文件或模塊級別的構建文件? –

+0

@BaneeIshaqueK我不知道它下的Gradle腳本。那麼在app> src> build.gradle –

+0

下也有build.gradle所以,這是項目級別的build文件和其他是模塊級別的build文件,你可以粘貼其他build.gradle文件的內容嗎? –

回答

0

試試這個:項目級別Gradle文件 ...

// Top-level build file where you can add configuration options common to all sub-projects/modules. 


buildscript { 
    repositories { 
     jcenter() 
    } 

    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.1' 

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

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

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

模塊級別搖籃文件 ...

apply plugin: 'com.android.application' 
//apply plugin: 'com.google.gms.google-services' 

android { 
    compileSdkVersion 23 
    buildToolsVersion '23.0.1' 
    defaultConfig { 
     applicationId "com.pedrocarrillo.expensetracker" 
     minSdkVersion 16 
     targetSdkVersion 23 
     versionCode 3 
     versionName "1.2" 
    } 

    signingConfigs { 
     release { 
      def Properties localProps = new Properties() 
      localProps.load(new FileInputStream(file('../local.properties'))) 
      storeFile file("tracker_expense.jks") 
      storePassword localProps["storePass"] 
      keyAlias localProps["alias"] 
      keyPassword localProps["pass"] 
     } 
    } 

    buildTypes { 
     release { 
      signingConfig signingConfigs.release 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 


dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    // compile 'com.google.android.gms:play-services:7.8.0' 
    compile 'com.android.support:gridlayout-v7:23.0.1' 
    compile 'com.android.support:support-annotations:23.0.1' 
    compile 'com.android.support:appcompat-v7:23.0.1' 
    compile 'com.android.support:design:23.0.1' 
    compile 'com.android.support:recyclerview-v7:23.0.1' 
    compile 'com.android.support:cardview-v7:23.0.1' 
    compile 'fr.avianey.com.viewpagerindicator:library:[email protected]' 
    compile 'io.realm:realm-android:0.82.2' 
    compile 'com.github.PhilJay:MPAndroidChart:v2.1.4' 
} 
+0

你試過嗎? @farooq –

+0

Thankx這很好解決了我的問題。 –

0

在你頂層文件刪除這一行:

apply plugin: 'com.android.application' 
相關問題