Help Center/Details/

SDK Embedding Configuration

Android integration

Note: This version of the SDK is not applicable to Android stores/channels outside of China. If developers have overseas data connection needs, please send an email to to get the correct overseas exclusive Android SDK version for connection.

SDK integration

Application CodeId

Please create the application ID and advertising slot ID on the CSJ platform

Method 1: Import the jar packages that aar and SDK depend on

Copy the open_ad_sdk.aar in the SDK compressed package to the Application Module/libs folder (if not, you must create it manually), and add the following code to your app’s build.gradle:

repositories {
    flatDir {
        dirs 'libs'
depedencies {
    compile(name: 'open_ad_sdk', ext: 'aar')

Way two:

Starting from version of CSJ, developers can also use Gradle dependencies to import CSJ SDK

Step 1: Add a warehouse
Add a reference to Maven in the build.gradle file at the project level, url''

allprojects {
    repositories {
        maven {
          url ''

Step 2: Add dependencies
Add SDK dependencies to the build.gradle file of the main module

dependencies {
    implementation ''

Special note
If you are integrating the CSJ Pro version of the SDK, you can introduce the SDK in the following ways

// rep
maven {
          url ''
// dependencies
dependencies {
    implementation ''

Gradle version requirements:
Since version 3400, CSJ support Android R, and the <queries data-tomark-pass=""> tag of Android R is introduced. The gradle version needs to be restricted. The restricted range is: 3.3.3, 3.4.3, 3.5.4, 3.6.4, 4.0. 1. Developers can upgrade according to their own circumstances</queries>

AndroidManifest configuration

Add permissions

<uses-permission android:name="android.permission.INTERNET"  data-tomark-pass />

<permission      android:name="${applicationId}.openadsdk.permission.TT_PANGOLIN"
        android:protectionLevel="signature"  data-tomark-pass />

    <uses-permission android:name="${applicationId}.openadsdk.permission.TT_PANGOLIN"  data-tomark-pass /> 

<uses-permission android:name="android.permission.READ_PHONE_STATE"  data-tomark-pass />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"  data-tomark-pass />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"  data-tomark-pass />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"  data-tomark-pass />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"  data-tomark-pass />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" data-tomark-pass />
<uses-permission android:name="android.permission.GET_TASKS" data-tomark-pass />

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"  data-tomark-pass />

<!-- 如果视频广告使用textureView播放,请务必添加,否则黑屏 -->
<uses-permission android:name="android.permission.WAKE_LOCK"  data-tomark-pass />

<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT"  data-tomark-pass />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"  data-tomark-pass />
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR"  data-tomark-pass />

<!-- 穿山甲3400版本新增:建议添加“query_all_package”权限,穿山甲将通过此权限在Android R系统上判定广告对应的应用是否在用户的app上安装,避免投放错误的广告,以此提高用户的广告体验。若添加此权限,需要在您的用户隐私文档中声明! -->
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" data-tomark-pass />

Note: The CSJ SDK does not compulsorily obtain the above permissions, and the SDK can run normally even if the optional permissions are not obtained; obtaining the above permissions will help CSJ optimize the advertising accuracy and user interaction experience, and improve eCPM.
It is recommended to call the method provided by the SDK at an appropriate time before the ad request, and obtain the permission in the statement when the user can authorize, so as to improve the efficiency of ad monetization

void requestPermissionIfNecessary(Context context);

provider configuration

(1) In order not to affect the use of download type advertisements, the provider needs to be configured normally in the manifest file regardless of the APP at any stage
(2) In order not to affect the conversion and revenue of the advertisement, please be sure to configure xxx.TTMultiProvider in the manifest file
Adapt to Anroid7.0 and above
If your application needs to run in Anroid7.0 and above, please add the following code in AndroidManifest:

    android:grantUriPermissions="true" data-tomark-pass >
        android:resource="@xml/file_paths"  data-tomark-pass />

In the res/xml directory, create a new xml file file_paths, and add the following code to the file:

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="" data-tomark-pass >
   <!--为了适配所有路径可以设置 path = "." -->
   <external-path name="tt_external_root" path="."  data-tomark-pass />
   <external-path name="tt_external_download" path="Download"  data-tomark-pass />
   <external-files-path name="tt_external_files_download" path="Download"  data-tomark-pass />
   <files-path name="tt_internal_file_download" path="Download"  data-tomark-pass />
   <cache-path name="tt_internal_cache_download" path="Download"  data-tomark-pass />

In order to adapt to download and install related functions, the package referenced in the project is
Use 24.2.0 and above
Note: Single process or multiple processes must be configured

android:name="com.bytedance.sdk.openadsdk.multipro.TTMultiProvider"   android:authorities="${applicationId}.TTMultiProvider"   android:exported="false"  data-tomark-pass />

Operating environment configuration

This SDK can run on Android4.0 (API Level 14) and above.

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="24"  data-tomark-pass />

If the developer declares that the targetSdkVersion is above API 23, please make sure that you have applied for all the permissions required by the SDK before calling any interface of this SDK, otherwise some features of the SDK may be restricted

Code obfuscation

If you need to use proguard to obfuscate the code, make sure not to obfuscate the SDK code. Please add the following configuration at the end of the proguard.cfg file (or other obfuscated files):

The obfuscation rules for 35xx and the following versions are as follows:

-keep class com.bytedance.sdk.openadsdk.** { *; }
-keep public interface com.bytedance.sdk.openadsdk.downloadnew.** {*;}
-keep class com.pgl.sys.ces.* {*;}
-keep class com.bytedance.embed_dr.** {*;}
-keep class com.bytedance.embedapplog.** {*;}

The obfuscation rules for versions 36xx-38xx are as follows:

-keep class com.bytedance.sdk.openadsdk.** { *; }
-keep public interface com.bytedance.sdk.openadsdk.downloadnew.** {*;}
-keep class**{*;}
-keep class com.bytedance.mobsec.**{*;} 
-keep class com.bytedance.embed_dr.** {*;}
-keep class com.bytedance.embedapplog.** {*;}
-keep interface* {*;}
-keepnames class com.bytedance.framwork.core.sdkmonitor.SDKMonitorUtils

The obfuscation rules for version 3900 and above are as follows:

-keep class com.bytedance.sdk.openadsdk.** { *; }
-keep class com.bytedance.frameworks.** { *; }

-keep class**{*;}
-keep class**{*;}

-keep class**{*;}

-keep class com.bytedance.embedapplog.** {*;}
-keep class com.bytedance.embed_dr.** {*;}

-keep class com.bykv.vk.** {*;}

Note: If the SDK code is obfuscated, it will cause ads to not be displayed or other abnormalities
Support structure
Note: The SDK of 3900 and above versions supports armeabi-v7a and arm64-v8a by default. If you have other architecture requirements, please contact technical support students; the so file used in SDK versions below 3900 supports five architectures: x86, x86_64, armeabi, armeabi-v7a, arm64-v8a if your application
The supported architectures exceed these five, please use abiFilters in build.gradle to select the supported architectures. As shown below:

ndk { // 设置支持的 SO 库构架,注意这里要根据你的实际情况来设置 
   abiFilters 'armeabi-v7a', 'arm64-v8a', x86', x86_64', 'armeabi'


  1. The library was added to CSJ in version 3600.
  2. If the developer of version 3600 uses the armeabi architecture, then you need to copy the'' under armeabi-v7a to the armeabi directory for use.

Whitelist configuration

Note: The resources on the whitelist.txt in the platform SDK package do not support obfuscation

Did the content solve your problem?
Contact us