常见问题
常见问题
此章节包含 Unity 平台接入插件时出现的常见问题与解决方案
请使用真机测试
SDK 不支持模拟器运行,需要使用真机进行调试
Android 硬件加速配置
Unity 在生成 APK 时,默认会关闭PlayerActivity
的硬件加速,导致视频类广告的播放异常。
SDK 默认在编译时通过Editor/ZJUnityAndroidManifestCallback.cs
中的EnableHardwareAccelerated()
方法开启了硬件加速。若此操作与您的项目配置冲突,可注释掉androidManifest.EnableHardwareAccelerated();
这一行代码
AndroidX支持
若项目已通过Export Project
方式导出为Android Studio
工程,并在导出的工程内启用了 AndroidX 特性(gradle.properties
中配置了android.useAndroidX=true
),需要调整当前工程:
- 将
Plugins/Android/mainTemplate.gradle
中dependencies
节点下的support-library
改为对应的AndroidX
版本:
apply plugin: 'com.android.library'
**APPLY_PLUGINS**
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
+ // AndroidX 工程需要添加
+ implementation 'androidx.appcompat:appcompat:1.1.0'
+ implementation 'com.google.android.material:material:1.1.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
- // Support Libraries // [!code --]
- implementation 'com.android.support:appcompat-v7:26.0.0'
- implementation "com.android.support:support-v4:26.0.0"
- implementation 'com.android.support.constraint:constraint-layout:2.0.4'
// 微信OPEN SDK
implementation 'com.tencent.mm.opensdk:wechat-sdk-android:6.8.28'
// TBS
implementation 'com.tencent.tbs:tbssdk:44286'
**DEPS**}
//......
将
Editor/ZJUnityAndroidManifestCallback.cs
中的androidManifest.sigprovider()
注释确保导出的 Android 工程根目录中
gradle.properties
内配置了enableJetifier=true
# gradle.properties android.enableJetifier=true android.useAndroidX=true