导入SDK所需jar包和so包
Android Studio
引用jar、aar
将libs目录下的jar文件复制、粘贴到项目工程的Application Module的libs目录中;
右键点击jar文件,并点击弹出菜单中的“Add As Library”并将jar文件作为类库添加到项目中
引用so文件
在项目工程的Application Module的src/main目录中新建名为“jniLibs”的目录;
将libs目录拷贝到“jniLibs”目录内
配置
1.打开AndroidManifest.xml,添加SDK需要的权限到
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<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_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.READ_PHONE_STATE” />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<!-- //部分手机(如小米等)需要将下面两个权限添加进去,蓝牙功能才能正常使用-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
2.在 application module的build.gradle引用sdk所需第三方库
dependencies {
compile 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'io.socket:socket.io-client:0.8.3'
}
3.混淆过滤
-keep class com.talkfun.**{*;}
#socket.io
-keep class io.socket.**{*;}
-keep interface io.socket.** { *; }
#retrofit
-dontwarn retrofit.**
-keep class retrofit.** { *; }
-keep interface retrofit.** { *; }
-keepattributes Signature
-keepattributes Exceptions
#glide
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
#agora
-keep class io.agora.**{*;}
#ftp
-keep class it.sauronsoftware.ftp4j.**{*;}
#alibaba oss
-keep class com.alibaba.sdk.android.oss.**{*;}
#kcp
-keep class kcpclient.** { *; }
-keep class go.** { *; }
#Quic
-keep class com.wangsu.quicsdk.**{*;}
-keep class com.wangsu.proxy.quicsdk.**{*;}
-keep class com.wangsu.muf.**{*;}
#xlog
-keep class com.tencent.mars.xlog.** { *; }
-keep class com.tencent.mars.comm.* { *; }
-keep class com.tencent.mars.app.* { *; }