I am trying to enable USB debugging for my project as per the official android documentation. However, when I wrote this in my build.gradle file:
android {
buildTypes {
debug {
debuggable true
}
I get an error saying:
Error:(25, 0) Gradle DSL method not found: 'android()' Possible causes:
The project 'Check' 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
When I try to enable USB debugging from the AndiodManifest file (without modifying the build.gradle file):
android:debuggable="true"
I get an error saying:
Avoid hardcoding the debug mode; leaving it out allows debug and release builds to automatically assign one less... (Ctrl+F1) It's best to leave out the android:debuggable attribute from the manifest. If you do, then the tools will automatically insert android:debuggable=true when building an APK to debug on an emulator or device. And when you perform a release build, such as Exporting APK, it will automatically set it to false. If on the other hand you specify a specific value in the manifest file, then the tools will always use it. This can lead to accidentally publishing your app with debug information.
I have tried both methods mentioned in the documentation. How do I enable USB debugging?
EDIT (this is the build.gradle file):
/* 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:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}