赞
踩
public static Notification createMessageNotification(Context context, String title, String msg, PendingIntent intent) { Notification notif = new Notification(); // notif.icon = R.drawable.chat_icon_over; // notif.iconLevel = 0; // notif.when = System.currentTimeMillis(); // notif.flags &= Notification.FLAG_ONGOING_EVENT; // // notif.defaults |= Notification.DEFAULT_VIBRATE; // notif.defaults |= Notification.DEFAULT_SOUND; // notif.defaults |= Notification.DEFAULT_LIGHTS; // // notif.setLatestEventInfo(context, title, msg, intent); return notif; }
1:在 app ->build.gradle ->dependencies 标签中 添加
compile ‘com.android.support:multidex:1.0.1’
2:在 app ->build.gradle ->defaultConfig 标签中 添加
multiDexEnabled true
3: 在 AndroidManifest.xml 中的 application 标签中添加
android:name=”android.support.multidex.MultiDexApplication”
4: 如果你的应用程序继承 Application , 那么你需要重写Application attachBaseContext方法
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this) ;
}
附上链接
dexOptions { incremental true javaMaxHeapSize "4g" }
apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "25.0.1" dexOptions { incremental true javaMaxHeapSize "4g" } defaultConfig { applicationId "org.linphone" minSdkVersion 16 targetSdkVersion 23 multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.google.android.gms:play-services:+' compile 'com.android.support:multidex:1.0.1' }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。