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]
privatefuninitPlayerView(playerView: StyledPlayerView) { Log.d(TAG, "initPlayerView: ") player = ExoPlayer.Builder(requireContext()).build() player?.addListener(listener) // Bind the player to the view. playerView.player = player
// back playerView.findViewById<View>(R.id.back).setOnClickListener { fragmentManager?.popBackStack() val ft = fragmentManager?.beginTransaction() ft?.remove(this@ExoPlayerFragment) ft?.commitAllowingStateLoss() } }
privatevar prepareTime: Long = 0L privatefunprintPlayerTimeLine(method: String) { val c = System.currentTimeMillis() val duration = if (prepareTime == 0L) 0else c - prepareTime prepareTime = c Log.i(TAG, "printPlayerTimeLine: method=$method, duration=$duration, uri=${videoUri}") }
privatefunstartPlay() { Log.d(TAG, "startPlay: ") videoUri?.let { // Build the media item. val mediaItem: MediaItem = MediaItem.fromUri(it)
// Set the media item to be played. player?.setMediaItem(mediaItem)
// Prepare the player. player?.prepare() printPlayerTimeLine("player->prepare:")
// Start the playback. player?.play() // calPlayerTimeLine("player->play:") } }
// 该方法需要在View完全被绘制出来之后调用 @JvmStatic privatefunisNavigationBarVisible(activity: Activity): Boolean { val vp = activity.window.decorView as ViewGroup? if (vp != null) { for (i in0 until vp.childCount) { vp.getChildAt(i).context.packageName if (vp.getChildAt(i).id !== View.NO_ID && NAVIGATION == activity.resources.getResourceEntryName(vp.getChildAt(i).id) ) { returntrue } } } returnfalse }
/** * 获取屏幕的物理大小 px */ @JvmStatic fungetDeviceScreenSize(context: Context): Point { val appContext = context.applicationContext val wm = appContext.getSystemService(Context.WINDOW_SERVICE) as WindowManager val point = Point(0, 0) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { wm.defaultDisplay.getRealSize(point) } else { wm.defaultDisplay.getSize(point) } return point }
/** * 获取显示屏幕的宽高 px */ @JvmStatic fungetDisplaySize(context: Context): Point { val point = Point(0, 0) val dm = context.applicationContext.resources.displayMetrics point.x = dm.widthPixels point.y = dm.heightPixels return point } }