0

I am new to android developing. I am trying to open an existing project and get it to compile. this the first time for me using android studio and the Gradle file got me a little confused. I am trying to synchronize it but it is failing. This is the content of Gradle.build

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 25
        buildToolsVersion "25.0.1"

        defaultConfig {
            applicationId "de.establishement.packagelist"
            minSdkVersion 16
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"

            testInstrumentationTrial "android.support.test.trial.AndroidJUnitRunner"

        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                debuggable= true
            }
        }
    }
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:25.3.1'
        compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
        testCompile 'junit:junit:4.12'
    }

I downloaded this project and I have it in my Desktop. this is what I get in my build messages:

    FAILURE: Build failed with an exception.

* Where:
Build file '/mac/Desktop/javaproject/build.gradle' line: 21

* What went wrong:
Could not compile build file '/Users/mac/Desktop/javaproject/build.gradle'.
> startup failed:
  build file '/Users/mac/Desktop/javaproject/build.gradle': 21: Statement labels may not be used in build scripts.
  In case you tried to configure a property named 'debuggable', replace ':' with '=' or ' ', otherwise it will not have the desired effect.
   @ line 21, column 25.
                 debuggable: true
                             ^

  1 error


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 10s
ERROR: startup failed:
build file '/Users/mac/Desktop/javaproject/build.gradle': 21: Statement labels may not be used in build scripts.
In case you tried to configure a property named 'debuggable', replace ':' with '=' or ' ', otherwise it will not have the desired effect.
 @ line 21, column 25.
               debuggable: true
                           ^

1 error

Open File
waffles123
  • 19
  • 6
  • Does this answer your question? [Error:(1, 0) Plugin with id 'com.android.application' not found](https://stackoverflow.com/questions/24795079/error1-0-plugin-with-id-com-android-application-not-found) – jeprubio Jan 29 '20 at 22:46
  • make sure you have build.gradle(Project) and you have last update Gradle version and last version of android studio – Mahmoud Abu Alheja Jan 29 '20 at 22:54
  • another note compile is deprecated and must replaced with implementation – Mahmoud Abu Alheja Jan 29 '20 at 22:57
  • @MahmoudAbuElheja I have 5.4.1 version of Gradle and I will try to update it. – waffles123 Jan 29 '20 at 23:10
  • @MahmoudAbuElheja when I open a new empty project the Gradle seems to be fine and it builds successfully. when I open the existing project, however, It doesn't. shall I copy the content of the Gradle files that works to the other files or would that mess up the project – waffles123 Jan 29 '20 at 23:41
  • so it is work now ?! don't copy all content just copy the dependencies from fine file to another – Mahmoud Abu Alheja Jan 30 '20 at 00:04
  • @MahmoudAbuElheja I updated all the sdk tools, launched android studio again with new project it is fine, with that specific project it isn't. – waffles123 Jan 30 '20 at 00:22

2 Answers2

0

Looking at your logs you must change debuggable: true to debuggable = true

Did you try it?

0

Wrong use. Try this;

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 25
        buildToolsVersion "25.0.1"

        defaultConfig {
            applicationId "de.establishement.packagelist"
            minSdkVersion 16
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"

            testInstrumentationTrial "android.support.test.trial.AndroidJUnitRunner"

        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                debuggable true //This row is wrong.
            }
        }
    }
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:25.3.1'
        compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
        testCompile 'junit:junit:4.12'
    }
  • I tried your solution and this is what I get when trying to synchronize: * What went wrong: A problem occurred evaluating root project 'javatest'. > Plugin with id 'com.android.application' not found. – waffles123 Jan 30 '20 at 11:37
  • Ok. Change this section. debuggable= true => debuggable true @waffles123 – Mustafa Yanık Jan 30 '20 at 11:48
  • in my original Gradle or in the one you provided. Because yours already has that! – waffles123 Jan 30 '20 at 12:04