TinkerPatch / tinkerpatch-sdk

TinkerPatch SDK
http://tinkerpatch.com
MIT License
294 stars 56 forks source link

uncaughtException: Bad notification for startForeground: java.lang.RuntimeException: icon must be non-zero #40

Closed XuNanIntelif closed 7 years ago

XuNanIntelif commented 7 years ago

How to fix it?

simpleton commented 7 years ago

@XuNanIntelif That exception wasn't caused by tinkerPatch. TinkerPatch is only registered the uncaughtExceptionHandler for watching exceptions when the app is in launching stage.

simpleton commented 7 years ago

@XuNanIntelif There's the other user report same issue to my email today. I think I should future check on this issue. Could you provide me some more details?

Did this issue happen when you launch sample which we supply?

XuNanIntelif commented 7 years ago

more details like this:

04-17 09:34:16.370 2791-2791/com.searchresident W/Tinker.TinkerLoadResult: can't find patch file, is ok, just return
04-17 09:34:16.370 2791-2791/com.searchresident I/Tinker.DefaultLoadReporter: patch loadReporter onLoadResult: patch load result, path:/data/data/com.searchresident/tinker, code:-2, cost:3
04-17 09:34:16.370 2791-2791/com.searchresident W/Tinker.Tinker: tinker load fail!
04-17 09:34:16.370 2791-2791/com.searchresident I/Tinker.TinkerPatch: Init TinkerPatch sdk success, version:1.1.4
04-17 09:34:16.990 2791-2791/com.searchresident I/Tinker.UpgradePatchRetry: onPatchRetryLoad retry info not exist, just return
04-17 09:34:17.050 2791-2791/com.searchresident W/Tinker.ClientImpl: [retryAllReportFails], there is no fail report, just return
04-17 09:34:17.130 2791-2791/com.searchresident I/Tinker.UrlConnectionFetcher: loadData from url: http://q.tinkerpatch.com/35a45adb491b65e8/1.0.0?d=470b449a-25ca-4c82-a754-69ed7e870d5f&v=1492392857114, method:GET, body:null
04-17 09:34:17.360 2791-2973/com.searchresident I/Tinker.UrlConnectionFetcher: response code 200 msg: OK
04-17 09:34:17.360 2791-2973/com.searchresident I/Tinker.ClientImpl: tinker server sync respond:{"v":6}
04-17 09:34:17.360 2791-2973/com.searchresident I/Tinker.VersionInfo: VersionCheck: patchVersion from 0 to 6
04-17 09:34:17.360 2791-2973/com.searchresident I/Tinker.VersionInfo: GrayGroupCheck: true, gray value:null and my gray value is 4
04-17 09:34:17.360 2791-2973/com.searchresident I/Tinker.ClientImpl: Fetch result: need to update, gray: 4
04-17 09:34:17.360 2791-2973/com.searchresident I/Tinker.UrlConnectionFetcher: loadData from url: http://q.tinkerpatch.com/35a45adb491b65e8/1.0.0/file6?d=470b449a-25ca-4c82-a754-69ed7e870d5f&v=1492392857373, method:GET, body:null
04-17 09:34:17.470 2791-2973/com.searchresident I/Tinker.UrlConnectionFetcher: response code 200 msg: OK
04-17 09:34:20.940 2791-2973/com.searchresident I/Tinker.PatchRequestCallback: TinkerPatchRequestCallback: onPatchUpgrade, file:/data/data/com.searchresident/tinker_server/1.0.0_6.apk, newVersion:6, currentVersion:0
04-17 09:34:21.110 2791-2973/com.searchresident I/Tinker.ServerClient: tinker server report patch download success, patchVersion:6
04-17 09:34:21.320 2791-2973/com.searchresident I/Tinker.UrlConnectionFetcher: loadData from url: http://stat.tinkerpatch.com/succ.php, method:POST, body:t=1&sv=1.1.4&pv=6&av=1.0.0&k=35a45adb491b65e8
04-17 09:34:21.340 2791-2973/com.searchresident I/Tinker.VersionInfo: updateVersionInfo file path:/data/data/com.searchresident/tinker_server/35a45adb491b65e8_version.info, appVersion: 1.0.0, uuid:470b449a-25ca-4c82-a754-69ed7e870d5f, abi:arm64-v8a, patchVersion:6, patchMd5:6adec02a3e817ffd7ea36f2cffc96881, grayValue:4, crashTimes:0, retryTimes:0
04-17 09:34:21.400 2791-2973/com.searchresident I/Tinker.TinkerServerPatchListener: receive a patch file: /data/data/com.searchresident/tinker_server/1.0.0_6.apk, file size:849262
04-17 09:34:21.410 2791-2973/com.searchresident W/Tinker.UpgradePatchRetry: onPatchListenerCheck retry file is not exist, just return
04-17 09:34:21.610 3255-3255/com.searchresident:patch W/Tinker.TinkerLoader: tryLoadPatchFiles:patch dir not exist:/data/data/com.searchresident/tinker
04-17 09:34:21.620 2791-2973/com.searchresident I/Tinker.UrlConnectionFetcher: response code 200 msg: OK
04-17 09:34:21.620 3255-3255/com.searchresident:patch I/Tinker.ServerUtils: with app key from manifest appKey:35a45adb491b65e8
04-17 09:34:21.620 3255-3255/com.searchresident:patch I/Tinker.ServerUtils: with app version from manifest appVersion:1.0.0
04-17 09:34:21.640 2791-2973/com.searchresident I/Tinker.ClientImpl: [succ] report successfully with url: http://stat.tinkerpatch.com/succ.php, body: t=1&sv=1.1.4&pv=6&av=1.0.0&k=35a45adb491b65e8reportingCount: 0, fail pool size: 0
04-17 09:34:21.640 3255-3255/com.searchresident:patch I/Tinker.VersionInfo: readVersionInfo file path:/data/data/com.searchresident/tinker_server/35a45adb491b65e8_version.info, appVersion: 1.0.0, uuid:470b449a-25ca-4c82-a754-69ed7e870d5f, abi:arm64-v8a, patchVersion:6, patchMd5:6adec02a3e817ffd7ea36f2cffc96881, grayValue:4, crashTimes:0, retryTimes:0
04-17 09:34:21.650 3255-3255/com.searchresident:patch I/Tinker.ServerClient: installTinkerServer, debug value: false, appVersion: 1.0.0, appKey: 35a45adb491b65e8
04-17 09:34:21.660 3255-3255/com.searchresident:patch W/Tinker.Tinker: tinker patch directory: /data/data/com.searchresident/tinker
04-17 09:34:21.660 3255-3255/com.searchresident:patch I/Tinker.Tinker: try to install tinker, isEnable: true, version: 1.7.7
04-17 09:34:21.660 3255-3255/com.searchresident:patch I/Tinker.TinkerLoadResult: parseTinkerResult loadCode:-2, systemOTA:false
04-17 09:34:21.660 3255-3255/com.searchresident:patch W/Tinker.TinkerLoadResult: can't find patch file, is ok, just return
04-17 09:34:21.660 3255-3255/com.searchresident:patch I/Tinker.DefaultLoadReporter: patch loadReporter onLoadResult: patch load result, path:/data/data/com.searchresident/tinker, code:-2, cost:3
04-17 09:34:21.660 3255-3255/com.searchresident:patch W/Tinker.Tinker: tinker load fail!
04-17 09:34:21.660 3255-3255/com.searchresident:patch I/Tinker.TinkerPatch: Init TinkerPatch sdk success, version:1.1.4
04-17 09:34:21.710 3255-3287/com.searchresident:patch I/Tinker.DefaultPatchReporter: patchReporter onPatchServiceStart: patch service start
04-17 09:34:21.730 3255-3287/com.searchresident:patch I/Tinker.UpgradePatchRetry: try copy file: /data/data/com.searchresident/tinker_server/1.0.0_6.apk to /data/data/com.searchresident/tinker_temp/temp.apk
04-17 09:34:21.740 3255-3287/com.searchresident:patch I/Tinker.TinkerPatchService: try to increase patch process priority
04-17 09:34:21.800 3255-3287/com.searchresident:patch I/Tinker.UpgradePatch: UpgradePatch tryPatch:patchMd5:6adec02a3e817ffd7ea36f2cffc96881
04-17 09:34:21.800 3255-3287/com.searchresident:patch I/Tinker.UpgradePatch: UpgradePatch tryPatch:patchVersionDirectory:/data/data/com.searchresident/tinker/patch-6adec02a
04-17 09:34:21.810 3255-3287/com.searchresident:patch W/Tinker.UpgradePatch: UpgradePatch copy patch file, src file: /data/data/com.searchresident/tinker_server/1.0.0_6.apk size: 849262, dest file: /data/data/com.searchresident/tinker/patch-6adec02a/patch-6adec02a.apk size:849262
04-17 09:34:21.820 3255-3287/com.searchresident:patch E/Tinker.DexDiffPatchInternal: apk entry classes.dex crc is not equal, expect crc: 1765140481, got crc: 3496149317
04-17 09:34:21.830 3255-3287/com.searchresident:patch W/Tinker.ServerClient: tinker server report patch fail with broadcast, patchVersion:6, errorCode:-241
04-17 09:34:21.830 3255-3287/com.searchresident:patch I/Tinker.DefaultPatchReporter: patchReporter onPatchTypeExtractFail: file extract fail type:dex, path:/data/data/com.searchresident/tinker/patch-6adec02a/patch-6adec02a.apk, extractTo:/data/data/com.searchresident/tinker/patch-6adec02a/dex/classes.dex.jar, filename:classes.dex
04-17 09:34:21.840 3255-3287/com.searchresident:patch I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/data/com.searchresident/tinker/patch-6adec02a/patch-6adec02a.apk
04-17 09:34:21.840 3255-3287/com.searchresident:patch I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/data/com.searchresident/tinker/patch-6adec02a/dex
04-17 09:34:21.840 3255-3287/com.searchresident:patch I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/data/com.searchresident/tinker/patch-6adec02a
04-17 09:34:21.840 3255-3287/com.searchresident:patch W/Tinker.DexDiffPatchInternal: patch recover, extractDiffInternals fail
04-17 09:34:21.840 3255-3287/com.searchresident:patch I/Tinker.DexDiffPatchInternal: recover dex result:false, cost:31
04-17 09:34:21.840 3255-3287/com.searchresident:patch E/Tinker.UpgradePatch: UpgradePatch tryPatch:new patch recover, try patch dex failed
04-17 09:34:21.850 3255-3287/com.searchresident:patch I/Tinker.DefaultPatchReporter: patchReporter onPatchResult: patch all result path:/data/data/com.searchresident/tinker_server/1.0.0_6.apk, success:false, cost:104
04-17 09:34:21.850 3255-3287/com.searchresident:patch I/Tinker.PatchFileUtil: safeDeleteFile, try to delete path: /data/data/com.searchresident/tinker_temp/temp.apk
04-17 09:34:21.880 3255-3255/com.searchresident:patch E/Tinker.SampleUncaughtExHandler: uncaughtException: Bad notification for startForeground: java.lang.RuntimeException: icon must be non-zero
04-17 09:34:21.880 3255-3255/com.searchresident:patch W/Tinker.SampleUncaughtExHandler: tinker is not loaded, just return
04-17 09:34:21.880 3255-3255/com.searchresident:patch E/Tinker.UncaughtHandler: catch exception when loading tinker:android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: icon must be non-zero
                                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1560)
                                                                                    at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                    at android.os.Looper.loop(Looper.java:135)
                                                                                    at android.app.ActivityThread.main(ActivityThread.java:5564)
                                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                                    at java.lang.reflect.Method.invoke(Method.java:372)
                                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
                                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
04-17 09:34:24.530 2791-2791/com.searchresident E/Tinker.ServerClient: tinker server report patch fail, patchVersion:6, errorCode:-241
04-17 09:34:24.990 2791-2791/com.searchresident I/Tinker.UrlConnectionFetcher: loadData from url: http://stat.tinkerpatch.com/err.php, method:POST, body:t=1&code=-241&sv=1.1.4&pv=6&av=1.0.0&k=35a45adb491b65e8
04-17 09:34:25.150 2791-2973/com.searchresident I/Tinker.UrlConnectionFetcher: response code 200 msg: OK
04-17 09:34:25.250 2791-2973/com.searchresident I/Tinker.ClientImpl: [succ] report successfully with url: http://stat.tinkerpatch.com/err.php, body: t=1&code=-241&sv=1.1.4&pv=6&av=1.0.0&k=35a45adb491b65e8reportingCount: 0, fail pool size: 0
simpleton commented 7 years ago

@XuNanIntelif

E/Tinker.DexDiffPatchInternal: apk entry classes.dex crc is not equal, expect crc: 1765140481, got crc: 3496149317

Your patch isn't generated by right base APK. Plz make sure your patch is built by the base APK which you install in your device.

simpleton commented 7 years ago

@XuNanIntelif

Bad notification for startForeground: java.lang.RuntimeException: icon must be non-zero

You can find the workaround in below link: https://github.com/stephanenicolas/robospice/issues/430#issuecomment-126134819

The tinkerpatch is the library project, so there is no icon to begin with. You need set the app icon to fix this issue.

XuNanIntelif commented 7 years ago

After configuring the right base APK, there is only one error: 04-17 09:34:21.880 3255-3255/com.searchresident:patch E/Tinker.SampleUncaughtExHandler: uncaughtException: Bad notification for startForeground: java.lang.RuntimeException: icon must be non-zero 04-17 09:34:21.880 3255-3255/com.searchresident:patch W/Tinker.SampleUncaughtExHandler: tinker is not loaded, just return 04-17 09:34:21.880 3255-3255/com.searchresident:patch E/Tinker.UncaughtHandler: catch exception when loading tinker:android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: icon must be non-zero at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1560) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5564) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

simpleton commented 7 years ago

@XuNanIntelif Did that workaround fix your issue? Feel free to contact us when it didn't work.

simpleton commented 7 years ago

@XuNanIntelif Need feedback. Feel free to reopen this issue when it didn't work.