0x02 Certificate for <x.x.x> doesn’t match any of the subject alternative names
在执行gradlew命令打包时遇到这个错误,肯定是https证书有问题。
解决方案:如果支持http的话就使用http
1 2 3 4 5 6 7 8 9
> Could not resolve com.bytedanceapi:ttsdk-ttmp:1.36.2.25.pcdn. Required by: project :player > com.bytedanceapi:ttsdk-player_premium:1.36.2.25.pcdn > com.bytedanceapi:ttsdk-ttplayer:1.36.2.25.pcdn > Could not resolve com.bytedanceapi:ttsdk-ttmp:1.36.2.25.pcdn. > Could not get resource 'https://artifact.bytedance.com/repository/Volcengine/com/bytedanceapi/ttsdk-ttmp/1.36.2.25.pcdn/ttsdk-ttmp-1.36.2.25.pcdn.pom'. > Could not GET 'https://artifact.bytedance.com/repository/Volcengine/com/bytedanceapi/ttsdk-ttmp/1.36.2.25.pcdn/ttsdk-ttmp-1.36.2.25.pcdn.pom'. > Certificate for <artifact.bytedance.com> doesn't match any of the subject alternative names: [*.alicdn.com, *.cmos.greencompute.org, cmos.greencompute.org, m.intl.taob ao.com, *.mobgslb.tbcache.com, alikunlun.com, *.alikunlun.com, s.tbcdn.cn, *.django.t.taobao.com, alicdn.com]
java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/0/DCIM/Camera/**.jpeg at androidx.core.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:800) at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:442) at com.luck.picture.lib.tools.PictureFileUtils.parUri(PictureFileUtils.java:533) at com.luck.picture.lib.PictureBaseActivity.startOpenCameraImage(PictureBaseActivity.java:705) at com.luck.picture.lib.PictureSelectorActivity.startCamera(PictureSelectorActivity.java:926) at com.luck.picture.lib.PictureSelectorActivity.onTakePhoto(PictureSelectorActivity.java:1473) at com.luck.picture.lib.adapter.PictureImageGridAdapter.lambda$onBindViewHolder$0$PictureImageGridAdapter(PictureImageGridAdapter.java:155) at com.luck.picture.lib.adapter.-$$Lambda$PictureImageGridAdapter$0EODmJcP4VP0lqmkEhQ1dzLbHi8.onClick(Unknown Source:2) at android.view.View.performClick(View.java:6608) at android.view.View.performClickInternal(View.java:6585) at android.view.View.access$3100(View.java:785) at android.view.View$PerformClick.run(View.java:25921) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:201) at android.app.ActivityThread.main(ActivityThread.java:6810) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873) Back traces end.
java.lang.IllegalStateException: FragmentManager is already executing transactions at androidx.fragment.app.FragmentManager.ensureExecReady(FragmentManager.java:1778) at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1814) at androidx.fragment.app.BackStackRecord.commitNow(BackStackRecord.java:297)
at androidx.viewpager2.adapter.FragmentStateAdapter.removeFragment(FragmentStateAdapter.java:464) at androidx.viewpager2.adapter.FragmentStateAdapter.gcFragments(FragmentStateAdapter.java:228) at androidx.viewpager2.adapter.FragmentStateAdapter.restoreState(FragmentStateAdapter.java:569) at androidx.viewpager2.widget.ViewPager2.restorePendingState(ViewPager2.java:350) at androidx.viewpager2.widget.ViewPager2.dispatchRestoreInstanceState(ViewPager2.java:375)
at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3829) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3829) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3829) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3829) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3829)
at android.view.View.restoreHierarchyState(View.java:18613)
at androidx.fragment.app.Fragment.restoreViewState(Fragment.java:573) at androidx.fragment.app.FragmentStateManager.restoreViewState(FragmentStateManager.java:356) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1189) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1356) at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1434) at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1497) at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2625) at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:2577)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:247)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:541) at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:210) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1392) at android.app.Activity.performStart(Activity.java:7260) at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3009)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180) at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1840) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:6878) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)
解决方案
如果在 Fragment 中使用 ViewPager2,那么 FragmentStateAdapter 应该使用 childFragmentManager。将
overridefuncreateViewPagerAdapter(): RecyclerView.Adapter<*> { val items = items // avoids resolving the ViewModel multiple times returnobject : FragmentStateAdapter(this) { overridefuncreateFragment(position: Int): PageFragment { val itemId = items.itemId(position) val itemText = items.getItemById(itemId) return PageFragment.create(itemText) } overridefungetItemCount(): Int = items.size overridefungetItemId(position: Int): Long = items.itemId(position) overridefuncontainsItem(itemId: Long): Boolean = items.contains(itemId) } }
/** A very simple collection of items. Optimized for simplicity (i.e. not performance). */ classItemsViewModel : ViewModel() { privatevar nextValue = 1L
java.lang.IllegalStateException: Design assumption violated. at androidx.viewpager2.widget.ViewPager2.updateCurrentItem(ViewPager2.java:538) at androidx.viewpager2.widget.ViewPager2$4.onAnimationsFinished(ViewPager2.java:518) at androidx.recyclerview.widget.RecyclerView$ItemAnimator.isRunning(RecyclerView.java:13244) at androidx.viewpager2.widget.ViewPager2.onLayout(ViewPager2.java:515) at android.view.View.layout(View.java:15596)
/** * Layout to wrap a scrollable component inside a ViewPager2. Provided as a solution to the problem * where pages of ViewPager2 have nested scrollable elements that scroll in the same direction as * ViewPager2. The scrollable element needs to be the immediate and only child of this host layout. * * This solution has limitations when using multiple levels of nested scrollable elements * (e.g. a horizontal RecyclerView in a vertical RecyclerView in a horizontal ViewPager2). */ classNestedScrollableHost : FrameLayout { constructor(context: Context) : super(context) constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
privatevar touchSlop = 0 privatevar initialX = 0f privatevar initialY = 0f privateval parentViewPager: ViewPager2? get() { var v: View? = parent as? View while (v != null && v !is ViewPager2) { v = v.parent as? View } return v as? ViewPager2 }
privatefunhandleInterceptTouchEvent(e: MotionEvent) { val orientation = parentViewPager?.orientation ?: return
// Early return if child can't scroll in same direction as parent if (!canChildScroll(orientation, -1f) && !canChildScroll(orientation, 1f)) { return }
if (e.action == MotionEvent.ACTION_DOWN) { initialX = e.x initialY = e.y parent.requestDisallowInterceptTouchEvent(true) } elseif (e.action == MotionEvent.ACTION_MOVE) { val dx = e.x - initialX val dy = e.y - initialY val isVpHorizontal = orientation == ORIENTATION_HORIZONTAL
// assuming ViewPager2 touch-slop is 2x touch-slop of child val scaledDx = dx.absoluteValue * if (isVpHorizontal) .5felse1f val scaledDy = dy.absoluteValue * if (isVpHorizontal) 1felse.5f
if (scaledDx > touchSlop || scaledDy > touchSlop) { if (isVpHorizontal == (scaledDy > scaledDx)) { // Gesture is perpendicular, allow all parents to intercept parent.requestDisallowInterceptTouchEvent(false) } else { // Gesture is parallel, query child if movement in that direction is possible if (canChildScroll(orientation, if (isVpHorizontal) dx else dy)) { // Child can scroll, disallow all parents to intercept parent.requestDisallowInterceptTouchEvent(true) } else { // Child cannot scroll, allow all parents to intercept parent.requestDisallowInterceptTouchEvent(false) } } } } } }
classPreviewPagesActivity : FragmentActivity() { overridefunonCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_viewpager2) findViewById<ViewPager2>(R.id.view_pager).apply { // Set offscreen page limit to at least 1, so adjacent pages are always laid out offscreenPageLimit = 1 val recyclerView = getChildAt(0) as RecyclerView recyclerView.apply { clipToPadding = false val leftPadding = resources.getDimensionPixelOffset(R.dimen.halfPageMargin) + resources.getDimensionPixelOffset(R.dimen.peekOffset) // setting padding on inner RecyclerView puts overscroll effect in the right place // TODO: expose in later versions not to rely on // getChildAt(0) which might break setPadding(leftPadding, 0, leftPadding, 0) } adapter = Adapter() } }
java.lang.IllegalStateException: Fragment no longer exists for key f1: unique id 55efaee5-a65c-4e57-9281-7c8f8f6e4156 at androidx.fragment.app.FragmentManager.getFragment(FragmentManager.java:960) at androidx.fragment.app.FragmentStatePagerAdapter.restoreState(FragmentStatePagerAdapter.java:328) at androidx.viewpager.widget.ViewPager.onRestoreInstanceState(ViewPager.java:1461) at android.view.View.dispatchRestoreInstanceState(View.java:20032) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3922) at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3928) at android.view.View.restoreHierarchyState(View.java:20010) at androidx.fragment.app.Fragment.restoreViewState(Fragment.java:639) at androidx.fragment.app.Fragment.restoreViewState(Fragment.java:3010) at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:3001) at androidx.fragment.app.FragmentStateManager.activityCreated(FragmentStateManager.java:580) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:285) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002) at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:230) at android.app.ActivityThread.main(ActivityThread.java:8018) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:526) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)
java.lang.IllegalArgumentException: Called attach on a child which is not detached: BaseViewHolder{2b241e1 position=12 id=-1, oldPos=-1, pLpos:-1} androidx.recyclerview.widget.RecyclerView{afecb06 VFED..... ......ID 0,0-1080,2055 #7f09236e app:id/recycler_view_xxx}, adapter:com.xxxx.adapter.XxxAdapter@cfc75c7, layout:androidx.recyclerview.widget.LinearLayoutManager@24af7f4, context:com.xxxx.XxxActivity@1ed75e2 at androidx.recyclerview.widget.RecyclerView$5.attachViewToParent(RecyclerView.java:917) at androidx.recyclerview.widget.ChildHelper.attachViewToParent(ChildHelper.java:239) at androidx.recyclerview.widget.RecyclerView.addAnimatingView(RecyclerView.java:1438) at androidx.recyclerview.widget.RecyclerView.animateDisappearance(RecyclerView.java:4377) at androidx.recyclerview.widget.RecyclerView$4.processDisappeared(RecyclerView.java:616) at androidx.recyclerview.widget.ViewInfoStore.process(ViewInfoStore.java:242) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:4210) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3864) at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4410) at android.view.View.layout(View.java:22213) at android.view.ViewGroup.layout(ViewGroup.java:6340) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1131) at android.view.View.layout(View.java:22213) at android.view.ViewGroup.layout(ViewGroup.java:6340) at androidx.viewpager.widget.ViewPager.onLayout(ViewPager.java:1775) at android.view.View.layout(View.java:22213) at android.view.ViewGroup.layout(ViewGroup.java:6340) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:22213) at android.view.ViewGroup.layout(ViewGroup.java:6340) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1131) at android.view.View.layout(View.java:22213) at android.view.ViewGroup.layout(ViewGroup.java:6340) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22213) at android.view.ViewGroup.layout(ViewGroup.java:6340) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:22213) at android.view.ViewGroup.layout(ViewGroup.java:6340) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22213) at android.view.ViewGroup.layout(ViewGroup.java:6340) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:22213) at android.view.ViewGroup.layout(ViewGroup.java:6340) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at com.android.internal.policy.DecorView.onLayout(DecorView.java:905) at android.view.View.layout(View.java:22213) at android.view.ViewGroup.layout(ViewGroup.java:6340) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3286) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2757) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1865) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7933) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1018) at android.view.Choreographer.doCallbacks(Choreographer.java:837) at android.view.Choreographer.doFrame(Choreographer.java:767) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1003) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:230) at android.app.ActivityThread.main(ActivityThread.java:7951) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:526) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)
问题分析
对同一个 position 位置同时进行notifyItemRemoved(position) 和 notifyItemInserted(position) 操作导致。
Thread Name: 'main' java.lang.RuntimeException: Parcel android.os.Parcel@bbfcc04: Unmarshalling unknown type code 2131296928 at offset 1088 at android.os.Parcel.readValue(Parcel.java:2750) at android.os.Parcel.readSparseArrayInternal(Parcel.java:3126) at android.os.Parcel.readSparseArray(Parcel.java:2354) at android.os.Parcel.readValue(Parcel.java:2728) at android.os.Parcel.readArrayMapInternal(Parcel.java:3045) at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:288) at android.os.BaseBundle.unparcel(BaseBundle.java:232) at android.os.Bundle.getSparseParcelableArray(Bundle.java:1010) at com.android.internal.policy.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2133) at android.app.Activity.onRestoreInstanceState(Activity.java:1173) at android.app.Activity.performRestoreInstanceState(Activity.java:1128) at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1318) at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3025) at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180) at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1840) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:6878) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)
java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 542688 bytes at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:160) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:6878) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876) Caused by: android.os.TransactionTooLargeException: data parcel size 542688 bytes at android.os.BinderProxy.transactNative(Native Method) at android.os.BinderProxy.transact(BinderProxy.java:479) at android.app.IActivityManager$Stub$Proxy.activityStopped(IActivityManager.java:3941) at java.lang.reflect.Method.invoke(Native Method) at com.taobao.monitor.impl.common.c.invoke(ActivityManagerHook.java:89) at java.lang.reflect.Proxy.invoke(Proxy.java:1006) at $Proxy2.activityStopped(Unknown Source) at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:144) ... 7 more android.os.TransactionTooLargeException: data parcel size 542688 bytes at android.os.BinderProxy.transactNative(Native Method) at android.os.BinderProxy.transact(BinderProxy.java:479) at android.app.IActivityManager$Stub$Proxy.activityStopped(IActivityManager.java:3941) at java.lang.reflect.Method.invoke(Native Method) at com.taobao.monitor.impl.common.c.invoke(ActivityManagerHook.java:89) at java.lang.reflect.Proxy.invoke(Proxy.java:1006) at $Proxy2.activityStopped(Unknown Source) at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:144) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:6878) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)