Google Play service to existing projects after adding the library project does not work. As it gives an error.
08-19 12:53:52.863: E/Trace(1977): error opening trace file: No such file or directory (2)
08-19 12:53:52.883: D/dalvikvm(1977): GC_FOR_ALLOC freed 80K, 2% free 10809K/11011K, paused 2ms, total 9ms
08-19 12:53:52.883: I/dalvikvm-heap(1977): Grow heap (frag case) to 12.922MB for 2457612-byte allocation
08-19 12:53:52.895: D/dalvikvm(1977): GC_CONCURRENT freed <1K, 2% free 13209K/13447K, paused 10ms+0ms, total 12ms
08-19 12:53:52.947: D/AndroidRuntime(1977): Shutting down VM
08-19 12:53:52.947: W/dalvikvm(1977): threadid=1: thread exiting with uncaught exception (group=0xa62be288)
08-19 12:53:52.947: E/AndroidRuntime(1977): FATAL EXCEPTION: main
08-19 12:53:52.947: E/AndroidRuntime(1977): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.iloveyou.lovetester/com.iloveyou.lovetester.LoveTestActivity}: android.view.InflateException: Binary XML file line #85: Error inflating class com.google.ads.AdView
08-19 12:53:52.947: E/AndroidRuntime(1977): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
08-19 12:53:52.947: E/AndroidRuntime(1977): at
Related
Getting this error, no matter which genymotion virtual device I choose:
dlopen("/data/app-lib/com.brainlogin.facedetectlib-1/libjniavutil.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
I'm initiating javacv statically (I have all the .so files in my lib folder).
My code to load the libraries
System.loadLibrary("detection_based_tracker");
I've also tried manually trigger loading libopencv_java based on other posts:
System.loadLibrary("libopencv_java");
System.loadLibrary("detection_based_tracker");
Note that the same app runs fine on Eclipse's ADT emulators and on physical devices.
Also note that my other apps not having javacv run fine on the Genymotion virtual devices.
Here is the full logcat:
02-21 11:33:49.177: D/AndroidRuntime(1673): CheckJNI is OFF
02-21 11:33:49.185: D/dalvikvm(1673): Trying to load lib libjavacore.so 0x0
02-21 11:33:49.185: D/dalvikvm(1673): Added shared lib libjavacore.so 0x0
02-21 11:33:49.189: D/dalvikvm(1673): Trying to load lib libnativehelper.so 0x0
02-21 11:33:49.189: D/dalvikvm(1673): Added shared lib libnativehelper.so 0x0
02-21 11:33:49.189: D/dalvikvm(1673): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
02-21 11:33:49.201: D/dalvikvm(1673): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
02-21 11:33:49.241: E/memtrack(1673): Couldn't load memtrack module (No such file or directory)
02-21 11:33:49.241: E/android.os.Debug(1673): failed to load memtrack module: -2
02-21 11:33:49.265: D/AndroidRuntime(1673): Calling main entry com.android.commands.am.Am
02-21 11:33:49.273: I/ActivityManager(540): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.brainlogin.facedetectlib/.FaceDetect} from pid 1673
02-21 11:33:49.281: D/(540): HostConnection::get() New Host Connection established 0xb8ba2cf8, tid 552
02-21 11:33:49.509: D/dalvikvm(540): GC_FOR_ALLOC freed 340K, 51% free 6547K/13196K, paused 7ms, total 7ms
02-21 11:33:49.509: I/dalvikvm-heap(540): Grow heap (frag case) to 7.285MB for 856092-byte allocation
02-21 11:33:49.521: D/dalvikvm(540): GC_FOR_ALLOC freed 3K, 48% free 7380K/14036K, paused 14ms, total 14ms
02-21 11:33:49.529: D/dalvikvm(540): GC_FOR_ALLOC freed 2K, 48% free 7384K/14036K, paused 7ms, total 7ms
02-21 11:33:49.533: I/dalvikvm-heap(540): Grow heap (frag case) to 8.103MB for 856092-byte allocation
02-21 11:33:49.541: D/dalvikvm(540): GC_FOR_ALLOC freed <1K, 45% free 8220K/14876K, paused 8ms, total 8ms
02-21 11:33:49.557: D/AndroidRuntime(1673): Shutting down VM
02-21 11:33:49.557: D/jdwp(1673): Got wake-up signal, bailing out of select
02-21 11:33:49.557: D/dalvikvm(1673): Debugger has detached; object registry had 1 entries
02-21 11:33:49.565: D/dalvikvm(1686): Late-enabling CheckJNI
02-21 11:33:49.569: I/ActivityManager(540): Start proc com.brainlogin.facedetectlib for activity com.brainlogin.facedetectlib/.FaceDetect: pid=1686 uid=10058 gids={50058, 1028, 1015}
02-21 11:33:49.569: D/MobileDataStateTracker(540): default: setPolicyDataEnable(enabled=true)
02-21 11:33:49.589: D/(540): HostConnection::get() New Host Connection established 0xb8ba2ec8, tid 554
02-21 11:33:49.589: D/dalvikvm(1686): Debugger has detached; object registry had 1 entries
02-21 11:33:49.661: D/MobileDataStateTracker(540): default: setPolicyDataEnable(enabled=true)
02-21 11:33:49.737: D/debug(1686): copy SUCCESS for flandmark_model.dat
02-21 11:33:49.745: D/CameraBridge(1686): Attr count: 3
02-21 11:33:49.777: D/dalvikvm(1686): GC_CONCURRENT freed 124K, 6% free 3502K/3692K, paused 3ms+1ms, total 17ms
02-21 11:33:49.789: D/dalvikvm(1686): GC_CONCURRENT freed 192K, 7% free 3819K/4088K, paused 0ms+1ms, total 5ms
02-21 11:33:49.789: D/dalvikvm(1686): WAIT_FOR_CONCURRENT_GC blocked 3ms
02-21 11:33:49.801: D/dalvikvm(1686): GC_CONCURRENT freed 281K, 11% free 3935K/4404K, paused 2ms+0ms, total 4ms
02-21 11:33:49.801: D/dalvikvm(1686): WAIT_FOR_CONCURRENT_GC blocked 3ms
02-21 11:33:49.809: D/dalvikvm(1686): GC_FOR_ALLOC freed 255K, 11% free 3994K/4480K, paused 6ms, total 7ms
02-21 11:33:49.825: D/dalvikvm(1686): GC_CONCURRENT freed 283K, 8% free 4193K/4556K, paused 1ms+2ms, total 8ms
02-21 11:33:49.841: D/dalvikvm(1686): GC_CONCURRENT freed 229K, 7% free 4451K/4756K, paused 0ms+2ms, total 8ms
02-21 11:33:49.869: D/dalvikvm(1686): GC_CONCURRENT freed 257K, 7% free 4675K/5008K, paused 6ms+1ms, total 15ms
02-21 11:33:49.885: D/dalvikvm(1686): No JNI_OnLoad found in /system/lib/libc.so 0xa4fd7c78, skipping init
02-21 11:33:49.885: D/dalvikvm(1686): No JNI_OnLoad found in /system/lib/libm.so 0xa4fd7c78, skipping init
02-21 11:33:49.889: D/dalvikvm(1686): No JNI_OnLoad found in /system/lib/libz.so 0xa4fd7c78, skipping init
02-21 11:33:49.893: D/dalvikvm(1686): No JNI_OnLoad found in /system/lib/libdl.so 0xa4fd7c78, skipping init
02-21 11:33:49.893: D/dalvikvm(1686): No JNI_OnLoad found in /system/lib/liblog.so 0xa4fd7c78, skipping init
02-21 11:33:49.893: D/dalvikvm(1686): Trying to load lib /data/app-lib/com.brainlogin.facedetectlib-1/libavutil.so 0xa4fd7c78
02-21 11:33:49.897: D/dalvikvm(1686): Added shared lib /data/app-lib/com.brainlogin.facedetectlib-1/libavutil.so 0xa4fd7c78
02-21 11:33:49.897: D/dalvikvm(1686): No JNI_OnLoad found in /data/app-lib/com.brainlogin.facedetectlib-1/libavutil.so 0xa4fd7c78, skipping init
02-21 11:33:49.897: D/dalvikvm(1686): Trying to load lib /data/app-lib/com.brainlogin.facedetectlib-1/libjniavutil.so 0xa4fd7c78
02-21 11:33:49.901: E/dalvikvm(1686): dlopen("/data/app-lib/com.brainlogin.facedetectlib-1/libjniavutil.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
02-21 11:33:49.901: W/dalvikvm(1686): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/bytedeco/javacpp/avutil;
02-21 11:33:49.901: D/dalvikvm(1686): GC_CONCURRENT freed 453K, 11% free 4679K/5208K, paused 1ms+2ms, total 14ms
02-21 11:33:49.905: I/dalvikvm(1686): Rejecting re-init on previously-failed class Lorg/bytedeco/javacpp/avutil; v=0x0
02-21 11:33:49.905: W/dalvikvm(1686): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lorg/bytedeco/javacpp/avcodec$AVPacket;
02-21 11:33:49.905: D/AndroidRuntime(1686): Shutting down VM
02-21 11:33:49.905: W/dalvikvm(1686): threadid=1: thread exiting with uncaught exception (group=0xa4cb5b20)
02-21 11:33:49.905: E/AndroidRuntime(1686): FATAL EXCEPTION: main
I'm working on a stress testing tool, one of designed scenario is to use up memory, and leave only a few mega for the app under test and others.
By searching internet about this topic, I learned that Android Dalvik vm limit program allocation in 16MB, 24MB, or 32MB. But I do realized some app can retain up to 80 MB memory. So is that idea reasonable? if so, how to achieve that goal.
thanks in advance,
Forrest
I would use one or several services to consume memory.
This article tells us that Leaving a service running when it’s not needed is one of the worst memory-management mistakes:
https://developer.android.com/training/articles/memory.html#Services
and this one tells us which process is killed last:
http://developer.android.com/guide/components/processes-and-threads.html#Lifecycle
In addition, I would use a foreground activity to cause killing the app under test (and see if the data survive): when the memory is already allocated to services, a foreground activity would cause killing of the background activities.
Android is a Linux, so you can use stuff like /proc/$PID/maps (see here).
It's interesting to know what you will use, so please answer your own question after you solve the problem.
thanks following up with me. Now I believe I get an answer to this question.
Generally speaking, we cannot rely on one app/service to use up the whole system RAM. Andoid app runs in Dalvik vm and there's an upper limit for each application or service. It's also known as maximum heap size limit. Different phones has different limit heap size:
HUAWEI U9508: 256MB android 4.0.4
Meizu MX3: 192MB android 4.2.1* ll
We can get this heap size by code:
Runtime.getRuntime().maxMemory();
Android Service fall into this rule as well, the heap size limit is the same as normal app.
Initially, android os give the app a relatively small heap, when the app reach the capacity, memory manager will grow the heap size automatically. Later, if app reaches the heap size limit, you'll get OutOfMemoryError. See below log(copy to text editor for better reading):
02-15 09:22:25.438: D/dalvikvm(9992): GC_FOR_ALLOC freed 140K, 11% free 2943K/3280K, paused 11ms, total 11ms
02-15 09:22:25.478: I/dalvikvm-heap(9992): Grow heap (frag case) to 27.059MB for 25165840-byte allocation
02-15 09:22:25.478: D/dalvikvm(9992): threadid=1: still suspended after undo (sc=1 dc=1)
02-15 09:22:25.488: D/dalvikvm(9992): threadid=1: still suspended after undo (sc=1 dc=1)
02-15 09:22:25.488: D/dalvikvm(9992): GC_CONCURRENT freed 15K, 2% free 27504K/27860K, paused 1ms+2ms, total 13ms
02-15 09:22:25.488: D/dalvikvm(9992): WAIT_FOR_CONCURRENT_GC blocked 12ms
02-15 09:22:43.758: I/Choreographer(9992): Skipped 1100 frames! The application may be doing too much work on its main thread.
02-15 09:22:43.913: D/dalvikvm(9992): GC_FOR_ALLOC freed 2K, 2% free 27504K/27856K, paused 25ms, total 25ms
02-15 09:22:43.963: I/dalvikvm-heap(9992): Grow heap (frag case) to 51.044MB for 25165840-byte allocation
02-15 09:22:43.978: D/dalvikvm(9992): GC_FOR_ALLOC freed <1K, 1% free 52080K/52436K, paused 14ms, total 14ms
02-15 09:22:43.998: D/dalvikvm(9992): GC_CONCURRENT freed <1K, 1% free 52080K/52436K, paused 2ms+4ms, total 21ms
02-15 09:22:52.578: D/dalvikvm(9992): GC_FOR_ALLOC freed 4K, 1% free 52080K/52432K, paused 12ms, total 12ms
02-15 09:22:52.613: I/dalvikvm-heap(9992): Grow heap (frag case) to 75.044MB for 25165840-byte allocation
02-15 09:22:52.633: D/dalvikvm(9992): GC_CONCURRENT freed 0K, 1% free 76656K/77012K, paused 3ms+4ms, total 20ms
02-15 09:22:52.633: D/dalvikvm(9992): WAIT_FOR_CONCURRENT_GC blocked 17ms
02-15 09:22:52.633: D/dalvikvm(9992): WAIT_FOR_CONCURRENT_GC blocked 17ms
02-15 09:22:55.198: D/dalvikvm(9992): GC_FOR_ALLOC freed 1K, 1% free 76656K/77012K, paused 13ms, total 13ms
02-15 09:22:55.233: I/dalvikvm-heap(9992): Grow heap (frag case) to 99.044MB for 25165840-byte allocation
02-15 09:22:55.253: D/dalvikvm(9992): GC_CONCURRENT freed 0K, 1% free 101232K/101592K, paused 1ms+5ms, total 17ms
02-15 09:22:55.253: D/dalvikvm(9992): WAIT_FOR_CONCURRENT_GC blocked 17ms
02-15 09:22:55.253: D/dalvikvm(9992): WAIT_FOR_CONCURRENT_GC blocked 17ms
02-15 09:22:56.438: D/dalvikvm(9992): GC_FOR_ALLOC freed <1K, 1% free 101232K/101592K, paused 17ms, total 17ms
02-15 09:22:56.478: I/dalvikvm-heap(9992): Grow heap (frag case) to 123.044MB for 25165840-byte allocation
02-15 09:22:56.493: D/dalvikvm(9992): GC_FOR_ALLOC freed 0K, 1% free 125808K/126172K, paused 18ms, total 18ms
02-15 09:22:56.523: D/dalvikvm(9992): GC_CONCURRENT freed <1K, 1% free 125808K/126172K, paused 2ms+7ms, total 27ms
02-15 09:22:57.458: D/dalvikvm(9992): GC_FOR_ALLOC freed <1K, 1% free 125808K/126172K, paused 17ms, total 18ms
02-15 09:22:57.493: I/dalvikvm-heap(9992): Grow heap (frag case) to 147.044MB for 25165840-byte allocation
02-15 09:22:57.513: D/dalvikvm(9992): GC_FOR_ALLOC freed 0K, 1% free 150384K/150752K, paused 18ms, total 18ms
02-15 09:22:57.543: D/dalvikvm(9992): GC_CONCURRENT freed <1K, 1% free 150384K/150752K, paused 3ms+7ms, total 29ms
02-15 09:22:58.668: D/dalvikvm(9992): GC_FOR_ALLOC freed <1K, 1% free 150384K/150752K, paused 17ms, total 17ms
02-15 09:22:58.708: I/dalvikvm-heap(9992): Grow heap (frag case) to 171.044MB for 25165840-byte allocation
02-15 09:22:58.733: D/dalvikvm(9992): GC_FOR_ALLOC freed 0K, 1% free 174960K/175332K, paused 24ms, total 24ms
02-15 09:22:58.768: D/dalvikvm(9992): GC_CONCURRENT freed <1K, 1% free 174960K/175332K, paused 2ms+11ms, total 36ms
02-15 09:22:59.718: D/dalvikvm(9992): GC_FOR_ALLOC freed <1K, 1% free 174960K/175332K, paused 35ms, total 35ms
02-15 09:22:59.718: I/dalvikvm-heap(9992): Forcing collection of SoftReferences for 25165840-byte allocation
02-15 09:22:59.778: D/dalvikvm(9992): GC_BEFORE_OOM freed 10K, 1% free 174950K/175332K, paused 58ms, total 58ms
02-15 09:22:59.778: E/dalvikvm-heap(9992): Out of memory on a 25165840-byte allocation.
02-15 09:22:59.778: I/dalvikvm(9992): "main" prio=5 tid=1 RUNNABLE
02-15 09:22:59.778: I/dalvikvm(9992): | group="main" sCount=0 dsCount=0 obj=0x40dd19a0 self=0x40bc6010
02-15 09:22:59.778: I/dalvikvm(9992): | sysTid=9992 nice=0 sched=0/0 cgrp=apps handle=1074504668
02-15 09:22:59.778: I/dalvikvm(9992): | state=R schedstat=( 0 0 0 ) utm=295 stm=49 core=0
02-15 09:22:59.778: I/dalvikvm(9992): at com.jdmobile.stresstestingutility.MainActivity$2.onClick(MainActivity.java:~148)
02-15 09:22:59.778: I/dalvikvm(9992): at android.view.View.performClick(View.java:4203)
02-15 09:22:59.778: I/dalvikvm(9992): at android.view.View$PerformClick.run(View.java:17556)
02-15 09:22:59.778: I/dalvikvm(9992): at android.os.Handler.handleCallback(Handler.java:725)
02-15 09:22:59.778: I/dalvikvm(9992): at android.os.Handler.dispatchMessage(Handler.java:92)
02-15 09:22:59.778: I/dalvikvm(9992): at android.os.Looper.loop(Looper.java:137)
02-15 09:22:59.778: I/dalvikvm(9992): at android.app.ActivityThread.main(ActivityThread.java:5105)
02-15 09:22:59.778: I/dalvikvm(9992): at java.lang.reflect.Method.invokeNative(Native Method)
02-15 09:22:59.778: I/dalvikvm(9992): at java.lang.reflect.Method.invoke(Method.java:511)
02-15 09:22:59.778: I/dalvikvm(9992): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-15 09:22:59.778: I/dalvikvm(9992): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-15 09:22:59.778: I/dalvikvm(9992): at dalvik.system.NativeStart.main(Native Method)
02-15 09:23:52.643: D/AndroidRuntime(9992): Shutting down VM
The other memory allocation limit is a chunk of memory(no fragment): 16MB, 24MB, or bigger, see this piece of code demonstration, ActivityManager:
/**
* Return the approximate per-application memory class of the current
* device. This gives you an idea of how hard a memory limit you should
* impose on your application to let the overall system work best. The
* returned value is in megabytes; the baseline Android memory class is
* 16 (which happens to be the Java heap limit of those devices); some
* device with more memory may return 24 or even higher numbers.
*/
public int getMemoryClass() {
return staticGetMemoryClass();
}
08-07 11:18:38.353: D/dalvikvm(15215): GC_FOR_ALLOC freed 83K, 6% free 12813K/13599K, paused 21ms
08-07 11:18:38.363: I/dalvikvm-heap(15215): Grow heap (frag case) to 15.352MB for 2908176-byte allocation
08-07 11:18:38.393: D/dalvikvm(15215): GC_FOR_ALLOC freed 1K, 6% free 15652K/16483K, paused 12ms
08-07 11:18:38.413: D/dalvikvm(15215): GC_CONCURRENT freed <1K, 6% free 15652K/16483K, paused 2ms+2ms
08-07 11:18:38.443: D/dalvikvm(15215): GC_FOR_ALLOC freed <1K, 6% free 15652K/16483K, paused 15ms
08-07 11:18:38.443: I/dalvikvm-heap(15215): Grow heap (frag case) to 20.281MB for 5169196-byte allocation
08-07 11:18:38.463: D/dalvikvm(15215): GC_FOR_ALLOC freed 0K, 4% free 20700K/21539K, paused 13ms
08-07 11:18:38.483: D/dalvikvm(15215): GC_CONCURRENT freed <1K, 4% free 20700K/21539K, paused 2ms+2ms
08-07 11:18:38.543: D/AndroidRuntime(15215): Shutting down VM
08-07 11:18:38.543: W/dalvikvm(15215): threadid=1: thread exiting with uncaught exception (group=0x40ab2210)
08-07 11:18:38.553: E/AndroidRuntime(15215): FATAL EXCEPTION: main
08-07 11:18:38.553: E/AndroidRuntime(15215): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.demo/com.example.demo.MainActivity}: java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.widget.Button
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.ActivityThread.access$600(ActivityThread.java:127)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.os.Handler.dispatchMessage(Handler.java:99)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.os.Looper.loop(Looper.java:137)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.ActivityThread.main(ActivityThread.java:4441)
08-07 11:18:38.553: E/AndroidRuntime(15215): at java.lang.reflect.Method.invokeNative(Native Method)
08-07 11:18:38.553: E/AndroidRuntime(15215): at java.lang.reflect.Method.invoke(Method.java:511)
08-07 11:18:38.553: E/AndroidRuntime(15215): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
08-07 11:18:38.553: E/AndroidRuntime(15215): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
08-07 11:18:38.553: E/AndroidRuntime(15215): at dalvik.system.NativeStart.main(Native Method)
08-07 11:18:38.553: E/AndroidRuntime(15215): Caused by: java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.widget.Button
08-07 11:18:38.553: E/AndroidRuntime(15215): at com.example.demo.MainActivity.onCreate(MainActivity.java:16)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.Activity.performCreate(Activity.java:4465)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
08-07 11:18:38.553: E/AndroidRuntime(15215): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
i can run simple graphical-layout but whe i try to add some code onclick or any other its show me these errors. i deleted api 20 from sdk manager and trying to compile in api17. HOW TO SOLVE THESE ERRORS??????
this exception says that you was cast ImageView to Button .
Caused by: java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.widget.Button
Please change (Button) To (ImageView) at Line No 16 in MainActivity.java
I have an app where users can click on certain buttons in my app and it will launch specific settings page from Android to the user. I uses the android API from their website http://developer.android.com/reference/android/provider/Settings.html
Intent intent = new Intent(Settings.ACTION_SECURITY_SETTINGS);
currentContext.startActivity(intent);
Intent intent = new Intent(Settings.ACTION_DISPLAY_SETTINGS);
currentContext.startActivity(intent);
These are some of the settings pages that my app will open. So far I have no problem launching these two intents from my app. However, when I try to launch the "About tablet" page with the code below, the Settings process crashes.
Intent intent = new Intent(Settings.ACTION_DEVICE_INFO_SETTINGS);
currentContext.startActivity(intent);
It crashes on android 4.1.1 but it works fine on android 3.2. I'm still new to Android and I am at a lost on why it crashes. I'm new to StackOverflow as well. Hopefully I am able to get some answers here and nice to meet you all.
Here's my logcat:
09-19 09:50:12.830: I/ActivityManager(270): START {act=android.settings.DEVICE_INFO_SETTINGS cmp=com.android.settings/.Settings$DeviceInfoSettingsActivity u=0} from pid 1627
09-19 09:50:12.910: D/dalvikvm(270): GC_FOR_ALLOC freed 738K, 13% free 11824K/13575K, paused 62ms, total 62ms
09-19 09:50:13.010: W/System.err(1675): Removed 2131231183
09-19 09:50:13.020: W/System.err(1675): Removed 2131231190
09-19 09:50:13.060: D/LocalBluetoothProfileManager(1675): LocalBluetoothProfileManager construction complete
09-19 09:50:13.060: D/AndroidRuntime(1675): Shutting down VM
09-19 09:50:13.060: W/dalvikvm(1675): threadid=1: thread exiting with uncaught exception (group=0x40d4c300)
09-19 09:50:13.060: E/AndroidRuntime(1675): FATAL EXCEPTION: main
09-19 09:50:13.060: E/AndroidRuntime(1675): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.settings/com.android.settings.Settings$DeviceInfoSettingsActivity}: java.lang.NullPointerException
09-19 09:50:13.060: E/AndroidRuntime(1675): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
09-19 09:50:13.060: E/AndroidRuntime(1675): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
09-19 09:50:13.060: E/AndroidRuntime(1675): at android.app.ActivityThread.access$600(ActivityThread.java:130)
09-19 09:50:13.060: E/AndroidRuntime(1675): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
09-19 09:50:13.060: E/AndroidRuntime(1675): at android.os.Handler.dispatchMessage(Handler.java:99)
09-19 09:50:13.060: E/AndroidRuntime(1675): at android.os.Looper.loop(Looper.java:137)
09-19 09:50:13.060: E/AndroidRuntime(1675): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-19 09:50:13.060: E/AndroidRuntime(1675): at java.lang.reflect.Method.invokeNative(Native Method)
09-19 09:50:13.060: E/AndroidRuntime(1675): at java.lang.reflect.Method.invoke(Method.java:511)
09-19 09:50:13.060: E/AndroidRuntime(1675): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-19 09:50:13.060: E/AndroidRuntime(1675): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-19 09:50:13.060: E/AndroidRuntime(1675): at dalvik.system.NativeStart.main(Native Method)
09-19 09:50:13.060: E/AndroidRuntime(1675): Caused by: java.lang.NullPointerException
09-19 09:50:13.060: E/AndroidRuntime(1675): at com.android.settings.Settings.onCreate(Settings.java:167)
09-19 09:50:13.060: E/AndroidRuntime(1675): at android.app.Activity.performCreate(Activity.java:5008)
09-19 09:50:13.060: E/AndroidRuntime(1675): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
09-19 09:50:13.060: E/AndroidRuntime(1675): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
09-19 09:50:13.060: E/AndroidRuntime(1675): ... 11 more
09-19 09:50:13.090: W/ActivityManager(270): Force finishing activity com.android.settings/.Settings$DeviceInfoSettingsActivity
09-19 09:50:13.090: W/ActivityManager(270): Force finishing activity com.panasonic.tbexperience/.view.templates.TwoColumnsControlActivity
09-19 09:50:13.100: W/InputMethodManagerService(270): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#41811de8 attribute=null
09-19 09:50:13.130: D/dalvikvm(1675): GC_CONCURRENT freed 187K, 4% free 6233K/6471K, paused 12ms+5ms, total 60ms
09-19 09:50:13.610: W/ActivityManager(270): Activity pause timeout for ActivityRecord{417ea2e0 com.android.settings/.Settings$DeviceInfoSettingsActivity}
09-19 09:50:13.820: D/dalvikvm(445): GC_FOR_ALLOC freed 1020K, 33% free 14790K/22023K, paused 41ms, total 41ms
09-19 09:50:13.960: D/dalvikvm(445): GC_FOR_ALLOC freed 1057K, 30% free 15633K/22023K, paused 39ms, total 39ms
09-19 09:50:14.010: D/dalvikvm(445): GC_FOR_ALLOC freed 362K, 24% free 16871K/22023K, paused 32ms, total 32ms
09-19 09:50:14.060: D/dalvikvm(445): GC_CONCURRENT freed 1289K, 20% free 17622K/22023K, paused 3ms+7ms, total 39ms
09-19 09:50:14.060: D/dalvikvm(445): WAIT_FOR_CONCURRENT_GC blocked 29ms
09-19 09:50:14.060: D/dalvikvm(445): WAIT_FOR_CONCURRENT_GC blocked 17ms
09-19 09:50:14.100: D/dalvikvm(445): GC_FOR_ALLOC freed 1693K, 25% free 16723K/22023K, paused 31ms, total 31ms
09-19 09:50:14.190: D/dalvikvm(445): GC_CONCURRENT freed 1126K, 21% free 17585K/22023K, paused 14ms+9ms, total 64ms
09-19 09:50:14.190: D/dalvikvm(445): WAIT_FOR_CONCURRENT_GC blocked 50ms
09-19 09:50:14.390: I/dalvikvm(270): Jit: resizing JitTable from 8192 to 16384
09-19 09:50:16.870: I/Process(1675): Sending signal. PID: 1675 SIG: 9
09-19 09:50:16.890: I/ActivityManager(270): Process com.android.settings (pid 1675) has died.
09-19 09:50:16.890: W/ActivityManager(270): Force removing ActivityRecord{4166f668 com.android.settings/.Settings$DeviceInfoSettingsActivity}: app died, no saved state
09-19 09:50:16.890: W/InputMethodManagerService(270): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#415f2878 attribute=null
09-19 09:50:32.250: D/dalvikvm(1552): GC_CONCURRENT freed 424K, 9% free 6942K/7559K, paused 12ms+3ms, total 39ms
Also, I tried to directly set the classname for this api...
Intent intent = new Intent();
intent.setClassName("com.android.settings", "com.android.settings.Settings$DeviceInfoSettingsActivity");
currentContext.startActivity(intent);
Same thing happens.It works for android 3.2 but doesn't work in 4.1.1. I've got a feeling that maybe I did not get the right class name for the 4.1.1 version. Does anyone know the direct class name to open the "About Tablet" page or whether is it possible to open that page programmatically?
Regards,
shuwen
android api doc say:
In some cases, a matching Activity may not exist, so ensure you safeguard against this.
so you should check this intent or catch this exception yourself.
I'm currently try to run some opencv filters (i.e find egde, Median, ...) on images which are stored in the image gallery folder.
But I get error for loading image. My device is galaxy tab 10.1 with android 3.2, my opencv - API level 8.
I have the following source on a Button:
#Override
public void onClick(View v) {
Bitmap myBitmap = BitmapFactory.decodeFile("/sdcard/image1.jpg");
Bitmap myBitmap32 = myBitmap.copy(Bitmap.Config.ARGB_8888, true);
Mat pic1 = Utils.bitmapToMat(myBitmap32);
}
Here is LogCat:
02-07 12:31:27.290: I/System.out(16522): Not a DRM File, opening notmally
02-07 12:31:27.290: I/System.out(16522): buffer returned
02-07 12:31:27.310: D/dalvikvm(16522): GC_FOR_ALLOC freed 11K, 21% free 6975K/8775K, paused 19ms
02-07 12:31:27.320: I/dalvikvm-heap(16522): Grow heap (frag case) to 12.918MB for 6291472-byte allocation
02-07 12:31:27.340: D/dalvikvm(16522): GC_FOR_ALLOC freed <1K, 13% free 13119K/14983K, paused 19ms
02-07 12:31:27.380: D/dalvikvm(16522): GC_CONCURRENT freed 0K, 13% free 13119K/14983K, paused 2ms+2ms
02-07 12:31:27.710: D/dalvikvm(16522): GC_FOR_ALLOC freed 55K, 13% free 13063K/14983K, paused 20ms
02-07 12:31:27.730: I/dalvikvm-heap(16522): Grow heap (frag case) to 24.864MB for 12582928-byte allocation
02-07 12:31:27.780: D/dalvikvm(16522): GC_FOR_ALLOC freed 0K, 8% free 25351K/27335K, paused 21ms
02-07 12:31:27.830: D/dalvikvm(16522): GC_CONCURRENT freed <1K, 8% free 25351K/27335K, paused 2ms+3ms
02-07 12:31:27.890: W/dalvikvm(16522): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/opencv/android/Utils;
02-07 12:31:27.890: D/AndroidRuntime(16522): Shutting down VM
02-07 12:31:27.890: W/dalvikvm(16522): threadid=1: thread exiting with uncaught exception (group=0x400fc760)
02-07 12:31:27.890: E/AndroidRuntime(16522): FATAL EXCEPTION: main
02-07 12:31:27.890: E/AndroidRuntime(16522): java.lang.ExceptionInInitializerError
02-07 12:31:27.890: E/AndroidRuntime(16522): at photo.klu.PhotoKLUActivity$1.onClick(PhotoKLUActivity.java:82)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.view.View.performClick(View.java:3127)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.view.View$PerformClick.run(View.java:12025)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.os.Handler.handleCallback(Handler.java:587)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.os.Handler.dispatchMessage(Handler.java:92)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.os.Looper.loop(Looper.java:132)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.app.ActivityThread.main(ActivityThread.java:4126)
02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.reflect.Method.invokeNative(Native Method)
02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.reflect.Method.invoke(Method.java:491)
02-07 12:31:27.890: E/AndroidRuntime(16522): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
02-07 12:31:27.890: E/AndroidRuntime(16522): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
02-07 12:31:27.890: E/AndroidRuntime(16522): at dalvik.system.NativeStart.main(Native Method)
02-07 12:31:27.890: E/AndroidRuntime(16522): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load opencv_java: findLibrary returned null
02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.Runtime.loadLibrary(Runtime.java:425)
02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.System.loadLibrary(System.java:554)
02-07 12:31:27.890: E/AndroidRuntime(16522): at org.opencv.android.Utils.<clinit>(Utils.java:86)
02-07 12:31:27.890: E/AndroidRuntime(16522): ... 12 more
02-07 12:31:30.010: I/dalvikvm(16522): threadid=4: reacting to signal 3
02-07 12:31:30.010: I/dalvikvm(16522): Wrote stack traces to '/data/anr/traces.txt'
02-07 12:31:37.470: I/Process(16522): Sending signal. PID: 16522 SIG: 9
Any ideas?
Thank you.
The openCV library is not attached to your application. Please do the following (i assume that the openCV library is imported to your workspace). On Package Explorer > Right click on the application project > properties > under Library click Add > select openCV Be sure that on Java Build Path you don't have anything related to openCV