2

I am trying to build the project and run it in my google glass but when ever i am trying to build it is showing that

Error:(20, 0) Gradle DSL method not found: 'runProguard()' Possible causes:

  • The project 'gdk-stopwatch-sample' may be using a version of Gradle that does not contain the method. Gradle settings
  • The build file may be missing a Gradle plugin. Apply Gradle plugin
  • but i have installed the latest gradle plugin i.e 2.13, changed the classpath in build.gradle to 'com.android.tools.build:gradle:2.1.3', gradle-wrapper properties to (distributionUrl=https://services.gradle.org/distributions/gradle-2.13-all.zip), deleted the .gradle file in Users but it keeps on appearing again and again, and also in settings I marked as offline work, service directory path keeps on appearing though

    Updated Manifest

    <?xml version="1.0" encoding="utf-8"?>
    

    <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
    
    <application>
        <uses-library android:name="android.test.runner" />
    </application>
    
    <instrumentation android:name="android.test.InstrumentationTestRunner"
                     android:targetPackage="com.google.android.glass.sample.stopwatch"
                     android:handleProfiling="false"
                     android:functionalTest="false"
                     android:label="Tests for com.google.android.glass.sample.stopwatch"/>
    

    komy029
    • 27
    • 7

    3 Answers3

    4

    It happens because the gradle plugin for Android 2.1.3 doesn't exist.
    Don't confuse the gradle version with the gradle plugin.

    Use

    buildscript {
    
        repositories {
            jcenter()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:2.1.0'
        }
    }
    

    About the runProguard change your script with:

    release {
        minifyEnabled true 
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    
    Gabriele Mariotti
    • 320,139
    • 94
    • 887
    • 841
    0

    Use minifyEnabled() instead of runProguard()

    So the code will look like

    buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }
        }
    
    DevUt
    • 1,280
    • 11
    • 24
    • In the gradle wrapper properties should i use 2.10 or 2.13 because now the build is successful but while trying to run in glass it says default activity not found – komy029 May 17 '16 at 15:37
    • Try 2.1.0 as @Gabriele says 2.1.3 doesn't exist – DevUt May 17 '16 at 15:42
    • Build is successfull but while running that example it says - Could not identify launch activity: Default Activity not found Error while Launching activity. So i tried to run another sample by using the same settings and changing the runproguard to minifyEnabled but it says "Error:The 'java' plugin has been applied, but it is not compatible with the Android plugins." – komy029 May 17 '16 at 15:54
    • @komy029 File -> Invalidate Caches / Restart. Then also sync it – DevUt May 17 '16 at 16:09
    • yeah done that but still the same results first sample shows: Could not identify launch activity ; second one =Error:The 'java' plugin has been applied, but it is not compatible with the Android plugins. – komy029 May 17 '16 at 16:27
    • Remove the `apply plugin: ' java ' ` – DevUt May 17 '16 at 16:29
    • Thank you for the help, now the build is successful in both the examples but it is not possible to run them they both keep on saying "Could not identify launch activity: Default Activity not found Error while Launching activity" – komy029 May 17 '16 at 16:37
    • @komy029 http://stackoverflow.com/questions/33855518/could-not-identify-launch-activity-default-activity-not-found – DevUt May 17 '16 at 17:36
    0

    Issue Error with gradle plugin not getting updated resolved - If you are getting this error you should update the plugin version to 2.1.2 or 2.3.1 (Be careful it is 2.1.2 and not not 2.12). Here is the sample project level build.gradle that resolved my error-

    // 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.3.1'
        }
    }
    allprojects {
        repositories {
            jcenter()
        }
    }
    
    Ajay B
    • 746
    • 9
    • 19