Skip to content

Commit 6f54029

Browse files
committed
Fix bug.
1 parent 1e28a5e commit 6f54029

File tree

15 files changed

+226
-117
lines changed

15 files changed

+226
-117
lines changed

Demo/app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "com.tencent.liteav.demo"
99
minSdkVersion rootProject.ext.minSdkVersion
1010
targetSdkVersion rootProject.ext.targetSdkVersion
11-
versionCode 22
12-
versionName "9.1.1084"
11+
versionCode 14
12+
versionName "9.2.1029"
1313

1414
multiDexEnabled true
1515
ndk {
@@ -63,6 +63,6 @@ dependencies {
6363
exclude group: 'com.google.code.gson', module: 'gson'
6464
})
6565

66-
compile 'com.tencent.bugly:crashreport_upgrade:1.5.1'
67-
compile 'com.tencent.bugly:nativecrashreport:3.8.0'
66+
implementation 'com.tencent.rqd:crashreport:latest.release'
67+
implementation 'com.tencent.rqd:nativecrashreport:latest.release'
6868
}

Demo/app/proguard-rules.pro

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,28 @@
1919
# If you keep the line number information, uncomment this to
2020
# hide the original source file name.
2121
#-renamesourcefileattribute SourceFile
22-
-keep class com.tencent.** { *; }
22+
-keep class com.tencent.** { *; }
23+
24+
-dontwarn com.tencent.bugly.**
25+
-keep public class com.tencent.bugly.**{*;}
26+
27+
-keep public class * extends com.qq.taf.jce.JceStruct{*;}
28+
29+
#wup的协议包:
30+
-keep public class com.qq.jce.*{
31+
public * ;
32+
protected * ;
33+
}
34+
35+
#native jni接口
36+
-keepclasseswithmembernames class * {
37+
native <methods>;
38+
}
39+
40+
#native 回调接口
41+
-keep public interface com.tencent.feedback.eup.jni.NativeExceptionHandler{
42+
*;
43+
}
44+
-keep public class com.tencent.feedback.eup.jni.NativeExceptionUpload{
45+
*;
46+
}
Lines changed: 33 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
11
package com.tencent.liteav.demo;
22

3+
import android.app.ApplicationErrorReport;
4+
import android.content.Context;
35
import android.os.Build;
46
import android.os.StrictMode;
5-
import androidx.multidex.MultiDexApplication;
67
import android.util.Log;
78

8-
import com.tencent.bugly.Bugly;
9-
import com.tencent.bugly.beta.Beta;
10-
import com.tencent.bugly.beta.download.DownloadListener;
11-
import com.tencent.bugly.beta.download.DownloadTask;
12-
import com.tencent.bugly.beta.upgrade.UpgradeStateListener;
13-
import com.tencent.bugly.crashreport.CrashReport;
9+
import androidx.multidex.MultiDexApplication;
10+
11+
import com.tencent.feedback.anr.ANRReport;
12+
import com.tencent.feedback.eup.CrashReport;
1413
import com.tencent.rtmp.TXLiveBase;
1514

1615
import java.lang.reflect.Constructor;
1716
import java.lang.reflect.Field;
1817
import java.lang.reflect.Method;
1918

20-
//import com.squareup.leakcanary.LeakCanary;
21-
//import com.squareup.leakcanary.RefWatcher;
22-
23-
2419
public class DemoApplication extends MultiDexApplication {
25-
private static String TAG = "DemoApplication";
26-
private static final String BUGLY_APPID = ""; //配置bugly组件的appId
27-
private static final String BUGLY_APP_CHANNEL = ""; // 配置bugly组件的APP渠道号
28-
private static final boolean BUGLY_ENABLE_DEBUG = true; //配置bugly组件的调试模式(true或者false)
20+
private static String TAG = "DemoApplication";
2921

3022
// private RefWatcher mRefWatcher;
3123
private static DemoApplication instance;
@@ -34,15 +26,18 @@ public class DemoApplication extends MultiDexApplication {
3426
String licenceUrl = "请替换成您的licenseUrl";
3527
String licenseKey = "请替换成您的licenseKey";
3628

29+
private Context mAppContext;
3730
@Override
3831
public void onCreate() {
3932

4033
super.onCreate();
4134

35+
mAppContext = this.getApplicationContext();
4236
instance = this;
4337

44-
TXLiveBase.setConsoleEnabled(true);
45-
initBugly();
38+
// 蓝盾 RELEASE 版本下,去掉注释,打开 bugly oa 的上报功能; 代码如有改动,记得在脚本做相应修改。
39+
initBuglyOA();
40+
4641
TXLiveBase.getInstance().setLicence(instance, licenceUrl, licenseKey);
4742

4843
// 短视频licence设置
@@ -54,11 +49,6 @@ public void onCreate() {
5449
closeAndroidPDialog();
5550
}
5651

57-
// public static RefWatcher getRefWatcher(Context context) {
58-
// DemoApplication application = (DemoApplication) context.getApplicationContext();
59-
// return application.mRefWatcher;
60-
// }
61-
6252
public static DemoApplication getApplication() {
6353
return instance;
6454
}
@@ -84,56 +74,26 @@ private void closeAndroidPDialog() {
8474
}
8575
}
8676

87-
//配置bugly组件的APP ID,bugly组件为腾讯提供的用于crash上报,分析和升级的开放组件,如果您不需要该组件,可以自行移除
88-
private void initBugly() {
89-
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(getApplicationContext());
90-
strategy.setAppVersion(TXLiveBase.getSDKVersionStr());
91-
strategy.setAppChannel(BUGLY_APP_CHANNEL);
92-
//监听安装包下载状态
93-
Beta.downloadListener = new DownloadListener() {
94-
@Override
95-
public void onReceive(DownloadTask downloadTask) {
96-
}
97-
98-
@Override
99-
public void onCompleted(DownloadTask downloadTask) {
100-
Log.d(TAG, "downloadListener download apk file success");
101-
}
102-
103-
@Override
104-
public void onFailed(DownloadTask downloadTask, int i, String s) {
105-
Log.d(TAG, "downloadListener download apk file fail");
106-
}
107-
};
108-
109-
//监听APP升级状态
110-
Beta.upgradeStateListener = new UpgradeStateListener() {
111-
@Override
112-
public void onUpgradeFailed(boolean b) {
113-
Log.d(TAG, "upgradeStateListener upgrade failed");
114-
}
115-
116-
@Override
117-
public void onUpgradeSuccess(boolean b) {
118-
Log.d(TAG, "upgradeStateListener upgrade success");
119-
}
120-
121-
@Override
122-
public void onUpgradeNoVersion(boolean b) {
123-
Log.d(TAG, "upgradeStateListener upgrade has no new version");
124-
}
125-
126-
@Override
127-
public void onUpgrading(boolean b) {
128-
Log.d(TAG, "upgradeStateListener upgrading");
129-
}
130-
131-
@Override
132-
public void onDownloadCompleted(boolean b) {
133-
Log.d(TAG, "upgradeStateListener download apk file success");
134-
}
135-
};
136-
Bugly.init(getApplicationContext(), BUGLY_APPID, BUGLY_ENABLE_DEBUG, strategy);
77+
private void initBuglyOA() {
78+
Log.d(TAG, "LiteAVDemo initBuglyOA");
79+
CrashReport.setProductVersion(mAppContext, TXLiveBase.getSDKVersionStr());
80+
81+
/** 这条语句已经能让你的java端异常被捕获,并且上报了。BuglyOA 在后台通过包名和 App ID 匹配,buglyoa网站上 BundleId 须和包名保持一致。 */
82+
CrashReport.initCrashReport(mAppContext);
83+
String tombDirectoryPath = mAppContext.getDir("tomb", Context.MODE_PRIVATE).getAbsolutePath();
84+
/**
85+
* 前提是你需要先初始化java端异常上报功能,
86+
* 这条语句已经能让你的native端异常被捕获,并且上报了。
87+
*
88+
* @param context
89+
* @param tombDirectoryPath(也可以默认设置为空)
90+
* tomb文件的存放路径,tomb文件可以理解为详细的堆栈信息,平均每一个异常会产生一个tomb文件,
91+
* 平均10k
92+
* @param openNativeLog
93+
* 打开Native Log功能,true则输出debug级log,false则只有warn及error有log输出。
94+
*/
95+
CrashReport.initNativeCrashReport(mAppContext, tombDirectoryPath, true);
96+
// 开启ANR监控,注意ANR的初始化一定要放在native sdk初始化之后,否则不生效
97+
ANRReport.startANRMonitor(mAppContext);
13798
}
138-
13999
}

Demo/app/src/main/java/com/tencent/liteav/demo/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected void onCreate(Bundle savedInstanceState) {
5252
setContentView(R.layout.activity_main);
5353

5454
mTvVersion = (TextView) findViewById(R.id.main_tv_version);
55-
mTvVersion.setText(getString(R.string.app_tv_super_player_version, TXLiveBase.getSDKVersionStr()+"(9.1.1084)"));
55+
mTvVersion.setText(getString(R.string.app_tv_super_player_version, TXLiveBase.getSDKVersionStr()+"(9.2.1029)"));
5656

5757
mMainTitle = (TextView) findViewById(R.id.main_title);
5858
mMainTitle.setOnLongClickListener(new View.OnLongClickListener() {

Demo/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ if (!videoEngineSourcePath.isEmpty()) {
4848
}
4949

5050
ext {
51-
compileSdkVersion = 28
52-
buildToolsVersion = "26.0.2"
51+
compileSdkVersion = 29
52+
buildToolsVersion = "29.0.2"
5353
supportSdkVersion = "26.1.0"
5454
minSdkVersion = 19
5555
targetSdkVersion = 23

Demo/settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ include ':common'
66
include ':superplayerkit'
77
include ':superplayerdemo'
88

9+
910
if (!liteavSourcePath.isEmpty()) {
1011
apply from: new File(settingsDir, '../source_link_gradle/liteav_source_settings.gradle').getAbsolutePath()
1112
}

Demo/superplayerdemo/src/main/java/com/tencent/liteav/demo/player/demo/SuperPlayerActivity.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ private void playVideoModel(VideoModel videoModel) {
524524
} else if (!TextUtils.isEmpty(videoModel.fileid)) {
525525
superPlayerModelV3.videoId = new SuperPlayerVideoId();
526526
superPlayerModelV3.videoId.fileId = videoModel.fileid;
527+
superPlayerModelV3.videoId.pSign = videoModel.pSign;
527528
}
528529
mSuperPlayerView.playWithModel(superPlayerModelV3);
529530
}
@@ -701,6 +702,7 @@ private void showAddVideoDialog() {
701702

702703
final EditText etAppId = (EditText) dialogView.findViewById(R.id.superplayer_et_appid);
703704
final EditText etFileId = (EditText) dialogView.findViewById(R.id.superplayer_et_fileid);
705+
final EditText etPSign = (EditText) dialogView.findViewById(R.id.superplayer_et_psign);
704706

705707
if (mDataType == LIST_TYPE_VOD) {
706708
dialog.setTitle(getString(R.string.superplayer_set_appid_fileid));
@@ -709,6 +711,7 @@ private void showAddVideoDialog() {
709711
dialogView.findViewById(R.id.superplayer_tv_appid_text).setVisibility(GONE);
710712
dialogView.findViewById(R.id.superplayer_tv_fileid_text).setVisibility(GONE);
711713
etFileId.setVisibility(GONE);
714+
etPSign.setVisibility(GONE);
712715
}
713716

714717
dialog.setNegativeButton(getString(R.string.superplayer_cancel), new DialogInterface.OnClickListener() {
@@ -725,6 +728,7 @@ public void onClick(DialogInterface dialog, int which) {
725728
if (mDataType == LIST_TYPE_VOD) {
726729
String appId = etAppId.getText().toString();
727730
String fileId = etFileId.getText().toString();
731+
String pSign = etPSign.getText().toString();
728732

729733
if (TextUtils.isEmpty(appId)) {
730734
Toast.makeText(mContext, getString(R.string.superplayer_input_correct_appid), Toast.LENGTH_SHORT).show();
@@ -745,6 +749,7 @@ public void onClick(DialogInterface dialog, int which) {
745749
VideoModel videoModel = new VideoModel();
746750
videoModel.appid = appid;
747751
videoModel.fileid = fileId;
752+
videoModel.pSign = pSign;
748753

749754
// 尝试请求fileid信息
750755
SuperVodListLoader loader = new SuperVodListLoader();

Demo/superplayerdemo/src/main/java/com/tencent/liteav/demo/player/expand/model/entity/VideoModel.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ public class VideoModel {
3939
*/
4040
public String fileid;
4141

42+
/**
43+
* 签名字串
44+
*/
45+
public String pSign;
46+
4247
/**
4348
* VIDEO 不同清晰度的URL链接
4449
*/

0 commit comments

Comments
 (0)