2.3.3 android 打包之后闪退问题

2.3.0打包之后升级上去,打包出来直接闪退了,堆栈如下:

04/25 16:01:28: Launching ‘IndonesiaHeJi’ on Xiaomi Redmi K30.
$ adb shell am start -n “com.cls.indonesia/org.cocos2dx.javascript.AppActivity” -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 8484 on device ‘xiaomi-redmi_k30-362d27eb’.
Capturing and displaying logcat messages from application. This behavior can be disabled in the “Logcat output” section of the “Debugger” settings page.
I/Perf: Connecting to perf service.
W/com.facebook.UserSettingsManager: Please set a value for AutoLogAppEventsEnabled. Set the flag to TRUE if you want to collect app install, app launch and in-app purchase events automatically. To request user consent before collecting data, set the flag value to FALSE, then change to TRUE once user consent is received. Learn more: https://developers.facebook.com/docs/app-events/getting-started-app-events-android#disable-auto-events.
You haven’t set a value for AdvertiserIDCollectionEnabled. Set the flag to TRUE if you want to collect Advertiser ID for better advertising and analytics results. To request user consent before collecting data, set the flag value to FALSE, then change to TRUE once user consent is received. Learn more: https://developers.facebook.com/docs/app-events/getting-started-app-events-android#disable-auto-events.
I/FeatureParser: can’t find phoenix.xml in assets/device_features/,it may be in /system/etc/device_features
W/m.cls.indonesia: type=1400 audit(0.0:133052): avc: denied { read } for name=“u:object_r:vendor_displayfeature_prop:s0” dev=“tmpfs” ino=21318 scontext=u:r:untrusted_app:s0:c31,c257,c512,c768 tcontext=u:object_r:vendor_displayfeature_prop:s0 tclass=file permissive=0
E/libc: Access denied finding property “ro.vendor.df.effect.conflict”
E/Perf: Fail to get file list com.cls.indonesia
getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
Fail to get file list com.cls.indonesia
E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/Cocos2dxActivity: Cocos2dxActivity onCreate: org.cocos2dx.javascript.AppActivity@11043b5, savedInstanceState: null
W/Binder:intercep: type=1400 audit(0.0:133053): avc: denied { getattr } for path="/data/data/com.miui.contentcatcher" dev=“dm-8” ino=5563 scontext=u:r:untrusted_app:s0:c31,c257,c512,c768 tcontext=u:object_r:system_app_data_file:s0 tclass=dir permissive=0
type=1400 audit(0.0:133054): avc: denied { getattr } for path="/data/data/com.miui.contentcatcher" dev=“dm-8” ino=5563 scontext=u:r:untrusted_app:s0:c31,c257,c512,c768 tcontext=u:object_r:system_app_data_file:s0 tclass=dir permissive=0
I/m.cls.indonesi: The ClassLoaderContext is a special shared library.
I/m.cls.indonesi: The ClassLoaderContext is a special shared library.
D/JniHelper: JniHelper::setJavaVM(0x6fd48a8380), pthread_self() = 482555731664
D/main: cocos_jni_env_init
D/Cocos2dxHelper: isSupportLowLatency:true
D/Cocos2dxHelper: sampleRate: 48000, framesPerBuffer: 144
D/JniImp: nativeSetAudioDeviceInfo: sampleRate: 48000, bufferSizeInFrames: 144
W/m.cls.indonesi: Accessing hidden method Lmiui/contentcatcher/sdk/Token;->(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V (greylist, linking, allowed)
W/m.cls.indonesi: Accessing hidden method Lmiui/contentcatcher/InterceptorProxy;->getWorkThread()Landroid/os/HandlerThread; (greylist, linking, allowed)
D/ViewContentFactory: initViewContentFetcherClass
D/ViewContentFactory: getInterceptorPackageInfo
W/m.cls.indonesi: Accessing hidden method Landroid/app/AppGlobals;->getInitialApplication()Landroid/app/Application; (greylist, linking, allowed)
D/ViewContentFactory: getInitialApplication took 1ms
packageInfo.packageName: com.miui.catcherpatch
D/ViewContentFactory: initViewContentFetcherClass took 14ms
I/ContentCatcher: ViewContentFetcher : ViewContentFetcher
D/ViewContentFactory: createInterceptor took 14ms
W/m.cls.indonesi: Accessing hidden method Lmiui/contentcatcher/sdk/ContentCatcherManager;->getInstance()Lmiui/contentcatcher/sdk/ContentCatcherManager; (greylist, linking, allowed)
W/System.err: org.json.JSONException: No value for serviceClassPath
W/m.cls.indonesi: Accessing hidden method Lmiui/contentcatcher/sdk/ContentCatcherManager;->registerContentInjector(Lmiui/contentcatcher/sdk/Token;Lmiui/contentcatcher/sdk/injector/IContentDecorateCallback;)V (greylist, linking, allowed)
W/System.err: at org.json.JSONObject.get(JSONObject.java:399)
at org.json.JSONObject.getJSONArray(JSONObject.java:594)
at org.cocos2dx.javascript.SDKWrapper.loadSDKClass(SDKWrapper.java:70)
at org.cocos2dx.javascript.SDKWrapper.setGLSurfaceView(SDKWrapper.java:102)
at org.cocos2dx.javascript.AppActivity.onCreateView(AppActivity.java:59)
at org.cocos2dx.lib.Cocos2dxActivity.addSurfaceView(Cocos2dxActivity.java:469)
at org.cocos2dx.lib.Cocos2dxActivity.init(Cocos2dxActivity.java:263)
at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:356)
at com.sdkbox.plugin.SDKBoxActivity.onCreate(SDKBoxActivity.java:11)
at org.cocos2dx.javascript.AppActivity.onCreate(AppActivity.java:39)
at android.app.Activity.performCreate(Activity.java:7893)
at android.app.Activity.performCreate(Activity.java:7880)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3279)
W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3443)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2040)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7520)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
D/Cocos2dxActivity: model=Redmi K30
product=phoenix
isEmulator=false
W/m.cls.indonesi: Accessing hidden method Lmiui/contentcatcher/sdk/ContentCatcherManager;->getPageConfig(Lmiui/contentcatcher/sdk/Token;)Lmiui/contentcatcher/sdk/data/PageConfig; (greylist, linking, allowed)
W/m.cls.indonesi: Accessing hidden method Lmiui/contentcatcher/sdk/data/PageConfig;->getFeatures()Ljava/util/ArrayList; (greylist, linking, allowed)
Accessing hidden method Lmiui/contentcatcher/sdk/data/PageConfig;->getCatchers()Ljava/util/ArrayList; (greylist, linking, allowed)
I/SDKBOX_CORE: Sdkbox Droid starting.
Sdkbox got VM.
Sdkbox jni initialized.
D/SDKBOX_CORE: Loaded 0 tracking info _elements.
D/Cocos2dxActivity: onResume()
E/TrackingInfo: reqAdvertisingIdentifier Exception:java.lang.ClassNotFoundException: com.google.android.gms.ads.identifier.AdvertisingIdClient
W/Looper: Slow Looper main: Activity com.cls.indonesia/org.cocos2dx.javascript.AppActivity is 376ms late (wall=0ms running=0ms ClientTransaction{ callbacks=[android.app.servertransaction.TopResumedActivityChangeItem] }) because of 3 msg, msg 2 took 210ms (seq=2 late=2ms h=android.app.ActivityThread$H w=110), msg 3 took 165ms (seq=3 late=211ms h=android.app.ActivityThread$H w=159)
I/AdrenoGLES: QUALCOMM build : 663be55, I724753c5e3
Build Date : 11/06/19
OpenGL ES Shader Compiler Version: EV031.27.05.02
Local Branch : mybranchea006718-00ab-f18a-9c1c-5cb90179c3e0
Remote Branch : quic/gfx-adreno.lnx.1.0.r84-rel
Remote Branch : NONE
Reconstruct Branch : NOTHING
Build Config : S P 8.0.12 AArch64
I/AdrenoGLES: PFP: 0x016ee187, ME: 0x00000000
W/AdrenoUtils: <ReadGpuID_from_sysfs:194>: Failed to open /sys/class/kgsl/kgsl-3d0/gpu_model
ReadGpuID:218: Failed to read chip ID from gpu_model. Fallback to use the GSL path
D/main: cocos_android_app_init
D/JniImp: nativeInit: 2400, 1080,
D/jswrapper: Initializing V8, version: 7.5.288.30
W/Gralloc3: mapper 3.x is not supported
D/jswrapper: libuv version: 1.13.1
D/jswrapper: Debugger listening…, visit [ chrome-devtools://devtools/bundled/js_app.html?v8only=true&ws=0.0.0.0:6086/00010002-0003-4004-8005-000600070008 ] in chrome browser to debug!
For help see https://nodejs.org/en/docs/inspector
A/libc: C:/CocosDashboard_1.0.6/resources/.editors/Creator/2.3.3/resources/cocos2d-x/cocos/scripting/js-bindings/jswrapper/Value.cpp:539: se::Object *se::Value::toObject() const: assertion “isObject()” failed
A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 8546 (GLThread 22928), pid 8484 (m.cls.indonesia)
D/Cocos2dxActivity: onWindowFocusChanged() hasFocus=true
D/Cocos2dxActivity: onPause()
好像是类型的问题,看起来。

有用sdkbox吧,用了就会crash的,我也还没有解决,等官方

嗯嗯,已经回退了

才发现这个贴, 其实这个问题的本质并不是 SDKBox , 而是gradle版本, tools 升级后, 对应的 js 资源并没有打包到 apk 包中, 从而导致了这个问题.

SDKBox 本质就是一个帮助你接入各种 SDK 的工具, 所以如果 对应的 SDK 需要升级, 那肯定会升的.

所以其实这里的事就是修改 build.gradle 里的 copy 操作, 将 js 资源 拷贝到对应的apk中去.

Cocos Creator Android 工程的升级有很多介绍, 可以参考这个, 当然还有很多其它教程, 多看看.
https://mp.weixin.qq.com/s/-6iZKiUh61LLrqNJq3u6Pg