android
android copied to clipboard
Fresh app works anywhere, except on Redmi devices!
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:
W/dalvikvm(24260): in Lcom/tns/Platform;.callJSMethodNative:(ILjava/lang/String;IZ[Ljava/lang/Object;)Ljava/lang/Object; (CallVoidMethodA)
I/dalvikvm(24260): at com.tns.Platform.callJSMethodNative(Native Method)
I/dalvikvm(24260): at com.tns.Platform.dispatchCallJSMethodNative(Platform.java:816)
I/dalvikvm(24260): at com.tns.Platform.callJSMethod(Platform.java:715)
I/dalvikvm(24260): at com.tns.Platform.callJSMethod(Platform.java:694)
I/dalvikvm(24260): at com.tns.Platform.callJSMethod(Platform.java:684)
W/ErrorReport( 950): org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
W/ErrorReport( 950): at org.json.JSON.typeMismatch(JSON.java:111)
W/ErrorReport( 950): at org.json.JSONObject.<init>(JSONObject.java:159)
W/ErrorReport( 950): at org.json.JSONObject.<init>(JSONObject.java:172)
Redimi 2: Android 4.4 NativesScript 1.7.1
Copied from original issue: NativeScript/NativeScript#1851
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 example
-
tns platform add android
-
tns 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.txt
and you can paste send us the a.txt
file or pasting it's content somewhere.
- in the
app.js
file 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 JSONObject
points to the problem being related to Json.Parse
not being able to parse some HTML
(probably an error page).
Hi @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 -la
and paste the result here, so we can look for the size of each file there and find the right .jar
file 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.jar
Has 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
I guess it is related ti all devices that uses Miui Room, from Xiaomi
@Plamen5kov, is there some file you want check up?
@calebeaires can you try running the app with NativeScript 2.0
Their might be a problem with the installed Android ROM on the device, but we suspect that it might be a packaging problem during the build. Somehow you get a version of the app that has API metadata for 5.0 and newer.
Even the Examples NativeScript (from Play Store) stop working sometimes, but it is more stable than a dev nativescript app. I sent the report from it by Android FeedBack ANR and here is one of my apps ANR reports by some user.
(This fail occurs on NativeScript 2.0 too!)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Xiaomi/2014819/HM2014819:4.4.4/KTU84P/V7.1.3.0.KHJMICK:user/release-keys'
Revision: '0'
pid: 16388, tid: 16388, name: m.botoes.chaves >>> com.botoes.chaves <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
r0 00000000 r1 00004004 r2 00000006 r3 00000000
r4 00000006 r5 0000000b r6 00004004 r7 0000010c
r8 0000004c r9 416550d8 sl 00000001 fp 4e30bee6
ip bef9d2a0 sp bef9cdd0 lr 400e01e5 pc 400ef18c cpsr 000f0010
d0 74726f6261204d56 d1 74706d657474616e
d2 71655264412f7375 d3 697542247473656c
d4 0042003000370037 d5 0044003400380036
d6 0031003200350039 d7 000000b93f800000
d8 0000000000000000 d9 0000000000000000
d10 0000000000000000 d11 0000000000000000
d12 0000000000000000 d13 0000000000000000
d14 0000000000000000 d15 0000000000000000
d16 3ff0000000000000 d17 0000000000000000
d18 3dea39ef35793c76 d19 0919091a091a0919
d20 08fe08fd08fc08fb d21 3ff0000000000000
d22 08d808d708d508d6 d23 08d908da08da08d9
d24 091e091d091c091b d25 0920091f091d091e
d26 3fe62e42fefa39ef d27 0000000000000000
d28 08f108f208f208f1 d29 08f608f508f408f3
d30 0920092009200920 d31 0000000000000000
scr 62000013
backtrace:
#00 pc 0002218c /system/lib/libc.so (tgkill+12)
#01 pc 000131e1 /system/lib/libc.so (pthread_kill+48)
#02 pc 000133f5 /system/lib/libc.so (raise+10)
#03 pc 0001212b /system/lib/libc.so
#04 pc 00021a40 /system/lib/libc.so (abort+4)
#05 pc 00048c9f /system/lib/libdvm.so (dvmAbort+78)
#06 pc 0002a7c8 /system/lib/libdvm.so (IndirectRefTable::get(void*) const+116)
#07 pc 0004d593 /system/lib/libdvm.so (dvmDecodeIndirectRef(Thread*, _jobject*)+30)
#08 pc 00063367 /system/lib/libdvm.so (dvmCallMethodA(Thread*, Method const*, Object*, bool, JValue*, jvalue const*)+122)
#09 pc 0004f6e9 /system/lib/libdvm.so
#10 pc 0024e97f /data/app-lib/com.botoes.chaves-1/libNativeScript.so (tns::JEnv::CallVoidMethodA(_jobject*, _jmethodID*, jvalue*)+12)
#11 pc 00253c27 /data/app-lib/com.botoes.chaves-1/libNativeScript.so (tns::CallbackHandlers::CallJavaMethod(v8::Local<v8::Object> const&, std::string const&, std::string const&, tns::MetadataEntry*, bool, bool, v8::FunctionCallbackInfo<v8::Value> const&)+1182)
code around pc:
400ef16c e8bd00f0 e3700a01 912fff1e e2600000
400ef17c ea006ec9 e92d50f0 e3a07f43 ef000000
400ef18c e8bd50f0 e3700a01 912fff1e e2600000
400ef19c ea006ec1 e92d50f0 e3a070ee ef000000
400ef1ac e8bd50f0 e3700a01 912fff1e e2600000
400ef1bc ea006eb9 e1520003 8a00008c f5d1f040
400ef1cc e92d4001 e3520010 3a000024 e2603000
400ef1dc e213300f 0a00000e e0422003 e1b0cf83
400ef1ec 44d1e001 44c0e001 24d1c001 24d1e001
400ef1fc 24c0c001 24c0e001 e1b0ce83 aa000001
400ef20c f4a1030d f480031d 3a000001 f421070d
400ef21c f400071d e2522040 3a000006 f421020d
400ef22c f421420d f5d1f100 e2522040 f400022d
400ef23c f400422d 2afffff8 e2922020 3a000002
400ef24c f421020d e2422020 f400022d e2822020
400ef25c e3120010 0a000001 f4210a0d f4000a2d
code around lr:
400e01c4 447b4b13 42b3e010 6a1ed10e 44784811
400e01d4 ec84f7fb ea0cf00d 46224631 efcef00e
400e01e4 d00a3001 e00b2400 2b00681b 480ad1eb
400e01f4 44782403 ec72f7fb f001e002 6804fa23
400e0204 fa20f001 46206005 bf00bd70 0003b1ee
400e0214 0003b1e2 0003b1da 0003b1b6 bf7ef7ff
400e0224 4a3e4b3d e92d447b b08b43f0 4606589c
400e0234 6823460d 930946a1 fa04f001 8000f8d0
400e0244 d0482d00 f00f4628 280ffe9f d8444604
400e0254 ffe4f7ff d1064286 4629200f e8d6f00d
400e0264 d03c2800 482ee02e f7fb4478 482debb6
400e0274 e0154478 d11342b0 482b6a06 f7fb4478
400e0284 4a2aec2e 46332120 a801447a fb2ef013
400e0294 a8012101 fe4cf01a 46061c42 e011d104
400e02a4 28006800 e02cd1e6 46294630 f00d4622
400e02b4 1c43e912 d11e4607 f9c4f001 29046801
Xiaomi is getting massively populated on Brazil since it has open an office here.
I tried to run an app I have made on past, using nativescript 1.7.1. App is installed and running. Is there some other information I can give you to help find the solution to this problem?
Hi @calebeaires
- Does the app fail on all devices or just "Xiaomi".
- What is the android api level of the failing devices? (e.g 4.4.4, 5.0, 6.0)
- Have you tried running the app with cli 2.0 instead of 1.7.1?
Hi. @Plamen5kov
- Just Xiaomi Redmi 2 Prime (I tested on more then one Xiaomi devices).
- Android 4.4.4 KTU84P (Miui Global 7.1.3.0)
- I didnt run a new build on my mac with cli 1.7.1. I just installed an app I have made and published on Play Store when Nativescript was on 1.7.1. This app dont close after launch, works like a charm and stay functional on xiaomi redmi device: app play store link.
- Like an simple and pure nativescript 2.0
tns create blank-app
, another app I have made with cli 2.0 closes as soon as the app is opened (app link).
Do you need some file from /system/framework to take a look at this problem!
@calebeaires can you send me both framework.jar
and framework2.jar
from a redmi device.
adb pull /system/framework/framework.jar .
adb pull /system/framework/framework2.jar .
I've looked through the framework jars and I believe there are no different than the common ones for the specific android api level, so the problem might be somewhere else.
Could you try running the following NativeScript application using a newly installed cli ^2.0.1, on both redmi and other devices, so we can spot if there is difference in behavior.
How to install new cli:
npm uninstall nativescript -g
npm install nativescript -g
After you've installed the new cli run tns --version
-> 2.0.1, just to be sure, and follow these steps:
- run commands
tns create redmiapp
cd redmiapp
tns platform add android
- go to
redmiapp/app/app.js
and append the following code:
//try {
var bundleInstance = new android.os.Bundle();
bundleInstance.putInt("myInt", 123);
//}
//catch (e ) {
//}
- run application
I hope you get back to me with the results.
@calebeaires we haven't heard from you in a while, so we're closing this issue. Feel free to reopen it.
I had the same problem on my Xiaomi mi5 device and I found that it has to do with the MIUI permissions. If you disabled the options from Xiaomi's Security app everything will work fine. The solution is simple:
- Open the Security application
- Press the gear icon (top right)
- Go to the "Permissions" page
- Disable the option "Install via USB"
- Reboot if necessary (depends on the MIUI version)
an getting same error on my redmi 2:
W/dalvikvm(24921): in Lcom/tns/Runtime;.callJSMethodNative:(IILjava/lang/String;IZ[Ljava/lang/Object;)Ljava/lang/Object; (CallIntMethodA) I/dalvikvm(24921): at com.tns.Runtime.callJSMethodNative(Native Method) I/dalvikvm(24921): at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:865) I/dalvikvm(24921): at com.tns.Runtime.callJSMethodImpl(Runtime.java:730) I/dalvikvm(24921): at com.tns.Runtime.callJSMethod(Runtime.java:716) I/dalvikvm(24921): at com.tns.Runtime.callJSMethod(Runtime.java:697) I/dalvikvm(24921): at com.tns.Runtime.callJSMethod(Runtime.java:687) I/dalvikvm(24921): at com.tns.Runtime.callJSMethodNative(Native Method) I/dalvikvm(24921): at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:865) I/dalvikvm(24921): at com.tns.Runtime.callJSMethodImpl(Runtime.java:730) I/dalvikvm(24921): at com.tns.Runtime.callJSMethod(Runtime.java:716) I/dalvikvm(24921): at com.tns.Runtime.callJSMethod(Runtime.java:697) I/dalvikvm(24921): at com.tns.Runtime.callJSMethod(Runtime.java:687) W/ErrorReport( 998): org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject W/ErrorReport( 998): at org.json.JSON.typeMismatch(JSON.java:111) W/ErrorReport( 998): at org.json.JSONObject.<init>(JSONObject.java:159) W/ErrorReport( 998): at org.json.JSONObject.<init>(JSONObject.java:172) chromium: [INFO:library_loader_hooks.cc(116)] Chromium logging enabled: level = 0, default verbosity = 0 I/BrowserStartupController(25262): Initializing chromium process, renderers=0
Have same issues on Xiaomi and 4.4.4. Any progress?
@igorpetrov it should be fixed https://github.com/NativeScript/android-runtime/issues/628
Client reported this issue again with XIaomi Redmi 1 device and with NativeScript 2.5.0, More can be found info n t.1088444
dump for bundle instance from ^^*
var extras = intent.getExtras(); // and extras is null
// I tried to add below lines, but it gives error "TypeError: bundleInstance.putInt is not a function"
var bundleInstance = new android.os.Bundle();
bundleInstance.putInt("myInt", 123);
When I tried to console.dump bundleInstance, I get:
JS: === dump(): dumping members ===
JS: {}
JS: === dump(): dumping function and properties names ===
JS: <init>()
JS: clear()
JS: clone()
JS: describeContents()
JS: getBinder()
JS: getBundle()
JS: getByte()
JS: getByteArray()
JS: getChar()
JS: getCharArray()
JS: getCharSequence()
JS: getCharSequenceArray()
JS: getCharSequenceArrayList()
JS: getClassLoader()
JS: getFloat()
JS: getFloatArray()
JS: getIntegerArrayList()
JS: getParcelable()
JS: getParcelableArray()
JS: getParcelableArrayList()
JS: getSerializable()
JS: getShort()
JS: getShortArray()
JS: getSize()
JS: getSizeF()
JS: getSparseParcelableArray()
JS: getStringArrayList()
JS: hasFileDescriptors()
JS: putAll()
JS: putBinder()
JS: putBundle()
JS: putByte()
JS: putByteArray()
JS: putChar()
JS: putCharArray()
JS: putCharSequence()
JS: putCharSequenceArray()
JS: putCharSequenceArrayList()
JS: putFloat()
JS: putFloatArray()
JS: putIntegerArrayList()
JS: putParcelable()
JS: putParcelableArray()
JS: putParcelableArrayList()
JS: putSerializable()
JS: putShort()
JS: putShortArray()
JS: putSize()
JS: putSizeF()
JS: putSparseParcelableArray()
JS: putStringArrayList()
JS: readFromParcel()
JS: setClassLoader()
JS: toString()
JS: writeToParcel()
JS: equals()
JS: finalize()
JS: getClass()
JS: hashCode()
JS: notify()
JS: notifyAll()
JS: wait()
JS: === dump(): finished ===