2014-12-04 118 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