Appium 使用 appium 安装的 app 运行出现异常退出的问题

psinjack · 2014年07月28日 · 最后由 psinjack 回复于 2014年07月30日 · 2687 次阅读

问题场景:
1、下载发布的 apk,这里用的是微信客户端(应用宝下载的)
2、写好 appium 脚本,我使用的是 JAVA,运行脚本,可以在 appium console 窗口上看到正常的安装 apk 等操作日志,且整个过程没有错误

现象:
但是安装好的微信 APP,不能正常运行,会报系统检测到微信客户端异常,然后退出。

这个问题困惑比较旧,求大神赐教下,给点思路?多谢!

该问题在真机和模拟设备上都会出现,但如果使用相同的 apk 手动安装,微信客户端能运行正常。

共收到 5 条回复 时间 点赞

最好能分析下 logcat 日志,看看是什么错误

之前也试图通过 logcat 日志进行分析,确实也发现有些异常,但我在想,手动安装 app 运行正常,但为什么 appium 安装后就不行,不太可能是微信自己的问题吧;唯一不同的是 appium 的安装方式不同
附 logcat 日志:
1、
E/Trace (10610): error opening trace file: No such file or directory (2)
E/ActivityThread(10610): Failed to find provider info for com.tencent.mm.coolassist.debugprovider

2、
E/dalvikvm(10610): Could not find class 'com.tencent.mm.plugin.location.google.GoogleMapView', referenced from method com.tencent.mm.plugin.location.google.LocationInit$LocationInitImp.createMapView
E/dalvikvm(10610): Could not find class 'com.tencent.mm.plugin.location.google.GoogleProxyUI', referenced from method com.tencent.mm.plugin.location.google.LocationInit$LocationInitImp.createStartIntent

完整的日志如下:
W/AlarmManager( 2294): FACTORY_ON= 0
E/ClockAlarmWidget( 4904): [AlarmWidgetIdManager] getListItem() : itemIndex=0, widgetID:1
E/ClockAlarmWidget( 4904): [AlarmWidgetIdManager] getListItem() : ItemIndex exceed ListItemCount. itemIndex=1
E/ClockAlarmWidget( 4904): [AlarmWidgetIdManager] getListItem() : itemIndex=1, widgetID:1
W/AlarmManager( 2294): FACTORY_ON= 0
W/ActivityManager( 2294): mDVFSLock.acquire()
W/AlarmManager( 2294): FACTORY_ON= 0
W/AlarmManager( 2294): FACTORY_ON= 0
W/MessageQueue( 4858): Handler (android.os.Handler) {42683378} sending message to a Handler on a dead thread
W/MessageQueue( 4858): java.lang.RuntimeException: Handler (android.os.Handler) {42683378} sending message to a Handler on a dead thread
W/MessageQueue( 4858): at android.os.MessageQueue.enqueueMessage(MessageQueue.java:294)
W/MessageQueue( 4858): at android.os.Handler.sendMessageAtTime(Handler.java:473)
W/MessageQueue( 4858): at android.os.Handler.sendMessageDelayed(Handler.java:446)
W/MessageQueue( 4858): at android.os.Handler.post(Handler.java:263)
W/MessageQueue( 4858): at com.tencent.mm.sdk.platformtools.am.o(SourceFile:204)
W/MessageQueue( 4858): at com.tencent.mm.modelstat.g.a(SourceFile:120)
W/MessageQueue( 4858): at com.tencent.mm.network.a.d.onTransact(SourceFile:60)
W/MessageQueue( 4858): at android.os.Binder.execTransact(Binder.java:367)
W/MessageQueue( 4858): at dalvik.system.NativeStart.run(Native Method)
W/AlarmManager( 2294): FACTORY_ON= 0
W/AlarmManager( 2294): FACTORY_ON= 0
W/AlarmManager( 2294): FACTORY_ON= 0
W/AlarmManager( 2294): FACTORY_ON= 0
W/ActivityManager( 2294): mDVFSLock.acquire()
E/Trace (10610): error opening trace file: No such file or directory (2)
E/ActivityThread(10610): Failed to find provider info for com.tencent.mm.coolassist.debugprovider
W/MicroMsg.xlogger(10610): JNI_Xlog_onCreate
W/ActivityManager( 2294): mDVFSLock.release()
W/InputMethodManagerService( 2294): Got RemoteException sending setActive(false) notification to pid 4858 uid 10139
W/native_eup(10610): empty
W/PowerManagerService( 2294): Timer 0x3->0x3|0x0
W/dalvikvm(10610): Unable to resolve superclass of Lcom/tencent/mm/plugin/location/google/GoogleMapView; (921)
W/dalvikvm(10610): Link of class 'Lcom/tencent/mm/plugin/location/google/GoogleMapView;' failed
E/dalvikvm(10610): Could not find class 'com.tencent.mm.plugin.location.google.GoogleMapView', referenced from method com.tencent.mm.plugin.location.google.LocationInit$LocationInitImp.createMapView
W/dalvikvm(10610): VFY: unable to resolve new-instance 2520 (Lcom/tencent/mm/plugin/location/google/GoogleMapView;) in Lcom/tencent/mm/plugin/location/google/LocationInit$LocationInitImp;
W/dalvikvm(10610): Unable to resolve superclass of Lcom/tencent/mm/plugin/location/google/GoogleProxyUI; (918)
W/dalvikvm(10610): Link of class 'Lcom/tencent/mm/plugin/location/google/GoogleProxyUI;' failed
E/dalvikvm(10610): Could not find class 'com.tencent.mm.plugin.location.google.GoogleProxyUI', referenced from method com.tencent.mm.plugin.location.google.LocationInit$LocationInitImp.createStartIntent
W/dalvikvm(10610): VFY: unable to resolve const-class 2521 (Lcom/tencent/mm/plugin/location/google/GoogleProxyUI;) in Lcom/tencent/mm/plugin/location/google/LocationInit$LocationInitImp;
W/dalvikvm(10610): Unable to resolve superclass of Lcom/tencent/mm/plugin/location/google/GoogleMapView; (921)
W/dalvikvm(10610): Link of class 'Lcom/tencent/mm/plugin/location/google/GoogleMapView;' failed
W/ActivityManager( 2294): mDVFSLock.acquire()
W/AlarmManager( 2294): FACTORY_ON= 0
W/AlarmManager( 2294): FACTORY_ON= 0
W/AlarmManager( 2294): FACTORY_ON= 0
W/AlarmManager( 2294): FACTORY_ON= 0
W/AlarmManager( 2294): FACTORY_ON= 0
W/AlarmManager( 2294): FACTORY_ON= 0
E/NotificationService( 2294): Ignoring notification with icon==0: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x62 kind=[null]) tickerText=null contactCharSeq=null when=1407205677459 threadId=0
E/SensorManager(10610): thread start
E/Sensors ( 2294): Acc old sensor_state 0, new sensor_state : 1 en : 1
E/NotificationService( 2294): Ignoring notification with icon==0: Notification(pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x62 kind=[null]) tickerText=null contactCharSeq=null when=1407208633012 threadId=0
W/ActivityManager( 2294): mDVFSLock.release()
E/Watchdog( 2294): !@Sync 100
W/ResourceType( 3499): getEntry failing because entryIndex 1933 is beyond type entryCount 1630
W/ResourceType( 3499): Failure getting entry for 0x7f02078d (t=1 e=1933) in package 0 (error -2147483647)
W/ResourceType( 3499): getEntry failing because entryIndex 1932 is beyond type entryCount 1630
W/ResourceType( 3499): Failure getting entry for 0x7f02078c (t=1 e=1932) in package 0 (error -2147483647)
W/PCWCLIENTTRACE_AccountUtil( 9057): [hasGoogleAccount] - No Google Account
W/PCWCLIENTTRACE_AccountUtil( 9057): [hasGoogleAccount] - No Google Account
W/PCWCLIENTTRACE_PCWHandler( 9057): Google Account & C2DM Unregistration
W/AlarmManager( 2294): FACTORY_ON= 0
W/AlarmManager( 2294): FACTORY_ON= 0
W/Finsky ( 4116): [1] FinskyApp.getCurrentAccount: No account configured on this device.
W/Finsky ( 4116): [1] FinskyApp.getCurrentAccount: No account configured on this device.
W/Finsky ( 4116): [1] FinskyApp.getDfeApi: No account configured on this device.
W/Finsky ( 4116): [1] FinskyApp.getCurrentAccount: No account configured on this device.
W/Finsky ( 4116): [1] FinskyApp.getDfeApi: No account configured on this device.
E/Trace (10839): error opening trace file: No such file or directory (2)
E/Trace (10854): error opening trace file: No such file or directory (2)

'''Failed to find provider info for com.tencent.mm.coolassist.debugprovider'''
这个报错应该就是原因了吧
http://www.2cto.com/Article/201311/254789.html
上面这篇文章中,可以试试使用 resign 工具将微信重新打包,然后使用,想来也应该是腾讯为了安全做的一些手段吧

#3 楼 @umbrella1978
试了 resign 工具,重签名过程中失败了,读取 apk 时失败了,是微信的 apk 包比较特殊吗?
之前使用过 jarsign 来手动重签名,但签名后的 apk 在安装后,仍然会有异常退出的问题,不知道是不是我的操作步骤不正确,请各位大神看看 有没有其它的方法或思路可以借鉴下,多谢!

使用 resign.jar 出错如下所示:

jarsign 手动操作的步骤如下所示:
keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -keyalg RSA -validity 10000
jarsigner -verbose -keystore debug.keystore -signedjar wx_signed.apk wx.apk androiddebugkey

看来是微信的对重签名的 APK 作了保护,没办法搞了
只能找微信的人看些有没有其它办法可以绕过去

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册