当前位置:网站首页>Youmeng (a good helper for real-time monitoring of software exceptions: crash) access tutorial (the easiest tutorial for Xiaobai with some foundation)
Youmeng (a good helper for real-time monitoring of software exceptions: crash) access tutorial (the easiest tutorial for Xiaobai with some foundation)
2022-07-01 02:30:00 【Xingchen Beitian】
umeng ( A good helper for real-time monitoring of software exceptions :Crash) Access tutorial
This access is different from the last one XBanner Somewhat different ( More than a buildscript The operation of ), Please read... Patiently
Confusion and other operations will not be demonstrated , Not yet , Send it again next time
The documents used this time :https://developer.umeng.com/docs/119267/detail/118584
Register Youmeng account
Add apps to the personal center ( There are many ways )

Fill in the application information , These products are enough

Add an icon to facilitate the uploading of application icons by Youmeng ( Just find a picture by yourself )
Ali is recommended here icon Icon Library :https://www.iconfont.cn/
Self taking

Create a project , And replace the application icon
Name it app.png Auto replace ()

add to Maven And dependence
This link ( Add recommended documents after application ) No more. , Just use the above documentation

The point is this !!!( Xiaobai, please pay attention here ) There are actually two pieces of configuration code ( Separate as follows )
build.gradle Code
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://repo1.maven.org/maven2/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
maven Library code
Old rules , This thing needs to be added to the total projectOfsettings.gradleUse in ( Delete the duplicate by yourself )
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://repo1.maven.org/maven2/' }
}
}
Add dependency
(
DifferenceThere it is !!!) Here isengineering build.gradleit is to be noted that , yesapp Under the table of contentsOf , Not in the whole project ( and AS Regulationsbuildscript Must be in plugins Before using ( add to )!!!!!)


// Statistics of the Alliance SDK
implementation 'com.umeng.umsdk:common:9.4.7'// Mandatory
implementation 'com.umeng.umsdk:asms:1.4.1'// Mandatory
implementation 'com.umeng.umsdk:apm:1.5.2' // Upgrade error analysis to standalone SDK, see crash Data must be integrated , Optional
Create global variables APP class (Aplication)

APP.java
Initialize the Alliance
Channel Names follow the rules , Whatever the , The two points are consistent

I added comments in the following code
import android.app.Application;
import com.umeng.commonsdk.UMConfigure;
public class APP extends Application {
@Override
public void onCreate() {
super.onCreate();
// Set up LOG switch , The default is false
UMConfigure.setLogEnabled(true);
/* Channel Naming conventions for channels It can be composed of English letters 、 Arabic numerals 、 Underline 、 Center line 、 Space 、 Brackets make up , It can contain Chinese characters and other plaintext characters , However, Chinese naming is not recommended , There will be garbled code . The first and last characters cannot be spaces . Don't use pure numbers as a channel ID. most 256 Characters . “unknown” And its various case forms , As 【 umeng +】 Reserved fields , Cannot be used as channel name .*/
// Alliance pre initialization
UMConfigure.preInit(getApplicationContext(), " Yours appkey", "Umeng");// there Umeng Whatever the , Just be consistent with the following
// The alliance is really initialized
UMConfigure.init(this, " Yours appkey", "Umeng", UMConfigure.DEVICE_TYPE_PHONE, "");
}
}
Configure permissions and global applications (APP class )

<!-- jurisdiction -->
<uses-sdk android:minSdkVersion="8"></uses-sdk>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
...
<!-- Global variable class , This should also be configured -->
android:name=".APP"
Add intent filter (intent-filter), And fill in your appkey

<intent-filter>
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="um. The app Corresponding appkey" />
</intent-filter>
Search again appkey Methods
Thank you here : Kefan loves programming (B Station users ,IU Browser developers ), Then I found it quickly , Ha ha ha
The official website of Youmeng > Personal center > Click the management above ( I won't show you my code , Hee hee , Just look at your own )

MainActivity.java Configuration of files
( Come on ! Write your own Bug Test it , I didn't expect to write it myself Bug A day of , Ha ha ha ha )
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
private int aA =1;// Define a dummy variable
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// There must be try...catch( Capture exception ) Otherwise, your software will collapse before Youmeng uploads it !!!!!!!!!!
try {
Button c = findViewById(aA);// Get fake id
c.setText(55);// Call some times, otherwise there will be no error
}catch (Exception e){
}
}
@Override
protected void onStart() {
super.onStart();
Log.e(" test "," It is said that this thing is not wrong ");
}
Take a look at the effect
After running you AS Of Run What will appear inside , See for yourself





The software at this time

Youmeng backstage at this time
Personal center > management > Click the application you added

Order this

The real-time monitoring function is required for the first time , Just click to open ( Because I forgot the screenshot , So I won't send any pictures , Ha ha ha ), If there is no error just after opening , Just run your APP, There will be
You can view it by sliding


OK 了
tip : This official document is useful AS Add... To the upper toolbar maven Method of library 
so Files are used to adapt to different devices , You can take what you want to learn
The pictures are added one by one , Please quote eldest brother ! Come on ! Do it. ! I won't stop you from praising ! Hee hee ~
边栏推荐
- import tensorflow.contrib.slim as slim报错
- Int and bit group turn to each other
- Find the length of the common part of two line segments
- js防抖和节流
- 最新微信ipad协议 CODE获取 公众号授权等
- 7_ Openresty installation
- Template: globally balanced binary tree
- Alphabet-Rearrange-Inator 3000(字典树自定义排序)
- SWT / anr problem - anr/je causes SWT
- Pychar open remote directory remote host
猜你喜欢
随机推荐
js中的图片预加载
Machine learning 9-universal approximator radial basis function neural network, examining PDA and SVM from a new perspective
Static domain and static method
Video tutorial | Chang'an chain launched a series of video tutorial collections (Introduction)
pycharm 软件deployment 灰色 无法点
Pychart software deployment gray unable to point
Rocketqa: cross batch negatives, de noised hard negative sampling and data augmentation
SWT/ANR问题--Dump时间过长导致的SWT
Template: globally balanced binary tree
使用ipmitool配置X86服务器的BMC网络和用户信息
Small program cloud development -- wechat official account article collection
SAP ALV汇总跟导出Excel 汇总数据不一致
SAP ALV summary is inconsistent with exported excel summary data
SWT / anr problem - SWT caused by long execution time of native method
SWT/ANR问题--Deadlock
centos 安装多个版本的php并切换
Some uses of Halcon array
SWT/ANR问题--StorageManagerService卡住
如何在智汀中实现智能锁与灯、智能窗帘电机场景联动?
现在开户有优惠吗?另外,手机开户安全么?








