1.项目依赖包重复
方法一:
defaultConfig {
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
applicationId "com.as.appwithbase"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
compile 'com.android.support:multidex:1.0.1'
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
方法二:
可以在github 看library看依赖,对比你的依赖
例如:
//viewpager 各种样式
compile('com.github.OCNYang:PageTransformerHelp:v1.0.1') {
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'support-v7'
}
2.startforegroundservice与startservice
需要在Service的onCreate方法中
startForeground(1,new Notification());
不可以为0;