1.在build.gradle中集成听云.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath fileTree(dir: 'c:\\tingyun\\plugin', include: ['*.jar']) //在buildscript添加这行,地址换成自己的. 听云sdk的编译插件,不会嵌入在apk中.
}
}
repositories {
mavenCentral()
}
apply plugin: 'android' //添加如下2行
apply plugin: 'newlens'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir:'c:\\tingyun\\agent',include:['*.jar']) //在dependencies中添加这行.agent的jar包会嵌入在apk中.
}
2.按照听云官网的配置,配置初始化语句以及添加权限等.
附录. 听云插件文件夹结构
tingyun --
----agent
----nbs.newlens.agent-2.2.5.jar
----plugin
----agent-gradle-plugin-2.2.5.jar
----nbs.newlens.class.rewriter-2.2.5.jar
附录,听云中央仓库地址: https://repo1.maven.org/maven2/com/networkbench/newlens/agent/android/agent-gradle-plugin/ 2.2.4/agent-gradle-plugin- 2.2.4.pom