Zag Gol
Zag Gol

Reputation: 1076

android studio - problems with Gradle

I making a code maintenance in of android app that someone else writed in android studio.

when i try to sync project with Gradle files, i get this error message:

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.

I am using the 0.8.14 version of android studio.

In a anser to a similar queshtion Gradle DSL method not found: 'runProguard' , it was recommended to replace in the build.gradle file (in the app folder) the line:

runProguard false

with

minifyEnabled false

but it dosent help for me, because the compiler also marks "getDefaultProguardFile" in the line

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

and clains that:

cannot resolve symbol getDefaultProguardFile

trying a diffrent approach, and changing the build.grale in the gragle folder, dint help

this is the original code:

// 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()
    }
}

when i change

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

with

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

and try to sync project with Gradle files, i get this error message:

    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>

Upvotes: 1

Views: 4403

Answers (1)

ds0218
ds0218

Reputation: 31

One step can solve this problem.

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

Upvotes: 2

Related Questions