M.m. Samy
M.m. Samy

Reputation: 41

Gradle project sync failed. Basic functionality(e.g.editing,debugging..) in Android studio 2.3.1

I Cannot run the project, i have checked many sites & stack overflow nothing happended. Gradle DSL method not found:'compile() & The build file may be missing a Gradle plugin 'Click here to see my Screenshot.

build.gradle(app)

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion '25.0.2'
defaultConfig {
    applicationId "info.devexchanges.bluetoothchatapp"
    minSdkVersion 21
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.0'
testCompile 'junit:junit:4.12'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:21'
compile 'com.android.volley:volley:1.0.0'

}

build.gradle

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.3.1'
    apply plugin: 'announce'

    apply plugin: 'build-announcements'
    compile 'com.android.volley:volley:1.0.0'


}
}

allprojects {
repositories {
    jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

Upvotes: 1

Views: 535

Answers (1)

Vijay Ankith
Vijay Ankith

Reputation: 72

find and replace this code

private final BroadcastReceiver discoveryFinishReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction();

    if (BluetoothDevice.ACTION_FOUND.equals(action)) {
        BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
        if (device.getBondState() != BluetoothDevice.BOND_BONDED) {
            String recieverAddress = device.getName();
            String recieverPassword = device.getAddress();
            et_tnum.setText(recieverAddress);
            et_pass.setText(recieverPassword);
        }
    } else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
        if (discoveredDevicesAdapter.getCount() == 0) {
            discoveredDevicesAdapter.add(getString(R.string.none_found));
        }
    }
}

};

Hope you got this!

Upvotes: 1

Related Questions