2014-12-04 72 views
1

我在android應用程序中的其他人在android studio中編寫代碼維護。安卓工作室 - 問題與Gradle

當我嘗試用搖籃的文件同步的項目,我得到這個錯誤信息:

23:46:27 UnsupportedMethodException 
    Failed to set up Android modules in project 'BuyTheWay': Unsupported method: SourceProvider.getJniDirectories(). 
    The version of Gradle you connect to does not support that method. 
    To resolve the problem you can change/upgrade the target version of Gradle you connect to. 
    Alternatively, you can ignore this exception and read other information from the model. 

我使用的是0.8.14版本的Android工作室。

在雁到相似queshtion Gradle DSL method not found: 'runProguard',有人建議在的build.gradle文件(在應用程序的文件夾)取代行:

runProguard false 

minifyEnabled false 

但它幫助我,因爲編譯器還在行中標記「getDefaultProguardFile」

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 

和clains是:

cannot resolve symbol getDefaultProguardFile 

嘗試一種不同勢的方法,並在gragle文件夾,力幫助

這是原來的代碼改變build.grale

// 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:0.14.0' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

當我改變時

classpath 'com.android.tools.build:gradle:0.14.0' 

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

,並嘗試與搖籃文件同步的項目,我得到這個錯誤信息:

Error:(17, 0) Gradle DSL method not found: 'runProguard()' 
Possible causes: 
    The project 'BuyTheWay' may be using a version of Gradle that does not contain the method. 
    <a href="open.wrapper.file">Open Gradle wrapper file</a> 
    The build file may be missing a Gradle plugin. 
    <a href="apply.gradle.plugin">Apply Gradle plugin</a> 

回答

2

一步就可以解決這個問題。

buildTypes { 
    release { 
    apply plugin: 'eclipse' 
    runProguard false // <==== **remove this line** 
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
+0

對於Android Studio,正是這個......應用插件:'idea'。謝謝 – gnB 2015-02-12 22:12:22