Closed billdizl closed 2 years ago
@billdizl 可以发一下你的任务链么 我这边复现一下
//延时加载 AnchorsManager.getInstance() .debuggable(BuildConfig.DEBUG) //设置锚点 .addAnchor(InitCaocConfig.TASK_ID, InitMNCrashMonitor.TASK_ID, InitAppsFlyer.TASK_ID, InitFrontBack.TASK_ID, InitFaceBook.TASK_ID, InitAdId.TASK_ID, InitKlarna.TASK_ID, InitToast.TASK_ID , InitForterPay.TASK_ID
)
.start(new Project.Builder("app", new AppTaskSdkFactory())
.add(InitCaocConfig.TASK_ID)
.add(InitMNCrashMonitor.TASK_ID)
.add(InitAppsFlyer.TASK_ID)
.add(InitFrontBack.TASK_ID)
.add(InitFaceBook.TASK_ID)
.add(InitAdId.TASK_ID)
.add(InitKlarna.TASK_ID)
.add(InitToast.TASK_ID)
.add(InitForterPay.TASK_ID)
.build()
);
/**
object TaskSdkCreatorer : TaskCreator { override fun createTask(taskName: String): Task { return when (taskName) { InitCaocConfig.TASK_ID -> InitCaocConfig() InitMNCrashMonitor.TASK_ID -> InitMNCrashMonitor() InitAppsFlyer.TASK_ID -> InitAppsFlyer() InitFrontBack.TASK_ID -> InitFrontBack() InitFaceBook.TASK_ID -> InitFaceBook() InitAdId.TASK_ID -> InitAdId() InitKlarna.TASK_ID -> InitKlarna() InitToast.TASK_ID -> InitToast() InitForterPay.TASK_ID -> InitForterPay() else -> InitDefault() } } }
class InitDefault : Task(TASK_ID, true) { companion object { const val TASK_ID = "0" }
override fun run(name: String) {
}
}
//初始化崩溃 class InitCaocConfig : Task(TASK_ID, true) { companion object { const val TASK_ID = "1" }
override fun run(name: String) {
//初始化崩溃
CaocConfig.Builder.create()
.backgroundMode(CaocConfig.BACKGROUND_MODE_SILENT) //default: CaocConfig.BACKGROUND_MODE_SHOW_CUSTOM
.enabled(!BuildConfig.DEBUG)//是否启用CustomActivityOnCrash崩溃拦截机制 必须启用!不然集成这个库干啥???
.showErrorDetails(false) //是否必须显示包含错误详细信息的按钮 default: true
.showRestartButton(false) //是否必须显示“重新启动应用程序”按钮或“关闭应用程序”按钮default: true
.logErrorOnRestart(false) //是否必须重新堆栈堆栈跟踪 default: true
.trackActivities(true) //是否必须跟踪用户访问的活动及其生命周期调用 default: false
.minTimeBetweenCrashesMs(20000) //应用程序崩溃之间必须经过的时间 default: 3000
.restartActivity(SplashActivity::class.java) // 重启的activity
.errorActivity(SplashActivity::class.java)
.apply()
}
}
//初始化MNCrashMonitor class InitMNCrashMonitor : Task(TASK_ID, false) { companion object { const val TASK_ID = "2" }
override fun run(name: String) {
}
}
//初始化 AppsFlyer class InitAppsFlyer : Task(TASK_ID, false) { companion object { const val TASK_ID = "3" }
override fun run(name: String) {
AppsFlyerLib.getInstance().setAppInviteOneLink("FuDz")
val conversionDataListener: AppsFlyerConversionListener =
object : AppsFlyerConversionListener {
fun onInstallConversionDataLoaded(map: Map<String?, String?>?) {}
fun onInstallConversionFailure(s: String?) {}
override fun onConversionDataSuccess(map: Map<String, Any>) {}
override fun onConversionDataFail(s: String) {}
override fun onAppOpenAttribution(map: Map<String, String>) {}
override fun onAttributionFailure(s: String) {}
}
AppsFlyerLib.getInstance()
.init(BaseApplication.AF_DEV_KEY, conversionDataListener, BaseApplication.getContext())
AppsFlyerLib.getInstance().start(BaseApplication.getContext())
}
}
//初始化FrontBack class InitFrontBack : Task(TASK_ID, true) { companion object { const val TASK_ID = "4" }
override fun run(name: String) {
//前后
if (BaseApplication.appFrontBackHelper == null) {
BaseApplication.appFrontBackHelper = AppFrontBackHelper()
BaseApplication.appFrontBackHelper.register(
BaseApplication.mApplication,
object : OnAppStatusListener {
override fun onFront() {
BaseApplication.appIsFront = true
}
override fun onBack() {
BaseApplication.appIsFront = false
}
})
}
}
}
//初始化facebook class InitFaceBook : Task(TASK_ID, true) { companion object { const val TASK_ID = "5" }
override fun run(name: String) {
FacebookSdk.setApplicationId(
BaseApplication.getContext().getString(R.string.facebook_app_id)
)
FacebookSdk.sdkInitialize(BaseApplication.getContext())
AppEventsLogger.activateApp(BaseApplication.getContext())
FacebookSdk.setIsDebugEnabled(true)
FacebookSdk.addLoggingBehavior(LoggingBehavior.APP_EVENTS)
}
}
//初始化AdId class InitAdId : Task(TASK_ID, true) { companion object { const val TASK_ID = "6" }
override fun run(name: String) {
if (TextUtils.isEmpty(MmkvUtil.decodeString(MmkvBaseContant.Ad_Id, ""))) {
DeviceUtils.createAdId(BaseApplication.getContext())
}
}
}
//初始化Klarna class InitKlarna : Task(TASK_ID, true) { companion object { const val TASK_ID = "7" }
override fun run(name: String) {
// KlarnaMobileSDKCommon.setLoggingLevel(KlarnaLoggingLevel.Verbose)
}
}
//初始化吐司框架 class InitToast : Task(TASK_ID, true) { companion object { const val TASK_ID = "8" }
override fun run(name: String) {
ToastUtils.init(BaseApplication.mApplication)
}
}
//初始化 forter包赔服务 class InitForterPay : Task(TASK_ID, false) { companion object { const val TASK_ID = "9" }
override fun run(name: String) {
val mobileId = ForterIntegrationUtils.getDeviceUID(BaseApplication.getContext())
KlogUtils.e("当前的mobileId:" + mobileId)
val ftr = ForterSDK.getInstance()
ftr.setDevLogsEnabled(true)
ftr.init(
BaseApplication.mApplication,
AppConstants.FORTER_SITE_ID,
mobileId // Provide your mobile device Unique ID
)
BaseApplication.mApplication.registerActivityLifecycleCallbacks(ftr.activityLifecycleCallbacks)
ftr.trackAction(TrackType.APP_ACTIVE)
}
}
class AppTaskSdkFactory : Project.TaskFactory(TaskSdkCreatorer)
v1.1.8已修复
Caused by: java.lang.IllegalArgumentException at java.util.concurrent.ThreadPoolExecutor.(ThreadPoolExecutor.java:1302)
at java.util.concurrent.ThreadPoolExecutor.(ThreadPoolExecutor.java:1224)
at com.effective.android.anchors.AnchorThreadPool.(AnchorThreadPool.kt:29)
at com.effective.android.anchors.AnchorsRuntime.(AnchorsRuntime.kt:51)
at com.effective.android.anchors.AnchorsManager.(AnchorsManager.kt:28)
at com.effective.android.anchors.AnchorsManager.(AnchorsManager.kt:19)
at com.effective.android.anchors.AnchorsManager$Companion.getInstance(AnchorsManager.kt:35)
at com.effective.android.anchors.AnchorsManager$Companion.getInstance$default(AnchorsManager.kt:34)
at com.effective.android.anchors.AnchorsManager.getInstance(Unknown Source:4)