Android studio Gradle项目同步失败。Android studio 2.3.1中的基本功能(例如编辑、调试…)

Android studio Gradle项目同步失败。Android studio 2.3.1中的基本功能(例如编辑、调试…),android-studio,android-gradle-plugin,Android Studio,Android Gradle Plugin,我无法运行该项目,我检查了许多站点&堆栈溢出没有发生任何情况未找到Gradle DSL方法:“compile()&生成文件可能缺少Gradle插件 build.gradle(应用程序) 格雷德尔先生 buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.1' apply plugin: 'announce' app

我无法运行该项目,我检查了许多站点&堆栈溢出没有发生任何情况未找到Gradle DSL方法:“compile()&生成文件可能缺少Gradle插件

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
}

查找并替换此代码

private final BroadcastReceiver discoveryFinishReceiver=new BroadcastReceiver(){ @凌驾 公共void onReceive(上下文、意图){ String action=intent.getAction()

})


希望您能收到此消息!

谢谢您的建议。我尝试了您的想法。但是接收方没有发生任何事情,只有发送方自动输入,我不希望这样。接收方手机应该在编辑文本中接收这些字符串。我将发布我的代码。请帮助我在enableIntent.putExtra(“accountNumber”,等等)中遇到错误;enableIntent.putExtra(“密码”,et_pass);`public void onClick(视图v){Intent i=new Intent(this,MainActivity.class);enableIntent.putExtra(“accountNumber”,et_tnum);enableIntent.putExtra(“密码”,et_pass);String accountNumber=(String)getIntent().getExtras().get(“accountNumber”);字符串密码=(字符串)getIntent().getExtras().get(“密码”);et_tnum.setText(帐号);et_pass.setText(密码);}`&我不知道如何使用intent在您的案例中,意图是我因此将enableentent替换为i。您是Android的新手吗?您可以尝试将build.gradle中的插件添加到依赖项主体下方的app/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
}
    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));
        }
    }
}