android.support.v7.appcompat,报错 Didn't find class' android.support.v7.appcompat.R$drawable'

照着第一行代码实例敲的,在第8章使用通知的实例代码中卡住了。具体代码

MainActivity

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

Button sendNotice = (Button) findViewById(R.id.send_notice);

sendNotice.setOnClickListener(this);

}

@Override

public void onClick(View v) {

switch (v.getId()){

case R.id.send_notice:

NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

NotificationCompat.Builder builder = new NotificationCompat.Builder(this);

builder.setContentTitle("BasicNotifications Sample");

builder.setContentText("Time to learn about notifications!");

builder.setSubText("Tap to view documentation about notifications.");

builder.setAutoCancel(true);

//.setLargeIcon(BitmapFactory.decodeResource(getResources(),R.mipmap.ic_launcher_round));

manager.notify(1, builder.build());

break;

default:

break;

}

}

}

Gradle

apply plugin: 'com.android.application'

android {

compileSdkVersion 26

buildToolsVersion "26.0.2"

defaultConfig {

applicationId "com.example.administrator.mediatest"

minSdkVersion 21

targetSdkVersion 26

versionCode 1

versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {

release {

minifyEnabled false

proguardFiles getDefaultProguardFile('progua

你可能感兴趣的:(android.support.v7.appcompat,报错 Didn't find class' android.support.v7.appcompat.R$drawable')