编译打包成apk之后,将apk在手机上进行安装,连接数据线,打开命令行,输入以下命令:
- adb logcat -v time -s NBSAgent:V
之后运行嵌入听云代码的app,进行有效的网络访问,如果出现以下内容,
- NBSAgent start
- NBSAgent enabled
- NBSAgent V1.1.×
- connect success
则表示嵌入成功,否则失败
在嵌入听云代码时,第五步,如下:
- (5)set environment variable ANT_OPTS
- In Mac OS and Linux environment:
- export ANT_OPTS="-javaagent:/path/to/nbs-android-agent/nbs.newlens.class.rewriter.jar"
- In Windows environment:
- SET ANT_OPTS="-javaagent:C:\path\to\nbs-android-agent\nbs.newlens.class.rewriter.jar"
- Please replace "/path/to/nbs-android-agent/" with your actual SDK store path.
- Notice: Please don't set the environment variable (i.e. ANT_OPTS) in user or system environment variable permanently, otherwise it would make effects to other Android projects with no need embedded-code.
- Strongly propose to set the environment variable temporarily in single compiling command-line, or set the environment variable separately in batching compile script of the project that need embedded-code.
- Notice: Because of the affect caused by some known bug in Android development tools, please don't use blank in the path of nbs.newlens.class.rewriter.jar file.
注意点:
其中需要将nbs.newlens.class.rewriter.jar拷贝到所在电脑的sdk目录下,如/home/yee/tools/sdk
- 且/path/to/nbs-android-agent需要设置为<span style="color: rgb(0, 128, 0); line-height: 24px; rgb(243, 243, 243);">/home/yee/tools/sdk</span>
- <span style="color: rgb(0, 128, 0); line-height: 24px; rgb(243, 243, 243);">也就说,如果将sdk绝对路径为<span style="color: rgb(0, 128, 0); line-height: 24px; rgb(243, 243, 243);">/home/yee/tools/sdk</span></span>
- <span style="color: rgb(0, 128, 0); line-height: 24px; rgb(243, 243, 243);"><span style="color: rgb(0, 128, 0); line-height: 24px; rgb(243, 243, 243);">则</span></span><pre name="code" class="plain">SET ANT_OPTS="-javaagent:C:\path\to\nbs-android-agent\nbs.newlens.class.rewriter.jar"
- <pre name="code" class="plain"><pre name="code" class="plain" style="color: rgb(0, 128, 0); line-height: 24px;">这句话,应该改为
export ANT_OPTS="-javaagent:/home/yee/tools/sdk/nbs.newlens.class.rewriter.jar"
- 一定谨记