W/dalvikvm( 1473):              in Landroid/media/MediaScanner;.processFile (Ljava/lang/String;Ljava/lang/String;Landroid/media/MediaScannerClient;)V (NewStringUTF)
I/dalvikvm( 1473): "MediaScannerService" prio=5 tid=10 NATIVE
I/dalvikvm( 1473):   | group="main" sCount=0 dsCount=0 s=N obj=0x45f1ea18 self=0x22f0d0
I/dalvikvm( 1473):   | sysTid=1647 nice=11 sched=3/0 cgrp=unknown handle=2229456
I/dalvikvm( 1473):   at android.media.MediaScanner.processFile(Native Method)
I/dalvikvm( 1473):   at android.media.MediaScanner.access$500(MediaScanner.java:103)

这个就是蛋疼的地方,

造成该问题的原因是没有通过虚拟机的checkjni检查。代码在dalvik/vm/CheckJni.c

/*
 * Verify that "bytes" points to valid "modified UTF-8" data.
 */
static void checkUtfString(JNIEnv* env, const char* bytes, bool nullOk,
    const char* func)
{
    const char* origBytes = bytes;

    if (bytes == NULL) {
        if (!nullOk) {
            LOGW("JNI WARNING: unexpectedly null UTF string/n");
            goto fail;
        }

        return;
    }

    while (*bytes != '/0') {
        u1 utf8 = *(bytes++);
        // Switch on the high four bits.
        switch (utf8 >> 4) {
            case 0x00:
            case 0x01:
            case 0x02:
            case 0x03:
            case 0x04:
            case 0x05:
            case 0x06:
            case 0x07: {
                // Bit pattern 0xxx. No need for any extra bytes.
                break;
            }
            case 0x08:
            case 0x09:
            case 0x0a:
            case 0x0b:
            case 0x0f: {
                /*
                 * Bit pattern 10xx or 1111, which are illegal start bytes.
                 * Note: 1111 is valid for normal UTF-8, but not the
                 * modified UTF-8 used here.
                 */
                LOGW("JNI WARNING: illegal start byte 0x%x/n", utf8);
                goto fail;
            }
            case 0x0e: {
                // Bit pattern 1110, so there are two additional bytes.
                utf8 = *(bytes++);
                if ((utf8 & 0xc0) != 0x80) {
                    LOGW("JNI WARNING: illegal continuation byte 0x%x/n", utf8);
                    goto fail;
                }
                // Fall through to take care of the final byte.
            }
            case 0x0c:
            case 0x0d: {
                // Bit pattern 110x, so there is one additional byte.
                utf8 = *(bytes++);
                if ((utf8 & 0xc0) != 0x80) {
                    LOGW("JNI WARNING: illegal continuation byte 0x%x/n", utf8);
                    goto fail;
                }
                break;
            }
        }
    }

    return;

fail:
    LOGW("             string: '%s'/n", origBytes);
    showLocation(dvmGetCurrentJNIMethod(), func);
    abortMaybe();
}

解决方法:

是否进行checkjni检查是由ro.kernel.android.checkjni决定。

在eng版本中ro.kernel.android.checkjni=1.而在user, userdebug版本不做检查

In build/core/main.mk


user_variant := $(filter user userdebug,$(TARGET_BUILD_VARIANT))
enable_target_debugging := true
tags_to_install :=
ifneq (,$(user_variant))  

...

ro.kernel.android.checkjni=0

else 

...

ro.kernel.android.checkjni=1



note: 遇到了一次这个问题,kernel层上传的字符窜格式是S8, 长层接收转换时出错。

更多相关文章

  1. 分支和循环(二)(零基础学习C语言)
  2. Android(安卓)studio出现Error:Plugin is too old, please updat
  3. Android(安卓)Tips1
  4. 混淆打包的Proguard returned with error code 1. See console错
  5. 我的Android进阶之旅------>启动Activity的标准Action和标准Cate
  6. Android(安卓)各个版本WebView
  7. Android(安卓)开发环境配置图文教程(jdk+eclipse+android sdk)
  8. 如何获得Android系统版本
  9. android webview js 交互

随机推荐

  1. 个人作品
  2. Android面试系列文章2018之Java部分IO编
  3. 安卓开发文件缓存方法的具体实现(参考代
  4. Android(安卓)官网无法访问的解决方法
  5. android的armeabi和armeabi-v7a
  6. Android存储数据的方式
  7. react-native 中配置极光推送 Android关
  8. React Native for Android(安卓)实战(一):配
  9. [Android]使用Stack实现简易计算器
  10. 关于android下audioflinger+alsa+a2dp+pc