http://www.android-doc.com/tools/help/MonkeyImage.html
http://www.android-doc.com/tools/help/MonkeyImage.html
C++出现: 1 duplicate symbol for architecture x86_64可能的问题如下:
可以查看详细的错误信息,看看是哪个变量或者函数被重复定义了。
本人这此遇到此问题是因为把一个静态变量的定义放在头文件里了,应该放到cpp文件里就没问题了。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
#ifndef MANAGERCONFIG_H #define MANAGERCONFIG_H #include <iostream> #include "iniparser/iniparser.h" class ManagerConfig { public: ManagerConfig(); ~ManagerConfig(); static ManagerConfig* getInstance(); static void deleteInstance(); private: static ManagerConfig* m_instance; private: dictionary* ini; private: std::string mUserId; std::string mUserName; std::string mLoginToken; public: std::string getUserId(); std::string getUserName(); std::string getLogintoken(); public: void setUserId(std::string userid); void setUserName(std::string username); void setLogintoken(std::string logintoken); }; //这里定义了静态变量,所以出问题了 //ManagerConfig* ManagerConfig::m_instance = NULL; const std::string INIFILE_NAME = "managerconfig.ini"; #endif // MANAGERCONFIG_H |
本文适用于OSX和Linux系统,Windows系统用户可用来参考
在Android Studio中进行了三方库的前期测试调研工作,然后要把工程转移到Android系统工程中,使用Android.mk进行编译,所有的三方jar包只能手动添加到工程中了。在使用Android Studio的dependency的时候除了显示添加到其中的三方库,三方库可能还会调用其他的依赖库,那怎么才能知道到底用了哪些库呢,只能使用gradle了。
在命令行cd到工程所在的根目录,然后使用如下命令打印as工程中的库的依赖关系,其中app为要查看的模块的名称
1 |
./gradlew app:dependencies |
如果执行成功的话就会打印一大堆信息,其中一部分内容就是不同的gradle任务的类库依赖关系,类似如下形式:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
+--- com.orhanobut:logger:2.1.1 +--- com.google.code.gson:gson:2.8.0 +--- com.android.support:appcompat-v7:25.4.0 (*) +--- com.journeyapps:zxing-android-embedded:3.5.0 +--- com.google.zxing:core:3.3.0 +--- com.squareup.okhttp3:okhttp:3.9.0 (*) +--- com.umeng.sdk:common:latest.integration -> 1.5.3 +--- com.umeng.sdk:analytics:latest.integration -> 7.5.3 +--- com.android.support:recyclerview-v7:25.4.0 | +--- com.android.support:support-annotations:25.4.0 -> 23.1.0 | +--- com.android.support:support-compat:25.4.0 (*) | \--- com.android.support:support-core-ui:25.4.0 (*) +--- org.greenrobot:greendao:3.2.2 | \--- org.greenrobot:greendao-api:3.2.2 +--- com.android.support:gridlayout-v7:25.4.0 | +--- com.android.support:support-compat:25.4.0 (*) | \--- com.android.support:support-core-ui:25.4.0 (*) +--- com.android.support:design:25.4.0 | +--- com.android.support:support-v4:25.4.0 (*) | +--- com.android.support:appcompat-v7:25.4.0 (*) | +--- com.android.support:recyclerview-v7:25.4.0 (*) | \--- com.android.support:transition:25.4.0 | +--- com.android.support:support-annotations:25.4.0 -> 23.1.0 | \--- com.android.support:support-v4:25.4.0 (*) +--- com.android.support:support-v4:25.4.0 (*) +--- pub.devrel:easypermissions:0.3.0 | \--- com.android.support:appcompat-v7:25.1.0 -> 25.4.0 (*) +--- org.greenrobot:eventbus:3.1.0-RC \--- com.android.support.constraint:constraint-layout:1.0.2 \--- com.android.support.constraint:constraint-layout-solver:1.0.2 |
默认情况下gradle下载的文件在用户目录下的.gradle目录中,可以通过如下命令进行该目录
1 |
cd ~/.gradle |
然后通过find命令查找你想要的库就可以了,比如要查gson的jar包,可以用如下命令:
1 |
find ./ -name *gson*jar |
首先在gradle中添加库的依赖,如下:
1 2 3 4 5 6 7 8 |
dependencies { debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3' releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3' // Optional, if you use support library fragments: debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.3' } |
releaseImplementation依赖库是用于在release包中,只有LeakCanary的各种方法的壳,但是没有具体的实现,防止在给用户的release包中也进行内存检测操作。
然后新建一个Application类,并在此Application类的onCreate中加入以下代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
public class MusicApplication extends Application { @Override public void onCreate() { super.onCreate(); //如果已经在检测这个Application则return if(LeakCanary.isInAnalyzerProcess(this)){ return; } LeakCanary.install(this); //你的Application的初始化代码 } } |
打开一个Activity,在关闭的时候如果有内存泄漏,LeakCanary将会在通知栏显示图片,点击图标即可看到详细的内存泄漏报告,如下图所示:
Atomic类用于保证变量操作的原子性,先记录,有时间再进行研究 :-(
出现这种错误一般是输入的keystore的密钥有问题了
重新输入一下打包的密钥就可以了
需要安装的库(下载代码前):
sudo apt-get install curl
sudo apt-get install git
需要安装的库(编译前):
sudo apt-get install git git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev
sudo apt-get install lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown
sudo apt-get install lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown
sudo apt-get install lib32readline-gplv2-dev
sudo apt-get install libxml2-utils
每次下载安卓源码都要花1天的多的时间,而且在公司下载几十个G也占用别的人网速,所以对于只关注部分代码的人,可以只同步某些项目,这样节省时间和带宽。
本文所说内容是以你repo init成功为基础的。
首先打开源码目录下的.repo目录,打开manifest.xml,里面是一个子项目列表,其中xml节点中的name属性为我们需要用的
比如下载platform/packages/apps/Bluetooth的命令如下:
1 |
~/bin/repo sync platform/packages/apps/Bluetooth |
有的时候这个manifest.xml并没有你想要的那个项目,你可以根据安卓官方的源码结构添加进去,比如下面几个就是我手动添加的:
1 2 3 4 |
<project path="external/bluetooth/bluedroid" name="platform/external/bluetooth/bluedroid" groups="pdk" /> <project path="external/bluetooth/bluez" name="platform/external/bluetooth/bluez" groups="pdk" /> <project path="external/bluetooth/glib" name="platform/external/bluetooth/glib" groups="pdk" /> <project path="external/bluetooth/hcidump" name="platform/external/bluetooth/hcidump" groups="pdk" /> |
另外如果你想同时下载多个项目也是支持的,在不同的项目后面加上空格分隔即可,如下:
1 |
~/bin/repo sync platform/external/bluetooth/bluedroid platform/external/bluetooth/bluez platform/external/bluetooth/glib platform/external/bluetooth/hcidump |
链接:
使用adb shell getprop即可获得Android系统的版本号,如下:
1 2 3 |
获取系统版本:adb shell getprop ro.build.version.release 获取系统api版本:adb shell getprop ro.build.version.sdk |
另外直接执行adb shell getprop还可以获得更多的系统属性,如下是我机器显示的结果:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
[alsa.mixer.capture.headset]: [Capture] [alsa.mixer.capture.master]: [Capture] [alsa.mixer.playback.headset]: [Headphone] [alsa.mixer.playback.master]: [Playback] [alsa.mixer.playback.speaker]: [Playback] [back_camera_name]: [adv7180_decoder] [back_camera_orient]: [0] [camera.disable_zsl_mode]: [1] [dalvik.vm.dexopt-flags]: [m=y] [dalvik.vm.heapgrowthlimit]: [64m] [dalvik.vm.heapmaxfree]: [8m] [dalvik.vm.heapminfree]: [512k] [dalvik.vm.heapsize]: [384m] [dalvik.vm.heapstartsize]: [8m] [dalvik.vm.heaptargetutilization]: [0.75] [dalvik.vm.jniopts]: [warnonly] [dalvik.vm.stack-trace-file]: [/data/anr/traces.txt] [debug.egl.hw]: [1] [debug.force_rtl]: [0] [debug.sf.enable_hgl]: [1] [debug.sf.showfps]: [0] [dev.bootcomplete]: [1] [dhcp.wlan0.dns1]: [192.168.8.5] [dhcp.wlan0.dns2]: [114.114.114.114] [dhcp.wlan0.dns3]: [] [dhcp.wlan0.dns4]: [] [dhcp.wlan0.domain]: [] [dhcp.wlan0.gateway]: [192.168.23.1] [dhcp.wlan0.ipaddress]: [192.168.23.100] [dhcp.wlan0.leasetime]: [86400] [dhcp.wlan0.mask]: [255.255.255.0] [dhcp.wlan0.mtu]: [] [dhcp.wlan0.pid]: [1440] [dhcp.wlan0.reason]: [REBOOT] [dhcp.wlan0.result]: [ok] [dhcp.wlan0.server]: [192.168.23.1] [dhcp.wlan0.vendorInfo]: [] [front_camera_name]: [uvc] [front_camera_orient]: [0] [gsm.current.phone-type]: [1] [gsm.network.type]: [Unknown] [gsm.operator.alpha]: [] [gsm.operator.iso-country]: [] [gsm.operator.isroaming]: [false] [gsm.operator.numeric]: [] [gsm.ril.delay]: [15] [gsm.sim.state]: [NOT_READY] [hw.backlight.dev]: [pwm-backlight.0] [hw.bluetooth]: [0] [hwc.enable_dither]: [1] [hwc.stretch.filter]: [1] [init.svc.adbd]: [running] [init.svc.blueletd]: [running] [init.svc.bootanim]: [stopped] [init.svc.console]: [running] [init.svc.debuggerd]: [running] [init.svc.dhcpcd_wlan0]: [running] [init.svc.drm]: [running] [init.svc.healthd]: [running] [init.svc.installd]: [running] [init.svc.keystore]: [running] [init.svc.magd]: [stopped] [init.svc.mcu_server]: [running] [init.svc.media]: [running] [init.svc.netd]: [running] [init.svc.ril-daemon]: [running] [init.svc.sdcard]: [running] [init.svc.servicemanager]: [running] [init.svc.surfaceflinger]: [running] [init.svc.tw8836]: [stopped] [init.svc.ueventd]: [running] [init.svc.vold]: [running] [init.svc.watchdogd]: [running] [init.svc.wifi_mac]: [stopped] [init.svc.wpa_supplicant]: [running] [init.svc.zygote]: [running] [media.omxgm.enable-player]: [1] [media.omxgm.enable-record]: [1] [media.omxgm.enable-scan]: [1] [media.wfd.video-bitrate]: [adaptive] [net.bt.name]: [Android] [net.change]: [net.dns2] [net.dns1]: [192.168.8.5] [net.dns2]: [114.114.114.114] [net.hostname]: [android-4e5bb95fd128e923] [net.qtaguid_enabled]: [1] [net.tcp.buffersize.default]: [4096,87380,110208,4096,16384,110208] [net.tcp.buffersize.edge]: [4093,26280,35040,4096,16384,35040] [net.tcp.buffersize.ethernet]: [524288,2097152,4194304,524288,2097152,4194304] [net.tcp.buffersize.evdo]: [4094,87380,262144,4096,16384,262144] [net.tcp.buffersize.gprs]: [4092,8760,11680,4096,8760,11680] [net.tcp.buffersize.hsdpa]: [4094,87380,262144,4096,16384,262144] [net.tcp.buffersize.hspa]: [4094,87380,262144,4096,16384,262144] [net.tcp.buffersize.hspap]: [4094,87380,1220608,4096,16384,1220608] [net.tcp.buffersize.hsupa]: [4094,87380,262144,4096,16384,262144] [net.tcp.buffersize.lte]: [524288,1048576,2097152,262144,524288,1048576] [net.tcp.buffersize.umts]: [4094,87380,110208,4096,16384,110208] [net.tcp.buffersize.wifi]: [524288,1048576,2097152,262144,524288,1048576] [persist.sampling_profiler]: [1] [persist.sys.country]: [CN] [persist.sys.dalvik.vm.lib]: [libdvm.so] [persist.sys.language]: [zh] [persist.sys.localevar]: [] [persist.sys.profiler_ms]: [0] [persist.sys.usb.config]: [mtp,adb] [ro.FSL_AAC_PARSER]: [1] [ro.FSL_ASF_PARSER]: [0] [ro.FSL_AVI_PARSER]: [1] [ro.FSL_FLAC_PARSER]: [1] [ro.FSL_FLV_PARSER]: [1] [ro.FSL_MKV_PARSER]: [1] [ro.FSL_MPG2_PARSER]: [1] [ro.FSL_REAL_PARSER]: [0] [ro.adb.secure]: [1] [ro.allow.mock.location]: [1] [ro.baseband]: [unknown] [ro.board.platform]: [imx6] [ro.boot.console]: [ttymxc3] [ro.boot.hardware]: [freescale] [ro.boot.selinux]: [disabled] [ro.boot.serialno]: [0a05a1d4e6b61f90] [ro.bootloader]: [unknown] [ro.bootmode]: [unknown] [ro.build.characteristics]: [tablet] [ro.build.date.utc]: [1508731143] [ro.build.date]: [2017年 10月 23日 星期一 11:59:03 CST] [ro.build.description]: [sabreauto_6q-eng 4.4.3 2.0.0-rc2 20150123 dev-keys] [ro.build.display.id]: [sabreauto_6q-eng 4.4.3 2.0.0-rc2 20150123 dev-keys] [ro.build.fingerprint]: [Freescale/sabreauto_6q/sabreauto_6q:4.4.3/2.0.0-rc2/20150123:eng/dev-keys] [ro.build.host]: [chinatsp] [ro.build.id]: [2.0.0-rc2] [ro.build.product]: [sabreauto_6q] [ro.build.tags]: [dev-keys] [ro.build.type]: [eng] [ro.build.user]: [xuganggen] [ro.build.version.codename]: [REL] [ro.build.version.incremental]: [20150123] [ro.build.version.release]: [4.4.3] [ro.build.version.sdk]: [19] [ro.carrier]: [unknown] [ro.config.alarm_alert]: [Alarm_Classic.ogg] [ro.config.notification_sound]: [OnTheHunt.ogg] [ro.crypto.state]: [unencrypted] [ro.debuggable]: [1] [ro.factorytest]: [0] [ro.hardware.lightsensor]: [/sys/class/i2c-dev/i2c-1/device/1-0044/] [ro.hardware]: [freescale] [ro.kernel.android.checkjni]: [1] [ro.lightsensor.threshold]: [20] [ro.opengles.version]: [196608] [ro.product.board]: [SABREAUTO] [ro.product.brand]: [Freescale] [ro.product.cpu.abi2]: [armeabi] [ro.product.cpu.abi]: [armeabi-v7a] [ro.product.device]: [sabreauto_6q] [ro.product.locale.language]: [en] [ro.product.locale.region]: [US] [ro.product.manufacturer]: [Freescale] [ro.product.model]: [SABREAUTO-MX6Q] [ro.product.name]: [sabreauto_6q] [ro.revision]: [0] [ro.ril.wake_lock_timeout]: [300] [ro.runtime.firstboot]: [86414407] [ro.secure]: [0] [ro.serialno]: [0a05a1d4e6b61f90] [ro.sf.hwrotation]: [0] [ro.sf.lcd_density]: [160] [ro.tether.denied]: [false] [ro.wifi.channels]: [] [ro.zygote.disable_gl_preload]: [true] [rw.VIDEO_RENDER_NAME]: [video_render.surface] [service.bootanim.exit]: [1] [sys.boot_completed]: [1] [sys.emulated.battery]: [1] [sys.interactive]: [active] [sys.settings_global_version]: [2] [sys.sysctl.extra_free_kbytes]: [16200] [sys.usb.config]: [mtp,adb] [sys.usb.state]: [mtp,adb] [system_init.startsurfaceflinger]: [0] [vold.post_fs_data_done]: [1] [wifi.ap.interface]: [wlan0] [wifi.interface]: [wlan0] [wlan.driver.status]: [ok] [wlan.interface]: [wlan0] |
此方法不可用!!!
使用RowID
1 2 3 4 5 6 7 8 |
select id,bname,parentid,1 as Level from boxes where parentid=0 union all select a.id,a.bname,a.parentid,c.RowID as Level from boxes a inner join boxes b on a.parentid=b.id inner join ( select parentid from boxes group by parentid ) c on a.parentid=c.parentid |