Repository navigation
Fresh app works anywhere, except on Redmi devices! #404
Description
Activity
In my opinion JSON.parse() is failing since some service/server returned HTML (most probably server error) instead expected JSON.
From @calebeaires on March 25, 2016 15:11
Do you have some workaround to fix it?
Any more info what components are used or how to replicate this behavior will be helpful. Do you get this error in some of our default modules? Or this is somewhere else in your app?
From @calebeaires on March 28, 2016 14:57
This error get on a pure nativescript install.
tns create exampletns platform add androidtns run android
This works on every device I have here (motorola, samsung, nexus), but when I run it on Redmi 2 Prime, from Xiaomi, the app stop working and it is closed.
I guess it is not the case, but for notice Redmi uses android 64-bit version
Some news about this issue!?
Hi @calebeaires,
I couldn't reproduce the problem on nexus 6 (x64) and on several emulators, which leads me to believe it's a specific problem with the Redmi 2 devices as you suggested. Unfortunately we don't have access to such devices.
If you can provide us with the full log maybe we can assist you to find the problem. You can get the full- log by running the command
adb logcat > a.txtand you can paste send us the
a.txtfile or pasting it's content somewhere.- in the
app.jsfile at the top of the file write:
__enableVerboseLogging();As @enchev pointed out, this line:
org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObjectpoints to the problem being related to
Json.Parsenot being able to parse someHTML(probably an error page).Debug logcat and terminal logs
Reacted by Harvey WooReacted by Calebe AiresHi @calebeaires,
please do:adb pull /system/framework/framework.jar .and send us the file
framework.jar
The file will be downloaded in the directory in which you ran the command.Here is the file. I had to zip it, so I could send it from github
file.zip@calebeaires, because the file contains no classes in it, can you list all files in the folder:
adb shell cd /system/framework ls -laand paste the result here, so we can look for the size of each file there and find the right
.jarfile to download.-rw-r--r-- root root 27181 2016-04-26 15:27 WfdCommon.jar -rw-r--r-- root root 26181 2016-04-26 15:27 activation.jar -rw-r--r-- root root 19315 2016-04-26 15:27 am.jar -rw-r--r-- root root 346569 2016-04-26 15:27 android-support-v13.jar -rw-r--r-- root root 341660 2016-04-26 15:27 android-support-v4.jar -rw-r--r-- root root 95216 2016-04-26 15:27 android-support-v7-recyclerview.jar -rw-r--r-- root root 134742 2016-04-26 15:27 android.policy.jar -rw-r--r-- root root 74045 2016-04-26 15:27 android.test.runner.jar -rw-r--r-- root root 549364 2016-04-26 15:27 apache-xml.jar -rw-r--r-- root root 6683 2016-04-26 15:27 bmgr.jar -rw-r--r-- root root 408620 2016-04-26 15:27 bouncycastle.jar -rw-r--r-- root root 2726 2016-04-26 15:27 bu.jar -rw-r--r-- root root 776041 2016-04-26 15:27 cloud-common.jar -rw-r--r-- root root 7354 2016-04-26 15:27 cneapiclient.jar -rw-r--r-- root root 8507 2016-04-26 15:27 com.android.location.provider.jar -rw-r--r-- root root 4590 2016-04-26 15:27 com.android.media.remotedisplay.jar -rw-r--r-- root root 160503 2016-04-26 15:27 com.google.android.maps.jar -rw-r--r-- root root 34818 2016-04-26 15:27 com.google.android.media.effects.jar -rw-r--r-- root root 740 2016-04-26 15:27 com.google.widevine.software.drm.jar -rw-r--r-- root root 16814 2016-04-26 15:27 com.qti.dpmframework.jar -rw-r--r-- root root 11702 2016-04-26 15:27 com.qti.snapdragon.sdk.display.jar -rw-r--r-- root root 19090 2016-04-26 15:27 com.qualcomm.location.vzw_library.jar -rw-r--r-- root root 78770 2016-04-26 15:27 com.quicinc.cne.jar -rw-r--r-- root root 145415 2016-04-26 15:27 conscrypt.jar -rw-r--r-- root root 7716 2016-04-26 15:27 content.jar -rw-r--r-- root root 11711 2016-04-26 15:27 core-junit.jar -rw-r--r-- root root 1234761 2016-04-26 15:27 core-libart.jar -rw-r--r-- root root 1232853 2016-04-26 15:27 core.jar -rw-r--r-- root root 1222817 2016-04-26 15:27 ext.jar -rw-r--r-- root root 833528 2016-04-26 15:27 framework-ext-res.apk -rw-r--r-- root root 9211913 2016-04-26 15:27 framework-res.apk -rw-r--r-- root root 3857473 2016-04-26 15:27 framework.jar -rw-r--r-- root root 1294489 2016-04-26 15:27 framework2.jar -rw-r--r-- root root 69510 2016-04-26 15:27 gson.jar -rw-r--r-- root root 3373 2016-04-26 15:27 ime.jar -rw-r--r-- root root 3889 2016-04-26 15:27 imslibrary.jar -rw-r--r-- root root 4703 2016-04-26 15:27 input.jar -rw-r--r-- root root 26233 2016-04-26 15:27 javax.obex.jar -rw-r--r-- root root 4205 2016-04-26 15:27 media_cmd.jar -rw-r--r-- root root 31764 2016-04-26 15:27 microlog4android.jar -rw-r--r-- root root 712 2016-04-26 15:27 miui-update.jar -rw-r--r-- root root 382463 2016-04-26 15:27 miuipushsdkshared.jar lrwxrwxrwx root root 2016-04-26 15:29 miuisdk.jar -> /data/miui/miuisdk.apk -rw-r--r-- root root 33879 2016-04-26 15:27 miuistatssdkshared.jar lrwxrwxrwx root root 2016-04-26 15:29 miuisystem.jar -> /data/miui/miuisystem.apk -rw-r--r-- root root 68503 2016-04-26 15:27 mms-common.jar -rw-r--r-- root root 50496 2016-04-26 15:27 monkey.jar -rw-r--r-- root root 1193 2016-04-26 15:27 oem-services.jar -rw-r--r-- root root 90615 2016-04-26 15:27 okhttp.jar -rw-r--r-- root root 2525 2016-04-26 15:27 org.codeaurora.Performance.jar -rw-r--r-- root root 50174 2016-04-26 15:27 picasso.jar -rw-r--r-- root root 18729 2016-04-26 15:27 pm.jar -rw-r--r-- root root 204407 2016-04-26 15:27 protobuf.jar -rw-r--r-- root root 9014 2016-04-26 15:27 qcmediaplayer.jar -rw-r--r-- root root 40482 2016-04-26 15:27 qcnvitems.jar -rw-r--r-- root root 24349 2016-04-26 15:27 qcom.fmradio.jar -rw-r--r-- root root 48193 2016-04-26 15:27 qcrilhook.jar -rw-r--r-- root root 9462 2016-04-26 15:27 qmapbridge.jar -rw-r--r-- root root 16946 2016-04-26 15:27 rcsimssettings.jar -rw-r--r-- root root 111723 2016-04-26 15:27 rcsservice.jar -rw-r--r-- root root 4247 2016-04-26 15:27 requestsync.jar -rw-r--r-- root root 63536 2016-04-26 15:27 services-ext.jar -rw-r--r-- root root 1588777 2016-04-26 15:27 services.jar -rw-r--r-- root root 4115 2016-04-26 15:27 settings.jar -rw-r--r-- root root 4620 2016-04-26 15:27 svc.jar -rw-r--r-- root root 622294 2016-04-26 15:27 telephony-common.jar -rw-r--r-- root root 46297 2016-04-26 15:27 uiautomator.jar -rw-r--r-- root root 62070 2016-04-26 15:27 vcard.jar -rw-r--r-- root root 27937 2016-04-26 15:27 videocallapi.jar -rw-r--r-- root root 68031 2016-04-26 15:27 voip-common.jar -rw-r--r-- root root 37585 2016-04-26 15:27 volley.jar drwxr-xr-x root root 2016-04-26 15:28 webview -rw-r--r-- root root 292644 2016-04-26 15:27 webviewchromium.jar -rw-r--r-- root root 3411 2016-04-26 15:27 wm.jar -rw-r--r-- root root 236774 2016-04-26 15:27 zxing.jarHas any progress ?
Found an issue with this device. we need to investigate further why this is happening only on Redmi 2 devices. I created another issue #445 to track it's progress
25 remaining items
We don't have redmi devices, and it's hard to reproduce the problem without one, but we'll try and fix it as soon as possible.
@shmox, that's a great idea. Please provide us with a link of instructions of some sort and I'll be sure to try and reproduce the problem.
Reacted by Peter KanevHey @shmox @Plamen5kov I think the problem is not in the MIUI ROM version but the problem is in the android version. I find the problem only happened on MIUI ROM that use kitkat 4.4.4 as the android os version. FYI, MIUI has its own versioning with different android OS, for example, you can find the exact same version of MIUI 8 in different devices but when you check the android version, you will find that they have different version like Kitkat and Lolipop
Why?
Because finally I can run my nativescript app without problem after I buy a new Xiaomi device that run on Android 6.0.1 but still have the same MIUI version 8
Reacted by Plamen Petkov@hamzahppa thanks for the detailed information, now we have something to go on. We'll investigate further as soon as possible.
Reacted by Peter Kanev and pittssOS: Android 4.4.4 (MIUI 7)
App: Examples NativeScript
https://play.google.com/store/apps/details?id=org.nativescript.examples
Status: Work fineApp: NativeScript Playground
https://play.google.com/store/apps/details?id=org.nativescript.play
Status: Crash on startup (without any errors show)App: NativeScript Preview
https://play.google.com/store/apps/details?id=org.nativescript.preview
Status: Crash on startup (with errors)EXCEPTION
An uncaught Exception occurred on main thread. java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.preview/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed TypeError: activityInfo.metaData.getInt is not a function File: "file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js, line: 610, column: 18 StackTrace: Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/application/application.js', line: 143, column: 60 Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/application/application.js', line: 165, column: 13 Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 610, column: 19 Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 20, column: 25 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java) at android.app.ActivityThread.access$900(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java) at android.os.Handler.dispatchMessage(Handler.java) at android.os.Looper.loop(Looper.java) at android.app.ActivityThread.main(ActivityThread.java) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) at dalvik.system.NativeStart.main(Native Method) Caused by: com.tns.NativeScriptException: Calling js method onCreate failed TypeError: activityInfo.metaData.getInt is not a function File: "file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js, line: 610, column: 18 StackTrace: Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/application/application.js', line: 143, column: 60 Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/application/application.js', line: 165, column: 13 Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 610, column: 19 Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 20, column: 25 at com.tns.Runtime.callJSMethodNative(Native Method) at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088) at com.tns.Runtime.callJSMethodImpl(Runtime.java:970) at com.tns.Runtime.callJSMethod(Runtime.java:957) at com.tns.Runtime.callJSMethod(Runtime.java:941) at com.tns.Runtime.callJSMethod(Runtime.java:933) at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:13) at android.app.Activity.performCreate(Activity.java) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java) ... 12 moreLOGCAT
D/dalvikvm( 4182): Trying to load lib /data/app-lib/org.nativescript.preview-2/libNativeScript.so 0x41ad4fe0 D/dalvikvm( 4182): Added shared lib /data/app-lib/org.nativescript.preview-2/libNativeScript.so 0x41ad4fe0 I/TNS.Native( 4182): NativeScript Runtime Version 3.3.1, commit 368c29d75ca1cb632aa1efd8f822bacdd3c4da41 D/TNS.Native( 4182): JNI_ONLoad D/TNS.Native( 4182): JNI_ONLoad END I/dalvikvm( 4182): Could not find method android.content.Context.getNoBackupFilesDir, referenced from method com.tns.DefaultExtractPolicy.getFilesDir W/dalvikvm( 4182): VFY: unable to resolve virtual method 438: Landroid/content/Context;.getNoBackupFilesDir ()Ljava/io/File; D/dalvikvm( 4182): VFY: replacing opcode 0x6e at 0x0006 D/TNS.Native( 4182): Failed to load snapshot: dlopen failed: library "libsnapshot.so" not found D/TNS.Native( 4182): V8 version 5.5.372.32 D/TNS.Native( 4182): lenNodes=97776, lenNames=963993, lenValues=1237507 D/TNS.Native( 4182): time=26 I/UpdaterTask( 4182): Successfully set FLAG_KEEP_SCREEN_ON D/AndroidRuntime( 4182): Shutting down VM W/dalvikvm( 4182): threadid=1: thread exiting with uncaught exception (group=0x4178fd58) W/System.err( 4182): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.preview/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: W/System.err( 4182): Calling js method onCreate failed W/System.err( 4182): TypeError: activityInfo.metaData.getInt is not a function W/System.err( 4182): File: "file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js, line: 610, column: 18 W/System.err( 4182): StackTrace: W/System.err( 4182): Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/application/application.js', line: 143, column: 60 W/System.err( 4182): Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/application/application.js', line: 165, column: 13 W/System.err( 4182): Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 610, column: 19 W/System.err( 4182): Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 20, column: 25 W/System.err( 4182): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java) W/System.err( 4182): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java) W/System.err( 4182): at android.app.ActivityThread.access$900(ActivityThread.java) W/System.err( 4182): at android.app.ActivityThread$H.handleMessage(ActivityThread.java) W/System.err( 4182): at android.os.Handler.dispatchMessage(Handler.java) W/System.err( 4182): at android.os.Looper.loop(Looper.java) W/System.err( 4182): at android.app.ActivityThread.main(ActivityThread.java) W/System.err( 4182): at java.lang.reflect.Method.invokeNative(Native Method) W/System.err( 4182): at java.lang.reflect.Method.invoke(Method.java:515) W/System.err( 4182): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) W/System.err( 4182): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) W/System.err( 4182): at dalvik.system.NativeStart.main(Native Method) W/System.err( 4182): Caused by: com.tns.NativeScriptException: W/System.err( 4182): Calling js method onCreate failed W/System.err( 4182): TypeError: activityInfo.metaData.getInt is not a function W/System.err( 4182): File: "file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js, line: 610, column: 18 W/System.err( 4182): StackTrace: W/System.err( 4182): Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/application/application.js', line: 143, column: 60 W/System.err( 4182): Frame: function:'', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/application/application.js', line: 165, column: 13 W/System.err( 4182): Frame: function:'ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 610, column: 19 W/System.err( 4182): Frame: function:'NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.preview/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 20, column: 25 W/System.err( 4182): at com.tns.Runtime.callJSMethodNative(Native Method) W/System.err( 4182): at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088) W/System.err( 4182): at com.tns.Runtime.callJSMethodImpl(Runtime.java:970) W/System.err( 4182): at com.tns.Runtime.callJSMethod(Runtime.java:957) W/System.err( 4182): at com.tns.Runtime.callJSMethod(Runtime.java:941) W/System.err( 4182): at com.tns.Runtime.callJSMethod(Runtime.java:933) W/System.err( 4182): at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:13) W/System.err( 4182): at android.app.Activity.performCreate(Activity.java) W/System.err( 4182): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java) W/System.err( 4182): ... 12 more I/Process ( 4182): Sending signal. PID: 4182 SIG: 9Update: Unfortunately, we won't be able to investigate this issue for some time, but if anyone decides to try and fix it, we'll try and help any volunteers.
2016-2018 still can't run in miui phone android 4.4.x
2016-2019 still can't run in miui phone android 4.4.4 (redmi 2)
Reacted by Peter KanevThis was never a trivial fix. Perhaps it's time to close the issue and get a more modern device with an OS from more recent years.
Reacted by Tommy Hendrawan, alqabali and Alejandra StamatoThis was never a trivial fix. Perhaps it's time to close the issue and get a more modern device with an OS from more recent years.
Well, got quite number of user on my country still use that device. It become serious issue now on our production apps
It's hard to find xiaomi emu, especially on Macos.
I have the same problem with miui 10.3 4
Same issue with miui 10.2.1, please anyone provide any solution.
Same issue with miui 10.2.1, please anyone provide any solution.
Which version of android are you running ?


From @calebeaires on March 25, 2016 14:50
Fresh Nativescript app (with no modification) stop working on Xiaomi Redimi 2 Prime smartphones. I have tested the same app on Sansung, Nexus, Genymotion and Android emulator. Everting goes well, except on Redimi 2. Here are the reporting log:
Redimi 2: Android 4.4
NativesScript 1.7.1
Copied from original issue: NativeScript/NativeScript#1851