Crash caused by the getstringutfchars () function

Source: Internet
Author: User

Today, I found a strange phenomenon using JNI. So developed by my colleagues. There is no problem in the android2.3 system, and the system above android4.0 will run out of the following exception information:

W/dalvikvm( 3191): JNI WARNING: received null jstringW/dalvikvm( 3191):              in Lcom/avd/dev;.OpenCamera:(Ljava/lang/String;ILjava/lang/String;ILjava/lang/String;ILjava/lang/                                                             String;ILjava/lang/String;Ljava/lang/String;I)J (GetStringUTFChars)I/dalvikvm( 3191): "main" prio=5 tid=1 NATIVEI/dalvikvm( 3191):   | group="main" sCount=0 dsCount=0 obj=0x40d7a460 self=0x106abe0I/dalvikvm( 3191):   | sysTid=3191 nice=0 sched=0/0 cgrp=default handle=1075057912I/dalvikvm( 3191):   | schedstat=( 0 0 0 ) utm=205 stm=63 core=0I/dalvikvm( 3191):   at com.avd.dev.OpenCamera(Native Method)I/dalvikvm( 3191):   at com.raycommtech.ipcam.imp.p2p.SocketClient.opencamera(SocketClient.java:117)I/dalvikvm( 3191):   at com.raycommtech.ipcam.imp.p2p.MediaFetchRayCommP2P.opencamera(MediaFetchRayCommP2P.java:623)I/dalvikvm( 3191):   at com.raycommtech.rayfastcfg.service.RayFastcfgService.openCamera(RayFastcfgService.java:106)I/dalvikvm( 3191):   at com.raycommtech.rayfastcfg.wlan.WifiConfigActivity$WorkHandler.handleMessage(WifiConfigActivity.java:170)I/dalvikvm( 3191):   at android.os.Handler.dispatchMessage(Handler.java:99)I/dalvikvm( 3191):   at android.os.Looper.loop(Looper.java:137)I/dalvikvm( 3191):   at android.app.ActivityThread.main(ActivityThread.java:4444)I/dalvikvm( 3191):   at java.lang.reflect.Method.invokeNative(Native Method)I/dalvikvm( 3191):   at java.lang.reflect.Method.invoke(Method.java:511)I/dalvikvm( 3191):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)I/dalvikvm( 3191):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)I/dalvikvm( 3191):   at dalvik.system.NativeStart.main(Native Method)I/dalvikvm( 3191): E/dalvikvm( 3191): VM aborting

Check the prompt. It is obvious that the jstring type parameter is null. After reading it online, someone has encountered a similar problem.

Solution: when calling the getstringutfchars () function, first determine whether the input jstring type variable is null, so you do not need to call this function.

Refer to blog:

Http://blog.csdn.net/hpccn/article/details/8112377

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.