android典型代码系列(一)------android调试
16lz
2021-01-23
0_android调试 :
补充:一条短信:70个汉字,160个英文字符
1.(可选)在AndroidManifest.xml
当中—application
—-android:debuggable="true"
2.AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?><manifest> <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="cn.beita.layout"></instrumentation> <application ...> <uses-library android:name="android.test.runner"/> <activity...></activity> </application></manifest>
3.Test.java
public class Test extends AndroidTestCase{ public void testAdd() throws Exception{ assertEquals(....); } @Override //做一些初始化的操作 public void setUp() throws Exception{} @Override //做一些收尾的工作 public void tearDown() throws Exception{}}
PS : 以上方法只适用于eclipse环境,如果是在android studio环境下,可以这样做:
public class URLEncodeTest extends InstrumentationTestCase { @Override protected void tearDown() throws Exception { super.tearDown(); } public void testUrlEncode() throws Exception { String content = "!#$%&\\()*+,./:;=?@[\']"; Log.e("test", "test-----" + URLEncoder.encode(content, "UTF-8")); }}
然后在edit configuration—>里面添加配置
更多相关文章
- Android环境变量作用--命令行操作
- Ubuntu 18.04 配置android 源码开发/编译环境
- Cocos2d-3.x Android环境搭建
- CMAKE 在Linux下 构建android 编译、打包、发布环境
- ubuntu 11.10 搭建 Android 开发环境
- linux下android开发环境的配置
- 19_利用android提供的HanziToPinyin工具类实现汉字与拼接的转换
- [Android]Android SDK 2.3与Eclipse最新版开发环境搭建
- Ubuntu 10.10 与 华为 C8650 手机搭建 Android 真机开发调试环境