[LayaNative 2.0]dcc更新失效, 有代码, 100%复现, 三楼附临时解决办法

用附件里与cdn上的dcc描述文件, 可以发现 version.json hash已经发生变化
对应的缓存名叫 fe0aee13
然后我们进入游戏,
从log能看出, assetsid.txt下载成功, 并且对比assetsid不一致, 继续下载filetable.bin
再往下走执行bundle后加载的第一个文件就是 version.json,
此时并未按照dcc更新的规则去下载新的文件, 而是直接从缓存里读取了旧文件
是我姿势不对?
 
补充一个细节, 5月14日测试的时候一切正常, 似乎是之后才出现的问题.
05-16 15:59:48.652 7562-7562/? D/dalvikvm: Late-enabling CheckJNI
05-16 15:59:48.736 7562-7562/com.dihong.testdcc D/dalvikvm: GetMethodID: not returning static method Landroid/os/Process;.getTotalMemory ()J
05-16 15:59:48.736 7562-7562/com.dihong.testdcc D/dalvikvm: GetMethodID: not returning static method Landroid/os/Process;.getFreeMemory ()J
05-16 15:59:48.748 7562-7562/com.dihong.testdcc I/dalvikvm-heap: Grow heap (frag case) to 8.155MB for 944528-byte allocation
05-16 15:59:48.767 7562-7562/com.dihong.testdcc D/libEGL: loaded /system/lib/egl/libEGL_tegra.so
05-16 15:59:48.771 7562-7562/com.dihong.testdcc D/libEGL: loaded /system/lib/egl/libGLESv1_CM_tegra.so
05-16 15:59:48.773 7562-7562/com.dihong.testdcc D/libEGL: loaded /system/lib/egl/libGLESv2_tegra.so
05-16 15:59:48.818 7562-7562/com.dihong.testdcc I/dalvikvm-heap: Grow heap (frag case) to 9.416MB for 80-byte allocation
05-16 15:59:48.869 7562-7562/com.dihong.testdcc E/0: ==============Java流程 checkApkUpdate 不许要自己管理update
05-16 15:59:48.870 7562-7562/com.dihong.testdcc E/LayaGameEngine: game_plugin_set_option key=localize value=false
05-16 15:59:48.871 7562-7562/com.dihong.testdcc E/LayaGameEngine: game_plugin_set_option key=gameUrl value=http://cdn.odds5.com/bmh5/testLayaDcc2/index.js
05-16 15:59:48.871 7562-7562/com.dihong.testdcc D/LayaGameEngine: game_plugin_init url =http://cdn.odds5.com/bmh5/testLayaDcc2/index.js
05-16 15:59:48.871 7562-7562/com.dihong.testdcc D/LayaGameEngine: url=http://cdn.odds5.com/bmh5/testLayaDcc2/index.js
05-16 15:59:48.871 7562-7562/com.dihong.testdcc D/RuntimeProxy: laya_get_value key=CacheDirInSdcard
05-16 15:59:48.871 7562-7562/com.dihong.testdcc D/RuntimeProxy: laya_get_value key=CacheDir
05-16 15:59:48.871 7562-7562/com.dihong.testdcc D/RuntimeProxy: laya_get_value key=ExpansionMainPath
05-16 15:59:48.871 7562-7562/com.dihong.testdcc D/RuntimeProxy: laya_get_value key=ExpansionPatchPath
05-16 15:59:48.871 7562-7562/com.dihong.testdcc I/layaConch3: m_interceptKey OK!
05-16 15:59:48.871 7562-7562/com.dihong.testdcc E/LayaConch5: >>>>>>>conchjar android-2.0.8
05-16 15:59:48.873 7562-7562/com.dihong.testdcc E/LayaConch5: plugin-----------------onCreate()
05-16 15:59:48.874 7562-7562/com.dihong.testdcc D/dalvikvm: Trying to load lib /data/app-lib/com.dihong.testdcc-2/liblayaair.so 0x422e3220
05-16 15:59:48.888 7562-7562/com.dihong.testdcc D/dalvikvm: Added shared lib /data/app-lib/com.dihong.testdcc-2/liblayaair.so 0x422e3220
05-16 15:59:48.888 7562-7562/com.dihong.testdcc I/LayaBox: setLocalizable:0
05-16 15:59:48.888 7562-7562/com.dihong.testdcc I/LayaBox: JNI setIsPlug:0
05-16 15:59:48.888 7562-7562/com.dihong.testdcc I/LayaBox: JNI seturl:http://cdn.odds5.com/bmh5/testLayaDcc2/index.js
05-16 15:59:48.889 7562-7562/com.dihong.testdcc E/LayaBox: =======================addStaticMethod=========zz41c82fe0
05-16 15:59:48.889 7562-7562/com.dihong.testdcc I/LayaBox: [########] layaair/game/browser/ExportJavaFunction
05-16 15:59:48.889 7562-7562/com.dihong.testdcc E/0: ==============Java流程 InitMainCanvas()
05-16 15:59:48.889 7562-7562/com.dihong.testdcc E/LayaConch5: plugin-----------------EngineStart() = /data/data/com.dihong.testdcc//LayaCache/localstorage
05-16 15:59:48.890 7562-7562/com.dihong.testdcc I/LayaBox: JNI localStoragePath=/data/data/com.dihong.testdcc//LayaCache/localstorage
05-16 15:59:48.891 7562-7562/com.dihong.testdcc I/MainCanvas: Android OpenGL ES Major Version 3
05-16 15:59:48.898 7562-7562/com.dihong.testdcc V/WebViewChromiumFactoryProvider: Binding Chromium to main looper Looper (main, tid 1) {422db6b0}
05-16 15:59:48.898 7562-7562/com.dihong.testdcc I/LibraryLoader: Expected native library version number "",actual native library version number ""
05-16 15:59:48.899 7562-7562/com.dihong.testdcc I/chromium: [INFO:library_loader_hooks.cc(116)] Chromium logging enabled: level = 0, default verbosity = 0
05-16 15:59:48.899 7562-7562/com.dihong.testdcc I/BrowserStartupController: Initializing chromium process, renderers=0
05-16 15:59:48.902 7562-7562/com.dihong.testdcc E/AudioManagerAndroid: BLUETOOTH permission is missing!
05-16 15:59:48.906 7562-7562/com.dihong.testdcc E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
05-16 15:59:48.971 7562-7585/com.dihong.testdcc W/chromium: [WARNING:proxy_service.cc(890)] PAC support disabled because there is no system implementation
05-16 15:59:48.980 7562-7562/com.dihong.testdcc D/EgretLoader: EgretLoader(Context context)
05-16 15:59:48.980 7562-7562/com.dihong.testdcc D/EgretLoader: The context is not activity
05-16 15:59:48.991 7562-7562/com.dihong.testdcc I/layaConch5: m_interceptKey OK!
05-16 15:59:48.991 7562-7562/com.dihong.testdcc I/LayaBox: JNI InitDLib
05-16 15:59:48.991 7562-7562/com.dihong.testdcc I/LayaBox: JNI InitDownLoadManager CachePath=/data/data/com.dihong.testdcc//LayaCache, assetroot=cache, APKExpansionMain=, APKExpansionPatch=
05-16 15:59:48.991 7562-7562/com.dihong.testdcc I/LayaBox: >>>>>>Thread Mode = double
05-16 15:59:48.991 7562-7562/com.dihong.testdcc I/LayaBox: This device supports vao
05-16 15:59:48.991 7562-7562/com.dihong.testdcc I/LayaBox: This device supports instanced draw
05-16 15:59:48.992 7562-7562/com.dihong.testdcc I/LayaBox: download thread num = 3
05-16 15:59:48.992 7562-7594/com.dihong.testdcc I/LayaBox: start thread:image decode,7594
05-16 15:59:49.002 7562-7562/com.dihong.testdcc I/LayaBox: createOpenALSource current num=10
05-16 15:59:49.003 7562-7562/com.dihong.testdcc E/LayaGameEngine: game_plugin_init soPath= jarfile= appcache=/data/data/com.dihong.testdcc/
05-16 15:59:49.003 7562-7562/com.dihong.testdcc E/LayaGameEngine: game_plugin_get_view
05-16 15:59:49.010 7562-7562/com.dihong.testdcc I/LayaBox: JNI OnAppResume
05-16 15:59:49.011 7562-7562/com.dihong.testdcc E/LayaBox: >>>>>>>>>>>>>>>>>>>>>>>>>>>>className:layaair.game.utility.LayaAudioMusic,methodName:resumeBackgroundMusic
05-16 15:59:49.011 7562-7562/com.dihong.testdcc E/LayaBox: >>>>>>>>>>>>before
05-16 15:59:49.012 7562-7562/com.dihong.testdcc E/LayaBox: >>>>>>>>>>>>after
05-16 15:59:49.071 7562-7562/com.dihong.testdcc D/OpenGLRenderer: Enabling debug mode 0
05-16 15:59:49.126 7562-7562/com.dihong.testdcc I/0: >>>>>>>>>>>>>The network has changed
05-16 15:59:49.127 7562-7562/com.dihong.testdcc I/0: connected type=1
05-16 15:59:49.171 7562-7577/com.dihong.testdcc I/LayaBox: JNI onGLReady tid=7577
05-16 15:59:49.171 7562-7577/com.dihong.testdcc I/LayaBox: JNI surface innersize changed : g_nInnerWidth=1536,g_nInnerHeight=2048
05-16 15:59:49.171 7562-7577/com.dihong.testdcc I/LayaBox: JNI init dev w=1536,h=2048
05-16 15:59:49.171 7562-7577/com.dihong.testdcc I/LayaBox: OpenGL ES version [OpenGL ES 3.1 334.00]
05-16 15:59:49.171 7562-7577/com.dihong.testdcc I/LayaBox: Start js scripts/apploader.js
05-16 15:59:49.215 7562-7562/com.dihong.testdcc W/ContextImpl: Implicit intents with startService are not safe: Intent { act=com.nvidia.ControllerMapper.START_SERVICE } android.content.ContextWrapper.bindService:517 android.content.ContextWrapper.bindService:517 com.nvidia.ControllerMapper.MapperClient$ServiceClient.connect:587
05-16 15:59:49.230 7562-7562/com.dihong.testdcc W/ContextImpl: Implicit intents with startService are not safe: Intent { act=com.nvidia.ControllerMapper.START_SERVICE } android.content.ContextWrapper.bindService:517 com.nvidia.ControllerMapper.MapperClient$ServiceClient.connect:587 com.nvidia.ControllerMapper.MapperClient.<init>:91
05-16 15:59:50.132 7562-7605/com.dihong.testdcc I/LayaBox: js thread started.
05-16 15:59:50.132 7562-7605/com.dihong.testdcc I/LayaBox: js debug closed
05-16 15:59:50.150 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:scripts/runtimeInit.js
05-16 15:59:50.152 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:scripts/apploader.js
05-16 15:59:50.197 7562-7605/com.dihong.testdcc E/LayaBox: >>>>>>>>>>>>>>>>>>>>>>>>>>>>className:layaair/game/browser/ExportJavaFunction,methodName:GetDeviceInfo
05-16 15:59:50.197 7562-7605/com.dihong.testdcc E/LayaBox: >>>>>>>>>>>>before
05-16 15:59:50.203 7562-7605/com.dihong.testdcc E/LayaBox: >>>>>>>>>>>>after
05-16 15:59:50.203 7562-7605/com.dihong.testdcc I/LayaBox: getDeviceInfo::get_Value={"guid":"da:38:87:b1:d3:77","os":"android","imei":[null],"phonemodel":"MI PAD","imsi":[null],"resolution":"2048*1536","dpi":320,"osversion":"4.4.4"}
05-16 15:59:50.204 7562-7605/com.dihong.testdcc E/LayaBox: >>>>>>>>>>>>>>>>>>>>>>>>>>>>className:layaair.game.utility.ProcessInfo,methodName:getTotalMem
05-16 15:59:50.204 7562-7605/com.dihong.testdcc E/LayaBox: >>>>>>>>>>>>before
05-16 15:59:50.205 7562-7605/com.dihong.testdcc E/LayaBox: >>>>>>>>>>>>after
05-16 15:59:50.205 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:app.json
05-16 15:59:50.206 7562-7605/com.dihong.testdcc I/LayaBox: require(/sdcard/layabox/scripts/scripts/index.js)
05-16 15:59:50.206 7562-7605/com.dihong.testdcc I/LayaBox: require(/sdcard/layabox/scripts/index.js)
05-16 15:59:50.207 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:scripts/index.js
05-16 15:59:50.208 7562-7605/com.dihong.testdcc I/LayaBox: require(/sdcard/layabox/scripts/async.js)
05-16 15:59:50.209 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:scripts/async.js
05-16 15:59:50.211 7562-7605/com.dihong.testdcc I/LayaBox: setCachePath:/data/data/com.dihong.testdcc//LayaCache//appCache/
05-16 15:59:50.212 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:cache/cdn.odds5.com_bmh5_testLayaDcc2/assetsid.txt
05-16 15:59:50.212 7562-7605/com.dihong.testdcc I/LayaBox: read index:/data/data/com.dihong.testdcc//LayaCache//appCache/ed5362fe/filetable.txt
05-16 15:59:50.213 7562-7605/com.dihong.testdcc I/LayaBox: require(/sdcard/layabox/scripts/config.js)
05-16 15:59:50.214 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:scripts/config.js
05-16 15:59:50.215 7562-7605/com.dihong.testdcc I/LayaBox: JSRuntime::callMethod {} demo.JSBridge bgColor
05-16 15:59:50.216 7562-7605/com.dihong.testdcc I/LayaBox: JSRuntime::callMethod {} demo.JSBridge setFontColor
05-16 15:59:50.216 7562-7605/com.dihong.testdcc I/LayaBox: JSRuntime::callMethod {} demo.JSBridge setTips
05-16 15:59:50.218 7562-7596/com.dihong.testdcc I/LayaBox: Download [ ]:http://cdn.odds5.com/bmh5/test ... .2937
05-16 15:59:50.268 7562-7577/com.dihong.testdcc I/LayaBox: >>>JCConchRender::clearAllData =1879602288
05-16 15:59:50.422 7562-7596/com.dihong.testdcc I/LayaBox: Download end:200
05-16 15:59:50.422 7562-7596/com.dihong.testdcc I/LayaBox: Downloaded http://cdn.odds5.com/bmh5/test ... 4.231 s=0 l=32
05-16 15:59:50.423 7562-7597/com.dihong.testdcc I/LayaBox: Download [ ]:http://cdn.odds5.com/bmh5/test ... 898a0
05-16 15:59:50.612 7562-7597/com.dihong.testdcc I/LayaBox: Download end:200
05-16 15:59:50.612 7562-7597/com.dihong.testdcc I/LayaBox: Downloaded http://cdn.odds5.com/bmh5/test ... 4.231 s=0 l=216
05-16 15:59:50.613 7562-7605/com.dihong.testdcc I/LayaBox: setCachePath:/data/data/com.dihong.testdcc//LayaCache//appCache/
05-16 15:59:50.614 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:cache/cdn.odds5.com_bmh5_testLayaDcc2/assetsid.txt
05-16 15:59:50.614 7562-7605/com.dihong.testdcc I/LayaBox: read index:/data/data/com.dihong.testdcc//LayaCache//appCache/ed5362fe/filetable.txt
05-16 15:59:50.619 7562-7596/com.dihong.testdcc I/LayaBox: Download [ ]:http://cdn.odds5.com/bmh5/testLayaDcc2/index.js
05-16 15:59:50.647 7562-7596/com.dihong.testdcc I/LayaBox: Download end:200
05-16 15:59:50.647 7562-7596/com.dihong.testdcc I/LayaBox: Downloaded http://cdn.odds5.com/bmh5/test ... 4.231 s=0 l=233
05-16 15:59:50.654 7562-7605/com.dihong.testdcc I/0: >>>>>>ExportJavaFunction setScreenOrientation=1
05-16 15:59:50.667 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:cache/cdn.odds5.com_bmh5_testLayaDcc2/f77b7ca7
05-16 15:59:50.671 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:cache/cdn.odds5.com_bmh5_testLayaDcc2/7ca6f240
05-16 15:59:50.674 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:cache/cdn.odds5.com_bmh5_testLayaDcc2/6e327e60
05-16 15:59:50.684 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:cache/cdn.odds5.com_bmh5_testLayaDcc2/6286d7b1
05-16 15:59:50.685 7562-7597/com.dihong.testdcc I/LayaBox: Download [ ]:http://cdn.odds5.com/bmh5/test ... 5e7bc
05-16 15:59:50.688 7562-7605/com.dihong.testdcc I/LayaBox: JSRuntime::callMethod {} demo.JSBridge hideSplash
05-16 15:59:51.100 7562-7597/com.dihong.testdcc I/LayaBox: Download end:200
05-16 15:59:51.100 7562-7597/com.dihong.testdcc I/LayaBox: Downloaded http://cdn.odds5.com/bmh5/test ... 4.231 s=6cf5e7bc l=7027
05-16 15:59:51.264 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:cache/cdn.odds5.com_bmh5_testLayaDcc2/fe0aee13
05-16 15:59:51.284 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:cache/cdn.odds5.com_bmh5_testLayaDcc2/7c9ba3cd
05-16 15:59:51.289 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:cache/cdn.odds5.com_bmh5_testLayaDcc2/7218dd72
05-16 15:59:51.291 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:cache/cdn.odds5.com_bmh5_testLayaDcc2/7b263850
05-16 15:59:51.292 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:cache/cdn.odds5.com_bmh5_testLayaDcc2/a01fb758
05-16 15:59:51.295 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:cache/cdn.odds5.com_bmh5_testLayaDcc2/9401f162
05-16 15:59:51.324 7562-7605/com.dihong.testdcc I/LayaBox: found the file in the package:cache/cdn.odds5.com_bmh5_testLayaDcc2/e76f4ef3




已邀请:

Laya用户

赞同来自: karin666

对于大家都普遍弱逼的情况下, 我只好无奈的弄了个临时的解决办法.
1.从layaconch.jar里的index.js取出index.js拷贝到assets\scripts下面, 程序会优先读取assets\scripts\index.js
此时可以魔改一下
       if (_inline) {
yield updateDcc();
if (!isDccOk) {
console.log("init dcc fail");
return;
}
}
if( !(yield dj_hook.OnDccOk()) )
{
if (window["onLayaInitError"]) {
window["onLayaInitError"]("Update index error");
}
return;
}
var data = yield asyncs.loadText(url);
for (var n = 0; n < 3 && !data; n++) {
data = yield asyncs.loadText(url);
}
2.使用ide的版本管理, 参与版本管理的文件, 因为文件名变了, 所以dcc更新策略有效
3. 第2条中, http://xxx/index.js 与 version.json 因为文件名不会变, 所以需要手动处理下
在 dj_hook.OnDccOk 里强制 从cdn下载两个 文件, 然后使用 window.appcache.updateFile  强制刷新缓存
 
如果没出错, 那之后就一切正常了

郭兆奎

赞同来自:

我这边用新版测试的话,结果是对的,日志也比较全
xhr.get url=http://cdn.odds5.com/bmh5/test ... .json
found the file in the package:fe0aee13

Erorr! _loadFromAssets returns incorrect contents! what happened!

Download [ ]:http://cdn.odds5.com/bmh5/test ... b5c32

有一步是从缓存取,但是会发现dcc不对,所以会重新下载。
 
你打印一下看看实际文件内容是否是正确的。会不会只是打印的问题。
如果升级容易,可以升级看看。

要回复问题请先

商务合作
商务合作