美文网首页
androidx下集成腾讯Bugly记

androidx下集成腾讯Bugly记

作者: 孤诣 | 来源:发表于2020-04-16 15:48 被阅读0次

集成腾讯Bugly使用自动升级

配置build.gradle

android {
    defaultConfig {
        ndk {
            //设置支持的SO库架构
//            abiFilters 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
            abiFilters 'armeabi-v7a'
        }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    // androidx ...
    // Android 7.0及以上 FileProvider
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    // tencent bugly
    implementation 'com.tencent.bugly:crashreport_upgrade:latest.release'
    implementation 'com.tencent.bugly:nativecrashreport:latest.release'
}

配置AndroidManifest.xml

    <application
        android:networkSecurityConfig="@xml/network_security_config" <!--适配Android 9.0及以上-->
        tools:ignore="UnusedAttribute">
        <!--适配Android 7.0及以上-->
        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.fileProvider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
        </provider>
    </application>

资源目录xml下新增 network_security_config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">android.bugly.qq.com</domain>
    </domain-config>
</network-security-config>

初始化

Bugly.init(getApplicationContext(), "********", false);

相关文章

网友评论

      本文标题:androidx下集成腾讯Bugly记

      本文链接:https://www.haomeiwen.com/subject/ynorvhtx.html