InflateException happens when large count of images are loaded using glide.
I've done some research and realized InflateException may not be the actual reason my android application crashes, the real issue should be out-of-memory.
Also I've tried to add android:largeHeap="true" to AndroidManifest.xml & use thumbnail() or override() a smaller size when using glide to load images, but these operations didn't solve the problem.
By the way I've seem lots of messages like this, none of these images are needed in my project's xmls inside "res/drawble".
Update: I think "decoderesource" is the problem, but still try to figure out where these images are needed.
Turns out there is a checkbox in every gridView, when the checkbox is deleted, everything works fine. Any idea how to fix this?
V/BitmapFactory: DecodeImagePath(decodeResourceStream3) : res/drawable-xxhdpi-v4/btn_check_to_on_mtrl_015.png
V/BitmapFactory: DecodeImagePath(decodeResourceStream3) : res/drawable-xxhdpi-v4/btn_check_to_on_mtrl_000.png
DecodeImagePath(decodeResourceStream3) : res/drawable-xxhdpi-v4/btn_check_to_on_mtrl_015.png
V/BitmapFactory: DecodeImagePath(decodeResourceStream3) : res/drawable-xxhdpi-v4/btn_check_to_on_mtrl_000.png
DecodeImagePath(decodeResourceStream3) : res/drawable-xxhdpi-v4/btn_check_to_on_mtrl_000.png
V/BitmapFactory: DecodeImagePath(decodeResourceStream3) : res/drawable-xxhdpi-v4/btn_check_to_on_mtrl_001.png
DecodeImagePath(decodeResourceStream3) : res/drawable-xxhdpi-v4/btn_check_to_on_mtrl_002.png
DecodeImagePath(decodeResourceStream3) : res/drawable-xxhdpi-v4/btn_check_to_on_mtrl_003.png
DecodeImagePath(decodeResourceStream3) : res/drawable-xxhdpi-v4/btn_check_to_on_mtrl_004.png
DecodeImagePath(decodeResourceStream3) : res/drawable-xxhdpi-v4/btn_check_to_on_mtrl_005.png
DecodeImagePath(decodeResourceStream3) : res/drawable-xxhdpi-v4/btn_check_to_on_mtrl_006.png
V/BitmapFactory: DecodeImagePath(decodeResourceStream3) : res/drawable-xxhdpi-v4/btn_check_to_on_mtrl_007.png
And here is the exception:
E/art: Throwing OutOfMemoryError "Failed to allocate a 36876 byte allocation with 5238 free bytes and 5KB until OOM"
D/skia: --- decoder->decode returned false
D/AndroidRuntime: Shutting down VM
I/art: Alloc sticky concurrent mark sweep GC freed 23(1648B) AllocSpace objects, 0(0B) LOS objects, 0% free, 127MB/128MB, paused 2.803ms total 25.861ms
I/art: Clamp target GC heap from 143MB to 128MB
Alloc partial concurrent mark sweep GC freed 136(22KB) AllocSpace objects, 12(432KB) LOS objects, 0% free, 127MB/128MB, paused 918us total 59.735ms
I/art: Alloc sticky concurrent mark sweep GC freed 5421(265KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 127MB/128MB, paused 1.248ms total 14.342ms
I/art: Clamp target GC heap from 142MB to 128MB
Alloc partial concurrent mark sweep GC freed 5484(269KB) AllocSpace objects, 36(1296KB) LOS objects, 1% free, 126MB/128MB, paused 906us total 54.921ms
I/art: Alloc sticky concurrent mark sweep GC freed 31817(1543KB) AllocSpace objects, 0(0B) LOS objects, 1% free, 126MB/128MB, paused 758us total 12.917ms
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.winzip.android, PID: 9988
android.view.InflateException: Binary XML file line #19: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:640)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at com.winzip.android.commonadapter.ViewHolder.get(ViewHolder.java:44)
at com.winzip.android.commonadapter.MultiItemTypeAdapter.getView(MultiItemTypeAdapter.java:60)
at android.widget.AbsListView.obtainView(AbsListView.java:2825)
at android.widget.GridView.makeAndAddView(GridView.java:1437)
at android.widget.GridView.makeRow(GridView.java:361)
at android.widget.GridView.fillDown(GridView.java:302)
at android.widget.GridView.fillFromTop(GridView.java:437)
at android.widget.GridView.layoutChildren(GridView.java:1280)
at android.widget.AbsListView.onLayout(AbsListView.java:2629)
at android.view.View.layout(View.java:16678)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1702)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1556)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1465)
at android.view.View.layout(View.java:16678)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.ListView.setupChild(ListView.java:1980)
at android.widget.ListView.makeAndAddView(ListView.java:1889)
at android.widget.ListView.fillDown(ListView.java:713)
at android.widget.ListView.fillFromTop(ListView.java:779)
at android.widget.ListView.layoutChildren(ListView.java:1693)
at android.widget.AbsListView.onLayout(AbsListView.java:2629)
at android.view.View.layout(View.java:16678)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1077)
at android.view.View.layout(View.java:16678)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:16678)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1702)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1556)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1465)
at android.view.View.layout(View.java:16678)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:16678)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1702)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1556)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1465)
at android.view.View.layout(View.java:16678)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:16678)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2319)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2032)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1191)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6643)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
at android.view.Choreographer.doCallbacks(Choreographer.java:590)
at android.view.Choreographer.doFrame(Choreographer.java:560)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
at android.os.Handler.handleCallback(Handler.java:739)
This is where images are loaded.
protected void convert(final ViewHolder viewHolder, final ScanImgModel item, final int position) {
if (item.isBest())
viewHolder.setVisible(R.id.ac_clean_detail_repeat_best, true);
ImageView imageView = (ImageView) viewHolder.getView(R.id.ac_clean_detail_repeat_image);
viewHolder.setChecked(R.id.ac_clean_detail_item_checkbox, item.isSelected());
Glide.with(mContext)
.load(item.getPath())
.into(imageView);
}
I've custom the style of checkbox, the "decoderesource" message no longer shows and out-of-memory problem solved...
Related
I need to show several images on the screen, allowing users to swipe in a horizontal fashion. When they click on the images, they should open a locally stored PDF/PDF from site in the app itself.
The problem is that whenever I put a scrollview (horizontal or vertical), my app crashes when I try to go to the activity that contains the view.
Currently, said activity looks like this:
Full xml code:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/ConstraintLayout">
<HorizontalScrollView
android:layout_width="368dp"
android:layout_height="495dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="#drawable/generatieve_tros" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="#drawable/botrytis" />
</LinearLayout>
</HorizontalScrollView>
</android.support.constraint.ConstraintLayout>
The error:
D/ViewRootImpl#73c34ee[activity_kop]: MSG_WINDOW_FOCUS_CHANGED 0
D/ViewRootImpl#73c34ee[activity_kop]: dispatchDetachedFromWindow
D/InputTransport: Input channel destroyed: fd=80
D/ViewRootImpl#8980143[activity_tree]: ViewPostImeInputStage processPointer 0
D/ViewRootImpl#8980143[activity_tree]: ViewPostImeInputStage processPointer 1
D/ViewRootImpl#8980143[activity_tree]: MSG_WINDOW_FOCUS_CHANGED 0
D/TextView: setTypeface with style : 0
D/TextView: setTypeface with style : 0
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Alloc partial concurrent mark sweep GC freed 86(3KB) AllocSpace objects, 0(0B) LOS objects, 10% free, 142MB/158MB, paused 153us total 9.255ms
I/art: Starting a blocking GC Alloc
I/art: Alloc concurrent mark sweep GC freed 31(944B) AllocSpace objects, 0(0B) LOS objects, 10% free, 142MB/158MB, paused 135us total
14.916ms
I/art: Forcing collection of SoftReferences for 126MB allocation
I/art: Starting a blocking GC Alloc
I/art: Alloc concurrent mark sweep GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 10% free, 142MB/158MB, paused 143us total
13.015ms
W/art: Throwing OutOfMemoryError "Failed to allocate a 132710412 byte allocation with 16772392 free bytes and 113MB until OOM"
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Starting a blocking GC Alloc
I/art: Alloc partial concurrent mark sweep GC freed 6(144B) AllocSpace objects, 0(0B) LOS objects, 10% free, 142MB/158MB, paused 146us total 8.006ms
I/art: Starting a blocking GC Alloc
I/art: Alloc concurrent mark sweep GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 10% free, 142MB/158MB, paused 152us total
13.678ms
I/art: Forcing collection of SoftReferences for 126MB allocation
I/art: Starting a blocking GC Alloc
I/art: Alloc concurrent mark sweep GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 10% free, 142MB/158MB, paused 147us total
12.795ms
W/art: Throwing OutOfMemoryError "Failed to allocate a 132710412 byte allocation with 16776400 free bytes and 113MB until OOM"
D/skia: --- allocation failed for scaled bitmap
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: eu.app.app, PID: 8423
java.lang.OutOfMemoryError: Failed to allocate a 132710412 byte allocation with 16776400 free bytes and 113MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:700)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:535)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1179)
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:770)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:621)
at android.content.res.Resources.getDrawable(Resources.java:1640)
at android.content.Context.getDrawable(Context.java:525)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:351)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:100)
at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:58)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:78)
at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:68)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1024)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1081)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:873)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:873)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.inflate(LayoutInflater.java:525)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at eu.app.app.activity_fruit.onCreate(activity_fruit.java:12)
at android.app.Activity.performCreate(Activity.java:6912)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2877)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2985)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1635)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358) Application terminated.
The image you are trying to load is too big and it is causing out of memory exception. Try using an image loader like Glide to down sample and load the image into image view like this,
Glide.with(context)
.load(R.drawable.image)
.apply(new RequestOptions().override(100,100)/*down sample*/)
.into(new SimpleTarget<Drawable>() {
#Override
public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
//load the image into image view
}
});
android:largeHeap="true" in AndroidManifest.xml
I am developing an Titanium Module for Android. I add a customised menu xml "context_menu.xml" to it by placing it in folder /platform/android/res/menu/ in the Module Project.
It can successfully packaged but when include the module in another Mobile Project, it always raise an error during build:
[ERROR] Unable to find generated R.java file
Here is the context_menu.xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+id/acion_highlight"
android:title="#string/highlight"
android:showAsAction="always"/>
<item android:id="#+id/action_addNote"
android:title="#string/addNote"
android:showAsAction="always"/>
</menu>
So what's wrong??
[EDITED: Add logs in logcat]
05-09 04:47:47.476: D/AndroidRuntime(1120): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
05-09 04:47:47.476: D/AndroidRuntime(1120): CheckJNI is OFF
05-09 04:47:47.476: D/dalvikvm(1120): Unable to stat classpath element '/system/framework/filterfw.jar'
05-09 04:47:47.480: D/dalvikvm(1120): Trying to load lib libjavacore.so 0x0
05-09 04:47:47.480: D/dalvikvm(1120): Added shared lib libjavacore.so 0x0
05-09 04:47:47.484: D/dalvikvm(1120): Trying to load lib libnativehelper.so 0x0
05-09 04:47:47.488: D/dalvikvm(1120): Added shared lib libnativehelper.so 0x0
05-09 04:47:47.528: D/AndroidRuntime(1120): Calling main entry com.android.commands.pm.Pm
05-09 04:47:47.528: W/ActivityManager(324): No content provider found for permission revoke: file:///data/local/tmp/MyApp.apk
05-09 04:47:47.680: W/ActivityManager(324): No content provider found for permission revoke: file:///data/local/tmp/MyApp.apk
05-09 04:47:47.724: D/dalvikvm(324): GC_CONCURRENT freed 465K, 18% free 12077K/14663K, paused 11ms+1ms, total 27ms
05-09 04:47:47.724: D/dalvikvm(324): WAIT_FOR_CONCURRENT_GC blocked 1ms
05-09 04:47:47.740: D/dalvikvm(324): GC_FOR_ALLOC freed 347K, 20% free 11856K/14663K, paused 13ms, total 13ms
05-09 04:47:47.748: D/dalvikvm(324): GC_FOR_ALLOC freed 180K, 19% free 11899K/14663K, paused 11ms, total 11ms
05-09 04:47:47.768: D/dalvikvm(324): GC_FOR_ALLOC freed 62K, 19% free 11963K/14663K, paused 11ms, total 11ms
05-09 04:47:47.768: I/dalvikvm-heap(324): Grow heap (frag case) to 11.822MB for 109405-byte allocation
05-09 04:47:47.772: D/dalvikvm(324): GC_FOR_ALLOC freed 127K, 20% free 11943K/14791K, paused 12ms, total 12ms
05-09 04:47:47.840: D/dalvikvm(324): GC_CONCURRENT freed 407K, 16% free 12462K/14791K, paused 11ms+1ms, total 25ms
05-09 04:47:47.912: D/dalvikvm(324): GC_CONCURRENT freed 912K, 15% free 12688K/14791K, paused 11ms+1ms, total 27ms
05-09 04:47:47.912: D/dalvikvm(324): WAIT_FOR_CONCURRENT_GC blocked 6ms
05-09 04:47:48.040: D/dalvikvm(324): GC_CONCURRENT freed 1171K, 15% free 12711K/14791K, paused 12ms+1ms, total 38ms
05-09 04:47:48.040: D/dalvikvm(324): WAIT_FOR_CONCURRENT_GC blocked 14ms
05-09 04:47:48.092: D/dalvikvm(324): GC_CONCURRENT freed 1191K, 15% free 12716K/14791K, paused 11ms+2ms, total 30ms
05-09 04:47:48.092: D/dalvikvm(324): WAIT_FOR_CONCURRENT_GC blocked 8ms
05-09 04:47:48.156: D/dalvikvm(324): GC_CONCURRENT freed 1072K, 14% free 12723K/14791K, paused 11ms+2ms, total 27ms
05-09 04:47:48.312: D/dalvikvm(324): GC_CONCURRENT freed 1189K, 14% free 12737K/14791K, paused 11ms+1ms, total 25ms
05-09 04:47:48.320: D/dalvikvm(324): WAIT_FOR_CONCURRENT_GC blocked 3ms
05-09 04:47:48.532: D/dalvikvm(324): GC_CONCURRENT freed 1132K, 14% free 12752K/14791K, paused 11ms+12ms, total 40ms
05-09 04:47:48.796: D/dalvikvm(324): GC_CONCURRENT freed 1154K, 14% free 12753K/14791K, paused 11ms+1ms, total 33ms
05-09 04:47:48.928: D/dalvikvm(324): GC_CONCURRENT freed 1093K, 14% free 12766K/14791K, paused 11ms+1ms, total 29ms
05-09 04:47:49.252: I/PackageManager(324): Removing non-system package:hk.edu.ouhk.MyApp
05-09 04:47:49.252: I/ActivityManager(324): Force stopping package hk.edu.ouhk.MyApp uid=10047
05-09 04:47:49.312: I/PackageManager(324): Package hk.edu.ouhk.MyApp codePath changed from /data/app/hk.edu.ouhk.MyApp-1.apk to /data/app/hk.edu.ouhk.MyApp-2.apk; Retaining data and using new
05-09 04:47:49.332: I/PackageManager(324): Running dexopt on: hk.edu.ouhk.MyApp
05-09 04:47:49.364: D/dalvikvm(1130): Unable to stat classpath element '/system/framework/filterfw.jar'
05-09 04:47:49.408: D/dalvikvm(1130): DexOpt: 'Lorg/apache/commons/codec/binary/Base64;' has an earlier definition; blocking out
05-09 04:47:49.408: D/dalvikvm(1130): DexOpt: 'Lorg/apache/commons/codec/binary/Hex;' has an earlier definition; blocking out
05-09 04:47:49.416: D/dalvikvm(1130): DexOpt: 'Lorg/w3c/dom/UserDataHandler;' has an earlier definition; blocking out
05-09 04:47:49.488: D/dalvikvm(1130): DexOpt: not verifying/optimizing 'Lorg/apache/commons/codec/binary/Base64;': multiple definitions
05-09 04:47:49.492: D/dalvikvm(1130): DexOpt: not verifying/optimizing 'Lorg/apache/commons/codec/binary/Hex;': multiple definitions
05-09 04:47:49.492: I/dalvikvm(1130): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/codec/binary/Hex;'
05-09 04:47:49.520: I/dalvikvm(1130): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/codec/binary/Base64;'
05-09 04:47:49.520: I/dalvikvm(1130): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/codec/binary/Base64;'
05-09 04:47:49.556: D/dalvikvm(1130): DexOpt: not verifying/optimizing 'Lorg/w3c/dom/UserDataHandler;': multiple definitions
05-09 04:47:49.576: I/dalvikvm(1130): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/codec/binary/Hex;'
05-09 04:47:49.612: I/dalvikvm(1130): DexOpt: not resolving ambiguous class 'Lorg/apache/commons/codec/binary/Base64;'
05-09 04:47:49.616: D/dalvikvm(1130): DexOpt: load 35ms, verify+opt 186ms, 2392724 bytes
05-09 04:47:49.628: I/ActivityManager(324): Force stopping package hk.edu.ouhk.MyApp uid=10047
05-09 04:47:49.628: W/PackageManager(324): Code path for pkg : hk.edu.ouhk.MyApp changing from /data/app/hk.edu.ouhk.MyApp-1.apk to /data/app/hk.edu.ouhk.MyApp-2.apk
05-09 04:47:49.628: W/PackageManager(324): Resource path for pkg : hk.edu.ouhk.MyApp changing from /data/app/hk.edu.ouhk.MyApp-1.apk to /data/app/hk.edu.ouhk.MyApp-2.apk
05-09 04:47:49.644: D/PackageManager(324): New package installed in /data/app/hk.edu.ouhk.MyApp-2.apk
05-09 04:47:49.656: D/dalvikvm(586): WAIT_FOR_CONCURRENT_GC blocked 0ms
05-09 04:47:49.656: I/ActivityManager(324): Force stopping package hk.edu.ouhk.MyApp uid=10047
05-09 04:47:49.664: D/dalvikvm(586): GC_EXPLICIT freed 135K, 5% free 8223K/8583K, paused 1ms+1ms, total 8ms
05-09 04:47:49.668: D/dalvikvm(529): WAIT_FOR_CONCURRENT_GC blocked 0ms
05-09 04:47:49.676: D/dalvikvm(529): GC_EXPLICIT freed 447K, 7% free 10264K/10951K, paused 0ms+1ms, total 9ms
05-09 04:47:49.680: D/PackageManager(324): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged
05-09 04:47:49.680: D/PackageManager(324): generateServicesMap(android.content.SyncAdapter): 4 services unchanged
05-09 04:47:49.680: D/BackupManagerService(324): Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:hk.edu.ouhk.MyApp flg=0x8000010 (has extras) }
05-09 04:47:49.688: I/InputReader(324): Reconfiguring input devices. changes=0x00000010
05-09 04:47:49.688: D/dalvikvm(324): WAIT_FOR_CONCURRENT_GC blocked 0ms
05-09 04:47:49.716: D/dalvikvm(324): GC_EXPLICIT freed 692K, 14% free 12743K/14791K, paused 11ms+4ms, total 30ms
05-09 04:47:49.720: D/PackageManager(324): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged
05-09 04:47:49.720: D/PackageManager(324): generateServicesMap(android.content.SyncAdapter): 4 services unchanged
05-09 04:47:49.720: D/BackupManagerService(324): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:hk.edu.ouhk.MyApp flg=0x8000010 (has extras) }
05-09 04:47:49.720: V/BackupManagerService(324): removePackageParticipantsLocked: uid=10047 #1
05-09 04:47:49.732: I/InputReader(324): Reconfiguring input devices. changes=0x00000010
05-09 04:47:49.740: V/BackupManagerService(324): addPackageParticipantsLocked: #1
05-09 04:47:49.756: D/dalvikvm(324): WAIT_FOR_CONCURRENT_GC blocked 0ms
05-09 04:47:49.776: W/ResourceType(324): Failure getting entry for 0x7f060000 (t=5 e=0) in package 0 (error -75)
05-09 04:47:49.776: W/ResourceType(324): Failure getting entry for 0x7f060000 (t=5 e=0) in package 0 (error -75)
05-09 04:47:49.776: W/InputMethodManagerService(324): Found no subtypes in a system IME: com.android.inputmethod.pinyin
05-09 04:47:49.776: W/RecognitionManagerService(324): no available voice recognition services found
05-09 04:47:49.804: D/dalvikvm(324): GC_EXPLICIT freed 1821K, 23% free 11414K/14791K, paused 1ms+2ms, total 50ms
05-09 04:47:49.808: D/AndroidRuntime(1120): Shutting down VM
05-09 04:47:49.808: D/dalvikvm(1120): GC_CONCURRENT freed 99K, 78% free 450K/2048K, paused 0ms+0ms, total 1ms
05-09 04:47:49.808: D/jdwp(1120): Got wake-up signal, bailing out of select
05-09 04:47:49.808: D/dalvikvm(1120): Debugger has detached; object registry had 1 entries
05-09 04:47:49.808: I/AndroidRuntime(1120): NOTE: attach of thread 'Binder_3' failed
05-09 04:47:49.812: D/OpenGLRenderer(529): TextureCache::callback: name, removed size, mSize = 137, 32256, 1218792
05-09 04:47:49.812: D/OpenGLRenderer(529): TextureCache::get: create texture(0xb818d7a8): name, size, mSize = 143, 32256, 1251048
Problem solved.
Root cause is required xml is not properly defined. The "context_menu.xml" is referring to the string definition "action_highlight" and "action_addNote" which I haven't included in res/values/strings.xml
Hope it help someone new to Android development too.
I am working on a project that includes location detection using the GPS so I found this code that included a working .apk file but when I tried to compile it and run it, it always crashes. The application crashes when I try opening it in an emulator or on a Samsung S4 mobile.
N.B.
I've chosen the correct target which is API 17 and downloaded Google play services and included it in the library of the project.
Here is the code if anyone can help
Manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.tekguc.umut.googlemapsmapsandroidv2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<permission
android:name="com.example.androidmapsv2.permission.MAPS_RECEIVE"
android:protectionLevel="signature"></permission>
<uses-permission
android:name="com.example.androidmapsv2.permission.MAPS_RECEIVE"/>
<uses-permission
android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission
android:name="android.permission.INTERNET"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDciL7-T3BphxGv2q-A77vNrcyJQ_sTrgI"/>
<activity
android:name="info.tekguc.umut.googlemapsmapsandroidv2.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
MainActivity.java
package info.tekguc.umut.googlemapsmapsandroidv2;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
public class MainActivity extends Activity {
private GoogleMap mMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
final LatLng CIU = new LatLng(35.21843892856462, 33.41662287712097);
Marker ciu = mMap.addMarker(new MarkerOptions().position(CIU).title(
"My Office"));
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hello_world" />
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />
</RelativeLayout>
Logcat
12-25 17:30:32.450: D/dalvikvm(286): GC_FOR_ALLOC freed 6K, 15% free 7250K/8524K, paused 487ms, total 487ms
12-25 17:30:32.940: D/dalvikvm(286): GC_FOR_ALLOC freed 253K, 18% free 6999K/8524K, paused 463ms, total 465ms
12-25 17:30:32.950: W/BroadcastQueue(286): Failure sending broadcast Intent { act=android.intent.action.SIM_STATE_CHANGED flg=0x20000010 (has extras) }
12-25 17:30:32.950: W/BroadcastQueue(286): android.os.DeadObjectException
12-25 17:30:32.950: W/BroadcastQueue(286): at android.os.BinderProxy.transact(Native Method)
12-25 17:30:32.950: W/BroadcastQueue(286): at android.content.IIntentReceiver$Stub$Proxy.performReceive(IIntentReceiver.java:124)
12-25 17:30:32.950: W/BroadcastQueue(286): at com.android.server.am.BroadcastQueue.performReceiveLocked(BroadcastQueue.java:376)
12-25 17:30:32.950: W/BroadcastQueue(286): at com.android.server.am.BroadcastQueue.deliverToRegisteredReceiverLocked(BroadcastQueue.java:439)
12-25 17:30:32.950: W/BroadcastQueue(286): at com.android.server.am.BroadcastQueue.processNextBroadcast(BroadcastQueue.java:487)
12-25 17:30:32.950: W/BroadcastQueue(286): at com.android.server.am.BroadcastQueue$1.handleMessage(BroadcastQueue.java:140)
12-25 17:30:32.950: W/BroadcastQueue(286): at android.os.Handler.dispatchMessage(Handler.java:99)
12-25 17:30:32.950: W/BroadcastQueue(286): at android.os.Looper.loop(Looper.java:137)
12-25 17:30:32.950: W/BroadcastQueue(286): at com.android.server.am.ActivityManagerService$AThread.run(ActivityManagerService.java:1480)
12-25 17:30:34.300: I/ActivityManager(286): Start proc com.google.process.gapps for content provider com.google.android.gsf/.settings.GoogleSettingsProvider: pid=518 uid=10019 gids={50019, 3003, 1007, 1028, 1015, 1006, 2001, 3006}
12-25 17:30:34.350: W/ActivityManager(286): Activity idle timeout for ActivityRecord{40f692c8 u0 com.android.launcher/com.android.launcher2.Launcher}
12-25 17:30:34.380: D/dalvikvm(37): GC_EXPLICIT freed 35K, 6% free 2403K/2552K, paused 4ms+7ms, total 96ms
12-25 17:30:34.410: W/ActivityManager(286): Timeout executing service: ServiceRecord{40fa9d20 u0 com.android.inputmethod.latin/.LatinIME}
12-25 17:30:34.480: D/dalvikvm(37): GC_EXPLICIT freed <1K, 6% free 2404K/2552K, paused 4ms+14ms, total 96ms
12-25 17:30:34.540: I/Choreographer(405): Skipped 85 frames! The application may be doing too much work on its main thread.
12-25 17:30:34.590: D/dalvikvm(37): GC_EXPLICIT freed <1K, 6% free 2404K/2552K, paused 4ms+4ms, total 105ms
12-25 17:30:34.720: E/UserHistoryDictionary(378): when loading: file not foundjava.io.FileNotFoundException: /data/data/com.android.inputmethod.latin/files/UserHistoryDictionary.en_US.dict: open failed: ENOENT (No such file or directory)
12-25 17:30:34.840: E/Trace(501): error opening trace file: No such file or directory (2)
12-25 17:30:34.890: D/DebugService(390): DebugService DebugService:
12-25 17:30:34.890: D/TelephonyDebugService(390): TelephonyDebugService()
12-25 17:30:35.440: I/Process(286): Sending signal. PID: 378 SIG: 3
12-25 17:30:35.440: I/dalvikvm(378): threadid=3: reacting to signal 3
12-25 17:30:35.440: D/dalvikvm(390): GC_CONCURRENT freed 318K, 14% free 2691K/3124K, paused 4ms+168ms, total 591ms
12-25 17:30:35.640: I/Process(286): Sending signal. PID: 286 SIG: 3
12-25 17:30:35.640: I/dalvikvm(286): threadid=3: reacting to signal 3
12-25 17:30:35.970: D/dalvikvm(378): GC_CONCURRENT freed 239K, 13% free 2561K/2912K, paused 13ms+3ms, total 1274ms
12-25 17:30:36.021: E/StrictMode(378): A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
12-25 17:30:36.021: E/StrictMode(378): java.lang.Throwable: Explicit termination method 'close' not called
12-25 17:30:36.021: E/StrictMode(378): at dalvik.system.CloseGuard.open(CloseGuard.java:184)
12-25 17:30:36.021: E/StrictMode(378): at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:412)
12-25 17:30:36.021: E/StrictMode(378): at android.content.res.AssetManager.openNonAssetFdNative(Native Method)
12-25 17:30:36.021: E/StrictMode(378): at android.content.res.AssetManager.openNonAssetFd(AssetManager.java:428)
12-25 17:30:36.021: E/StrictMode(378): at android.content.res.Resources.openRawResourceFd(Resources.java:979)
12-25 17:30:36.021: E/StrictMode(378): at com.android.inputmethod.latin.BinaryDictionaryGetter.loadFallbackResource(BinaryDictionaryGetter.java:183)
12-25 17:30:36.021: E/StrictMode(378): at com.android.inputmethod.latin.BinaryDictionaryGetter.getDictionaryFiles(BinaryDictionaryGetter.java:456)
12-25 17:30:36.021: E/StrictMode(378): at com.android.inputmethod.latin.DictionaryFactory.createMainDictionaryFromManager(DictionaryFactory.java:57)
12-25 17:30:36.021: E/StrictMode(378): at com.android.inputmethod.latin.DictionaryFactory.createMainDictionaryFromManager(DictionaryFactory.java:87)
12-25 17:30:36.021: E/StrictMode(378): at com.android.inputmethod.latin.Suggest$1.run(Suggest.java:108)
12-25 17:30:36.030: I/dalvikvm(378): Wrote stack traces to '/data/anr/traces.txt'
12-25 17:30:37.332: I/Process(286): Sending signal. PID: 501 SIG: 3
12-25 17:30:37.332: I/dalvikvm(501): threadid=3: reacting to signal 3
12-25 17:30:37.420: I/dalvikvm(286): Wrote stack traces to '/data/anr/traces.txt'
12-25 17:30:37.420: I/Process(286): Sending signal. PID: 390 SIG: 3
12-25 17:30:37.420: I/dalvikvm(390): threadid=3: reacting to signal 3
12-25 17:30:38.040: I/dalvikvm(501): Wrote stack traces to '/data/anr/traces.txt'
12-25 17:30:38.230: E/Trace(518): error opening trace file: No such file or directory (2)
12-25 17:30:38.810: I/dalvikvm(390): Wrote stack traces to '/data/anr/traces.txt'
12-25 17:30:39.083: W/Settings(390): Setting auto_time_zone has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
12-25 17:30:39.410: D/dalvikvm(390): GC_CONCURRENT freed 60K, 14% free 2704K/3124K, paused 70ms+103ms, total 726ms
12-25 17:30:39.860: W/WindowManager(286): Window freeze timeout expired.
12-25 17:30:39.860: W/WindowManager(286): Force clearing orientation change: Window{41084730 u0 com.android.launcher/com.android.launcher2.Launcher}
12-25 17:30:39.962: E/SurfaceFlinger(36): ro.sf.lcd_density must be defined as a build property
12-25 17:30:40.870: I/Choreographer(405): Skipped 55 frames! The application may be doing too much work on its main thread.
12-25 17:30:42.290: E/BluetoothAdapter(286): Bluetooth binder is null
12-25 17:30:42.310: E/BluetoothAdapter(286): Bluetooth binder is null
12-25 17:30:42.310: V/WiredAccessoryManager(286): init()
12-25 17:30:42.430: E/SoundPool(286): error loading /system/media/audio/ui/Effect_Tick.ogg
12-25 17:30:42.430: W/AudioService(286): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
12-25 17:30:42.430: E/SoundPool(286): error loading /system/media/audio/ui/Effect_Tick.ogg
12-25 17:30:42.430: W/AudioService(286): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
12-25 17:30:42.430: E/SoundPool(286): error loading /system/media/audio/ui/Effect_Tick.ogg
12-25 17:30:42.430: W/AudioService(286): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
12-25 17:30:42.430: E/SoundPool(286): error loading /system/media/audio/ui/Effect_Tick.ogg
12-25 17:30:42.430: W/AudioService(286): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
12-25 17:30:42.430: E/SoundPool(286): error loading /system/media/audio/ui/Effect_Tick.ogg
12-25 17:30:42.430: W/AudioService(286): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
12-25 17:30:42.430: E/SoundPool(286): error loading /system/media/audio/ui/KeypressStandard.ogg
12-25 17:30:42.430: W/AudioService(286): Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg
12-25 17:30:42.430: E/SoundPool(286): error loading /system/media/audio/ui/KeypressSpacebar.ogg
12-25 17:30:42.430: W/AudioService(286): Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg
12-25 17:30:42.430: E/SoundPool(286): error loading /system/media/audio/ui/KeypressDelete.ogg
12-25 17:30:42.430: W/AudioService(286): Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg
12-25 17:30:42.430: E/SoundPool(286): error loading /system/media/audio/ui/KeypressReturn.ogg
12-25 17:30:42.430: W/AudioService(286): Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg
12-25 17:30:42.450: W/AudioService(286): loadSoundEffects(), Error -1 while loading samples
12-25 17:30:42.560: I/Choreographer(405): Skipped 115 frames! The application may be doing too much work on its main thread.
12-25 17:30:42.660: I/ActivityManager(286): Start proc com.android.music for broadcast com.android.music/.MediaButtonIntentReceiver: pid=543 uid=10029 gids={50029, 3003, 1015, 1028}
12-25 17:30:43.510: D/CAT(390): CatService: Running CAT service. STK app installed:false
12-25 17:30:43.510: D/CAT(390): CatService: NEW sInstance
12-25 17:30:43.730: D/dalvikvm(286): GC_EXPLICIT freed 565K, 14% free 7366K/8524K, paused 673ms+462ms, total 2446ms
12-25 17:30:43.750: I/dalvikvm(543): Turning on JNI app bug workarounds for target SDK version 9...
12-25 17:30:44.780: E/Trace(543): error opening trace file: No such file or directory (2)
12-25 17:30:45.049: D/dalvikvm(405): GC_FOR_ALLOC freed 186K, 8% free 3648K/3948K, paused 546ms, total 569ms
12-25 17:30:45.190: I/dalvikvm-heap(405): Grow heap (frag case) to 4.549MB for 921616-byte allocation
12-25 17:30:45.610: I/Process(286): Sending signal. PID: 405 SIG: 3
12-25 17:30:45.610: I/dalvikvm(405): threadid=3: reacting to signal 3
12-25 17:30:46.520: E/ActivityManager(286): ANR in com.android.inputmethod.latin
12-25 17:30:46.520: E/ActivityManager(286): Reason: Executing service com.android.inputmethod.latin/.LatinIME
12-25 17:30:46.520: E/ActivityManager(286): Load: 5.63 / 2.02 / 0.73
12-25 17:30:46.520: E/ActivityManager(286): CPU usage from 0ms to 11459ms later:
12-25 17:30:46.520: E/ActivityManager(286): 35% 36/surfaceflinger: 32% user + 2.8% kernel / faults: 2 minor
12-25 17:30:46.520: E/ActivityManager(286): 25% 286/system_server: 17% user + 7.4% kernel / faults: 972 minor 1 major
12-25 17:30:46.520: E/ActivityManager(286): 8.8% 390/com.android.phone: 5.6% user + 3.2% kernel / faults: 605 minor 5 major
12-25 17:30:46.520: E/ActivityManager(286): 7.2% 405/com.android.launcher: 4.8% user + 2.3% kernel / faults: 913 minor 3 major
12-25 17:30:46.520: E/ActivityManager(286): 6.6% 86/bootanimation: 5.6% user + 1% kernel
12-25 17:30:46.520: E/ActivityManager(286): 3.9% 518/zygote: 0.9% user + 2.9% kernel / faults: 2601 minor 19 major
12-25 17:30:46.520: E/ActivityManager(286): 2% 441/android.process.acore: 1.5% user + 0.5% kernel / faults: 228 minor 1 major
12-25 17:30:46.520: E/ActivityManager(286): 1.6% 501/com.android.systemui: 0.8% user + 0.8% kernel / faults: 719 minor
12-25 17:30:46.520: E/ActivityManager(286): 0.8% 378/zygote: 0.5% user + 0.2% kernel / faults: 446 minor 1 major
12-25 17:30:46.520: E/ActivityManager(286): 0% 30/servicemanager: 0% user + 0% kernel
12-25 17:30:46.520: E/ActivityManager(286): 0% 35/rild: 0% user + 0% kernel / faults: 6 minor
12-25 17:30:46.520: E/ActivityManager(286): 0.1% 1//init: 0% user + 0% kernel / faults: 9 minor
12-25 17:30:46.520: E/ActivityManager(286): +0% 543/com.android.music: 0% user + 0% kernel
12-25 17:30:46.520: E/ActivityManager(286): 100% TOTAL: 76% user + 23% kernel
12-25 17:30:46.520: E/ActivityManager(286): CPU usage from 9332ms to 10684ms later:
12-25 17:30:46.520: E/ActivityManager(286): 40% 36/surfaceflinger: 37% user + 3.2% kernel
12-25 17:30:46.520: E/ActivityManager(286): 37% 67/SurfaceFlinger: 35% user + 1.6% kernel
12-25 17:30:46.520: E/ActivityManager(286): 0.8% 84/EventThread: 0% user + 0.8% kernel
12-25 17:30:46.520: E/ActivityManager(286): 0.8% 85/Binder_1: 0% user + 0.8% kernel
12-25 17:30:46.520: E/ActivityManager(286): 0.8% 238/Binder_2: 0.8% user + 0% kernel
12-25 17:30:46.520: E/ActivityManager(286): 19% 286/system_server: 11% user + 7.8% kernel / faults: 47 minor
12-25 17:30:46.520: E/ActivityManager(286): 8.7% 303/ActivityManager: 5.2% user + 3.5% kernel
12-25 17:30:46.520: E/ActivityManager(286): 2.6% 293/Compiler: 1.7% user + 0.8% kernel
12-25 17:30:46.520: E/ActivityManager(286): 1.7% 470/Binder_7: 1.7% user + 0% kernel
12-25 17:30:46.520: E/ActivityManager(286): 0.8% 286/system_server: 0% user + 0.8% kernel
12-25 17:30:46.520: E/ActivityManager(286): 0.8% 423/Binder_4: 0.8% user + 0% kernel
12-25 17:30:46.520: E/ActivityManager(286): 0.8% 439/Binder_6: 0.8% user + 0% kernel
12-25 17:30:46.520: E/ActivityManager(286): 0.8% 471/Binder_8: 0.8% user + 0% kernel
12-25 17:30:46.520: E/ActivityManager(286): 12% 405/com.android.launcher: 8.1% user + 4.5% kernel / faults: 274 minor 1 major
12-25 17:30:46.520: E/ActivityManager(286): 7.2% 405/ndroid.launcher: 3.6% user + 3.6% kernel
12-25 17:30:46.520: E/ActivityManager(286): 2.7% 407/GC: 1.8% user + 0.9% kernel
12-25 17:30:46.520: E/ActivityManager(286): 0.9% 412/Compiler: 0.9% user + 0% kernel
12-25 17:30:46.520: E/ActivityManager(286): 10% 543/com.android.music: 3.4% user + 6.8% kernel / faults: 714 minor 1 major
12-25 17:30:46.520: E/ActivityManager(286): 11% 543/re-initialized>: 4.2% user + 7.6% kernel
12-25 17:30:46.520: E/ActivityManager(286): 8% 86/bootanimation: 7.1% user + 0.8% kernel
12-25 17:30:46.520: E/ActivityManager(286): 7.1% 103/BootAnimation: 6.2% user + 0.8% kernel
12-25 17:30:46.520: E/ActivityManager(286): 4.5% 390/com.android.phone: 2.7% user + 1.8% kernel / faults: 33 minor
12-25 17:30:46.520: E/ActivityManager(286): 6.3% 390/m.android.phone: 3.6% user + 2.7% kernel
12-25 17:30:46.520: E/ActivityManager(286): 0.9% 392/GC: 0.9% user + 0% kernel
12-25 17:30:46.520: E/ActivityManager(286): 0.9% 401/Compiler: 0.9% user + 0% kernel
12-25 17:30:46.520: E/ActivityManager(286): 4.8% 518/com.google.process.gapps: 1.9% user + 2.8% kernel / faults: 250 minor 6 major
12-25 17:30:46.520: E/ActivityManager(286): 8.6% 518/e.process.gapps: 2.8% user + 5.7% kernel
12-25 17:30:46.520: E/ActivityManager(286): 0.7% 1//init: 0.7% user + 0% kernel / faults: 3 minor
12-25 17:30:46.520: E/ActivityManager(286): 100% TOTAL: 74% user + 25% kernel
12-25 17:30:46.839: I/FusedLocation(474): engine started (com.android.location.fused)
12-25 17:30:47.470: I/dalvikvm(405): Wrote stack traces to '/data/anr/traces.txt'
12-25 17:30:47.480: D/dalvikvm(405): GC_CONCURRENT freed 9K, 7% free 4538K/4852K, paused 7ms+1868ms, total 2294ms
12-25 17:30:47.490: D/dalvikvm(405): WAIT_FOR_CONCURRENT_GC blocked 3ms
12-25 17:30:47.600: D/dalvikvm(286): GC_FOR_ALLOC freed 556K, 18% free 7048K/8524K, paused 976ms, total 978ms
12-25 17:30:47.700: W/ActivityManager(286): Killing ProcessRecord{40f90870 378:com.android.inputmethod.latin/u0a10022}: background ANR
12-25 17:30:47.720: I/ActivityManager(286): Process com.android.inputmethod.latin (pid 378) has died.
12-25 17:30:47.720: W/ActivityManager(286): Scheduling restart of crashed service com.android.inputmethod.latin/.LatinIME in 5000ms
12-25 17:30:47.750: D/CAT(390): CatService: SIM ready. Reporting STK service running now...
12-25 17:30:47.920: D/dalvikvm(405): GC_FOR_ALLOC freed <1K, 7% free 4539K/4852K, paused 407ms, total 428ms
12-25 17:30:48.092: I/dalvikvm-heap(405): Grow heap (frag case) to 5.419MB for 921616-byte allocation
12-25 17:30:48.480: D/dalvikvm(405): GC_CONCURRENT freed <1K, 6% free 5439K/5756K, paused 6ms+78ms, total 388ms
12-25 17:30:48.480: D/dalvikvm(405): WAIT_FOR_CONCURRENT_GC blocked 259ms
12-25 17:30:48.630: D/dalvikvm(405): GC_FOR_ALLOC freed <1K, 6% free 5440K/5756K, paused 132ms, total 146ms
12-25 17:30:48.659: I/dalvikvm-heap(405): Grow heap (frag case) to 6.299MB for 921616-byte allocation
12-25 17:30:48.730: D/dalvikvm(286): GC_FOR_ALLOC freed 252K, 18% free 7025K/8524K, paused 752ms, total 756ms
12-25 17:30:49.160: D/dalvikvm(405): GC_CONCURRENT freed <1K, 5% free 6340K/6660K, paused 27ms+5ms, total 509ms
12-25 17:30:49.160: D/dalvikvm(405): WAIT_FOR_CONCURRENT_GC blocked 346ms
12-25 17:30:49.510: D/MccTable(390): updateMccMncConfiguration: mcc=310, mnc=260
12-25 17:30:49.510: D/TelephonyManager(390): getLteOnCdmaMode=0 curVal=-1 product_type='' lteOnCdmaProductType=''
12-25 17:30:49.510: D/MccTable(390): locale set to en_us
12-25 17:30:49.510: D/MccTable(390): WIFI_COUNTRY_CODE set to us
12-25 17:30:49.691: I/WifiService(286): WifiService trying to set country code to us with persist set to true
Try moving all code that references your GoogleMap to onStart() or onResume(). The map in a map fragment isn't instantiated until after the fragment has gone through onCreateView (link). So, move the following to onStart():
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
if(mMap != null) {
mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
final LatLng CIU = new LatLng(35.21843892856462, 33.41662287712097);
Marker ciu = mMap.addMarker(new MarkerOptions().position(CIU).title(
"My Office"));
}
Also, the null check is necessary because the map will be null if google play services aren't installed, or the map isn't available for some other reason.
This project has a number (433) saved in a database, which is accessed through a servlet and then should be sent to the Android app. Before I added AsyncTask the app would sometimes retrieve the data (should be 433) from the servlet and sometimes not. Upon clicking the homePage button, the mainActivity screen should appear and display the data. I added AsyncTask hoping it would work consistently, but now all I get is the text "Light Data= " but no data (should say "Light Data= 433). The servlet connects to the database fine, so I know the issue lies within the app. I'd really appreciate code that relates to my project, thankyou.
HomePage:
package com.example.clearlight;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class HomePage extends Activity {
private Button ScheduleBtn;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.homepage);
ScheduleBtn = (Button) findViewById(R.id.home_btn);
ScheduleBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent myIntent = new Intent(HomePage.this, MainActivity.class);
HomePage.this.startActivity(myIntent);
}
});
}
}
MainActivity:
package com.example.clearlight;
import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.widget.TextView;
import android.widget.Toast;
import java.net.URL;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;
import android.os.StrictMode;
import android.util.Log;
public class MainActivity extends Activity {
TextView txt;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
setContentView(R.layout.relative);
class LongOperation extends AsyncTask<String, Void, String> {
#Override
protected String doInBackground(String... params) {
// TODO Auto-generated method stub
String result=null;
URL url = null;
DefaultHttpClient httpclient = null;
try {
String registrationUrl = "http://10.0.2.2/SensorInfo/GetLightData?sensor=light";
url = new URL(registrationUrl);
HttpGet getRequest = new HttpGet(registrationUrl);
ResponseHandler<String> handler = new BasicResponseHandler();
httpclient = new DefaultHttpClient();
// request data from server
result = httpclient.execute(getRequest, handler);
Log.d("MyApp", "Data from server is "+ result);
}
catch (Exception ex) {Log.e("error",ex.toString());
ex.printStackTrace();
}
return result;
}
#Override
protected void onPostExecute(String result)
{
TextView text1 = (TextView)MainActivity.this.findViewById(R.id.text);
//Sets the new text to TextView (runtime click event)//*******
text1.setText("Light Data= " + result);
Toast.makeText(MainActivity.this, "Light Data:" + result, Toast.LENGTH_SHORT).show(); //MESSAGE BOX
}
}
}
}
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.clearlight"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.clearlight.MainActivity"
android:label="#string/app_name" >
</activity>
<activity
android:name="com.example.clearlight.HomePage"
android:label="#string/homepage"
android:parentActivityName="com.example.clearlight.MainActivity" >
<!-- Moved the intent filter to HomePage -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.clearlight.MainActivity" />
</activity>
</application>
</manifest>
Logcat:
03-20 01:08:20.433: D/Launcher.Model(418): Reload apps on config change. curr_mcc:310 prevmcc:0 03-20 01:08:20.473: E/StrictMode(401): A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 03-20 01:08:20.473: E/StrictMode(401): java.lang.Throwable: Explicit termination method 'close' not called 03-20 01:08:20.473: E/StrictMode(401): at dalvik.system.CloseGuard.open(CloseGuard.java:184) 03-20 01:08:20.473: E/StrictMode(401): at android.database.CursorWindow.(CursorWindow.java:137) 03-20 01:08:20.473: E/StrictMode(401): at android.database.CursorWindow.(CursorWindow.java:41) 03-20 01:08:20.473: E/StrictMode(401): at android.database.CursorWindow$1.createFromParcel(CursorWindow.java:681) 03-20 01:08:20.473: E/StrictMode(401): at android.database.CursorWindow$1.createFromParcel(CursorWindow.java:679) 03-20 01:08:20.473: E/StrictMode(401): at android.database.BulkCursorDescriptor.readFromParcel(BulkCursorDescriptor.java:75) 03-20 01:08:20.473: E/StrictMode(401): at android.database.BulkCursorDescriptor$1.createFromParcel(BulkCursorDescriptor.java:34) 03-20 01:08:20.473: E/StrictMode(401): at android.database.BulkCursorDescriptor$1.createFromParcel(BulkCursorDescriptor.java:30) 03-20 01:08:20.473: E/StrictMode(401): at android.content.ContentProviderProxy.query(ContentProviderNative.java:369) 03-20 01:08:20.473: E/StrictMode(401): at android.content.ContentResolver.query(ContentResolver.java:370) 03-20 01:08:20.473: E/StrictMode(401): at android.content.CursorLoader.loadInBackground(CursorLoader.java:65) 03-20 01:08:20.473: E/StrictMode(401): at android.content.CursorLoader.loadInBackground(CursorLoader.java:43) 03-20 01:08:20.473: E/StrictMode(401): at android.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:301) 03-20 01:08:20.473: E/StrictMode(401): at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:68) 03-20 01:08:20.473: E/StrictMode(401): at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:56) 03-20 01:08:20.473: E/StrictMode(401): at android.os.AsyncTask$2.call(AsyncTask.java:287) 03-20 01:08:20.473: E/StrictMode(401): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 03-20 01:08:20.473: E/StrictMode(401): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 03-20 01:08:20.473: E/StrictMode(401): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 03-20 01:08:20.473: E/StrictMode(401): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 03-20 01:08:20.473: E/StrictMode(401): at java.lang.Thread.run(Thread.java:856) 03-20 01:08:20.484: D/Launcher.Model(418): going to save icon bitmap for info=ShortcutInfo(title=Settingsintent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.settings/.Settings }id=6 type=0 container=-100 screen=3 cellX=2 cellY=3 spanX=1 spanY=1 isGesture=false dropPos=null) 03-20 01:08:20.534: E/StrictMode(401): A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 03-20 01:08:20.534: E/StrictMode(401): java.lang.Throwable: Explicit termination method 'close' not called 03-20 01:08:20.534: E/StrictMode(401): at dalvik.system.CloseGuard.open(CloseGuard.java:184) 03-20 01:08:20.534: E/StrictMode(401): at android.content.ContentResolver$CursorWrapperInner.(ContentResolver.java:1835) 03-20 01:08:20.534: E/StrictMode(401): at android.content.ContentResolver.query(ContentResolver.java:392) 03-20 01:08:20.534: E/StrictMode(401): at android.content.CursorLoader.loadInBackground(CursorLoader.java:65) 03-20 01:08:20.534: E/StrictMode(401): at android.content.CursorLoader.loadInBackground(CursorLoader.java:43) 03-20 01:08:20.534: E/StrictMode(401): at android.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:301) 03-20 01:08:20.534: E/StrictMode(401): at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:68) 03-20 01:08:20.534: E/StrictMode(401): at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:56) 03-20 01:08:20.534: E/StrictMode(401): at android.os.AsyncTask$2.call(AsyncTask.java:287) 03-20 01:08:20.534: E/StrictMode(401): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 03-20 01:08:20.534: E/StrictMode(401): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 03-20 01:08:20.534: E/StrictMode(401): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 03-20 01:08:20.534: E/StrictMode(401): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 03-20 01:08:20.534: E/StrictMode(401): at java.lang.Thread.run(Thread.java:856) 03-20 01:08:20.534: W/CursorWrapperInner(401): Cursor finalized without prior close() 03-20 01:08:20.563: W/CursorWrapperInner(401): Cursor finalized without prior close() 03-20 01:08:20.614: D/AlertService(401): No fired or scheduled alerts 03-20 01:08:20.704: D/dalvikvm(418): GC_CONCURRENT freed 328K, 5% free 10193K/10631K, paused 17ms+7ms, total 95ms 03-20 01:08:20.723: D/Launcher.Model(418): going to save icon bitmap for info=ShortcutInfo(title=Messagingintent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.mms/.ui.ConversationList }id=12 type=0 container=-101 screen=3 cellX=3 cellY=0 spanX=1 spanY=1 isGesture=false dropPos=null) 03-20 01:08:20.833: D/Launcher.Model(418): going to save icon bitmap for info=ShortcutInfo(title=Peopleintent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.contacts/.activities.PeopleActivity }id=10 type=0 container=-101 screen=1 cellX=1 cellY=0 spanX=1 spanY=1 isGesture=false dropPos=null) 03-20 01:08:20.893: D/dalvikvm(163): WAIT_FOR_CONCURRENT_GC blocked 0ms 03-20 01:08:21.083: D/dalvikvm(163): GC_EXPLICIT freed 222K, 47% free 10043K/18887K, paused 25ms+10ms, total 187ms 03-20 01:08:21.113: D/Launcher.Model(418): going to save icon bitmap for info=ShortcutInfo(title=Phoneintent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.contacts/.activities.DialtactsActivity }id=8 type=0 container=-101 screen=0 cellX=0 cellY=0 spanX=1 spanY=1 isGesture=false dropPos=null) 03-20 01:08:21.203: D/Launcher.Model(418): going to save icon bitmap for info=ShortcutInfo(title=Browserintent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.browser/.BrowserActivity }id=14 type=0 container=-101 screen=4 cellX=4 cellY=0 spanX=1 spanY=1 isGesture=false dropPos=null) 03-20 01:08:21.293: D/Launcher.Model(418): going to save icon bitmap for info=ShortcutInfo(title=Cameraintent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.camera/.Camera }id=4 type=0 container=-100 screen=2 cellX=0 cellY=3 spanX=1 spanY=1 isGesture=false dropPos=null) 03-20 01:08:21.713: I/PackageManager(163): Running dexopt on: com.example.clearlight 03-20 01:08:22.373: D/EmailProvider(570): Creating EmailProviderBody database 03-20 01:08:22.623: D/dalvikvm(375): GC_CONCURRENT freed 359K, 6% free 8370K/8839K, paused 17ms+45ms, total 174ms 03-20 01:08:22.943: D/EmailProvider(570): Creating EmailProvider database 03-20 01:08:23.623: D/dalvikvm(637): DexOpt: load 310ms, verify+opt 1126ms, 788740 bytes 03-20 01:08:23.833: D/EmailProvider(570): fromDatabase accounts: 0 03-20 01:08:23.844: D/EmailProvider(570): ending toDatabase transaction; copyCount = 0 03-20 01:08:23.873: D/EmailProvider(570): ending fromDatabase transaction; copyCount = 0 03-20 01:08:24.653: I/Email(570): Onetime initialization: completed. 03-20 01:08:24.964: D/dalvikvm(163): GC_CONCURRENT freed 452K, 47% free 10034K/18887K, paused 33ms+15ms, total 129ms 03-20 01:08:24.964: D/PackageManager(163): New package installed in /data/app/com.example.clearlight-1.apk 03-20 01:08:25.804: I/ActivityManager(163): Force stopping package com.example.clearlight uid=10037 03-20 01:08:25.954: W/ResourceType(418): Attempt to retrieve bag 0x7f0d0017 which is invalid or in a cycle. 03-20 01:08:25.954: W/ResourceType(418): Attempt to retrieve bag 0x7f0d0017 which is invalid or in a cycle. 03-20 01:08:25.954: W/ResourceType(418): Attempt to retrieve bag 0x7f0d0017 which is invalid or in a cycle. 03-20 01:08:25.954: W/ResourceType(418): Attempt to retrieve bag 0x7f0d0017 which is invalid or in a cycle. 03-20 01:08:25.954: W/ResourceType(418): Attempt to retrieve bag 0x7f0d0017 which is invalid or in a cycle. 03-20 01:08:26.294: D/AlertService(401): 0 Action = android.intent.action.PROVIDER_CHANGED 03-20 01:08:26.294: D/AlertService(401): Beginning updateAlertNotification 03-20 01:08:26.424: D/dalvikvm(163): WAIT_FOR_CONCURRENT_GC blocked 0ms 03-20 01:08:26.554: I/AccountTypeManager(501): Loaded meta-data for 1 account types, 0 accounts in 78ms(wall) 5ms(cpu) 03-20 01:08:26.604: I/Choreographer(418): Skipped 1623 frames! The application may be doing too much work on its main thread. 03-20 01:08:26.735: D/PackageManager(163): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged 03-20 01:08:26.754: I/InputReader(163): Reconfiguring input devices. changes=0x00000010 03-20 01:08:26.764: D/PackageManager(163): generateServicesMap(android.content.SyncAdapter): 4 services unchanged 03-20 01:08:26.764: D/BackupManagerService(163): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.clearlight flg=0x8000010 (has extras) } 03-20 01:08:26.984: D/gralloc_goldfish(418): Emulator without GPU emulation detected. 03-20 01:08:26.994: V/BackupManagerService(163): addPackageParticipantsLocked: #1 03-20 01:08:27.124: W/InputMethodManagerService(163): Found no subtypes in a system IME: com.android.inputmethod.pinyin 03-20 01:08:27.205: D/dalvikvm(418): GC_FOR_ALLOC freed 414K, 5% free 10364K/10887K, paused 55ms, total 104ms 03-20 01:08:27.224: I/dalvikvm-heap(418): Grow heap (frag case) to 11.564MB for 1463056-byte allocation 03-20 01:08:27.334: D/dalvikvm(418): GC_FOR_ALLOC freed 30K, 5% free 11763K/12359K, paused 104ms, total 104ms 03-20 01:08:27.434: D/dalvikvm(418): GC_CONCURRENT freed <1K, 5% free 11763K/12359K, paused 17ms+21ms, total 106ms 03-20 01:08:27.564: D/dalvikvm(521): GC_CONCURRENT freed 225K, 4% free 8180K/8455K, paused 955ms+42ms, total 2035ms 03-20 01:08:27.694: E/SQLiteLog(521): (1) no such table: files 03-20 01:08:27.804: D/dalvikvm(163): GC_EXPLICIT freed 548K, 47% free 10010K/18887K, paused 1038ms+24ms, total 1380ms 03-20 01:08:27.804: D/dalvikvm(163): WAIT_FOR_CONCURRENT_GC blocked 198ms 03-20 01:08:27.814: D/dalvikvm(163): WAIT_FOR_CONCURRENT_GC blocked 511ms 03-20 01:08:27.814: D/dalvikvm(163): WAIT_FOR_CONCURRENT_GC blocked 444ms 03-20 01:08:27.824: D/dalvikvm(163): WAIT_FOR_CONCURRENT_GC blocked 415ms 03-20 01:08:27.834: D/dalvikvm(163): WAIT_FOR_CONCURRENT_GC blocked 413ms 03-20 01:08:27.834: D/dalvikvm(163): WAIT_FOR_CONCURRENT_GC blocked 372ms 03-20 01:08:27.834: D/dalvikvm(163): WAIT_FOR_CONCURRENT_GC blocked 372ms 03-20 01:08:27.834: D/dalvikvm(163): WAIT_FOR_CONCURRENT_GC blocked 369ms 03-20 01:08:27.844: D/dalvikvm(163): WAIT_FOR_CONCURRENT_GC blocked 371ms 03-20 01:08:27.844: D/dalvikvm(163): WAIT_FOR_CONCURRENT_GC blocked 369ms 03-20 01:08:27.844: D/dalvikvm(163): WAIT_FOR_CONCURRENT_GC blocked 327ms 03-20 01:08:27.844: D/dalvikvm(163): WAIT_FOR_CONCURRENT_GC blocked 324ms 03-20 01:08:27.944: D/ExchangeService(587): !!! EAS ExchangeService, onStartCommand, startingUp = true, running = false 03-20 01:08:27.944: D/dalvikvm(36): WAIT_FOR_CONCURRENT_GC blocked 0ms 03-20 01:08:27.964: I/ActivityManager(163): Start proc com.svox.pico for broadcast com.svox.pico/.VoiceDataInstallerReceiver: pid=649 uid=10015 gids={1015, 1028} 03-20 01:08:28.074: D/dalvikvm(36): GC_EXPLICIT freed 37K, 4% free 7964K/8259K, paused 6ms+8ms, total 132ms 03-20 01:08:28.084: D/dalvikvm(36): WAIT_FOR_CONCURRENT_GC blocked 0ms 03-20 01:08:28.174: D/dalvikvm(418): GC_FOR_ALLOC freed 2K, 5% free 11765K/12359K, paused 312ms, total 346ms 03-20 01:08:28.204: D/dalvikvm(36): GC_EXPLICIT freed <1K, 4% free 7964K/8259K, paused 24ms+5ms, total 121ms 03-20 01:08:28.204: I/dalvikvm-heap(418): Grow heap (frag case) to 12.932MB for 1463056-byte allocation 03-20 01:08:28.214: D/dalvikvm(36): WAIT_FOR_CONCURRENT_GC blocked 0ms 03-20 01:08:28.344: E/Trace(649): error opening trace file: No such file or directory (2) 03-20 01:08:28.364: D/dalvikvm(36): GC_EXPLICIT freed <1K, 4% free 7964K/8259K, paused 15ms+5ms, total 145ms 03-20 01:08:28.454: D/dalvikvm(418): GC_CONCURRENT freed <1K, 5% free 13193K/13831K, paused 31ms+8ms, total 243ms 03-20 01:08:28.454: D/dalvikvm(418): WAIT_FOR_CONCURRENT_GC blocked 195ms 03-20 01:08:28.484: I/ActivityThread(649): Pub com.svox.pico.providers.SettingsProvider: com.svox.pico.providers.SettingsProvider 03-20 01:08:28.615: D/dalvikvm(163): WAIT_FOR_CONCURRENT_GC blocked 1152ms 03-20 01:08:28.714: I/ActivityManager(163): Displayed com.android.launcher/com.android.launcher2.Launcher: +26s665ms (total
+37s591ms) 03-20 01:08:28.787: I/ARMAssembler(35): generated scanline__00000077:03515104_00009002_00000000 [127 ipp] (149 ins) at [0x4124a4b8:0x4124a70c] in 917426 ns 03-20 01:08:29.199: I/ARMAssembler(35): generated scanline__00000077:03010104_00008002_00000000 [ 89 ipp] (110 ins) at [0x4124a710:0x4124a8c8] in 809441 ns 03-20 01:08:29.394: D/dalvikvm(277): GC_FOR_ALLOC freed 9816K, 53% free 9024K/18887K, paused 702ms, total 748ms 03-20 01:08:29.414: I/dalvikvm-heap(277): Grow heap (frag case) to 15.888MB for 7372816-byte allocation 03-20 01:08:29.584: D/dalvikvm(277): GC_CONCURRENT freed 132K, 15% free 16091K/18887K, paused 50ms+18ms, total 176ms 03-20 01:08:29.864: D/dalvikvm(277): GC_FOR_ALLOC freed <1K, 15% free 16091K/18887K, paused 47ms, total 47ms 03-20 01:08:29.894: I/dalvikvm-heap(277): Grow heap (frag case) to 18.688MB for 3072016-byte allocation 03-20 01:08:30.024: D/dalvikvm(277): GC_CONCURRENT freed 0K, 13% free 19091K/21895K, paused 20ms+19ms, total 126ms 03-20 01:08:30.024: D/dalvikvm(277): WAIT_FOR_CONCURRENT_GC blocked 107ms 03-20 01:08:30.504: D/AndroidRuntime(250): Shutting down VM 03-20 01:08:30.524: D/dalvikvm(250): GC_CONCURRENT freed 97K, 78% free 453K/2048K, paused 1ms+2ms, total 15ms 03-20 01:08:30.524: D/jdwp(250): Got wake-up signal, bailing out of select 03-20 01:08:30.524: D/dalvikvm(250): Debugger has detached; object registry had 1 entries 03-20 01:08:30.534: I/AndroidRuntime(250): NOTE: attach of thread 'Binder_3' failed 03-20 01:08:30.794: I/InputReader(163): Reconfiguring input devices. changes=0x00000010 03-20 01:08:30.844: D/PackageManager(163): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged 03-20 01:08:30.864: I/InputReader(163): Reconfiguring input devices. changes=0x00000010 03-20 01:08:30.894: D/PackageManager(163): generateServicesMap(android.content.SyncAdapter): 4 services unchanged 03-20 01:08:31.024: D/PackageManager(163): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged 03-20 01:08:31.064: D/PackageManager(163): generateServicesMap(android.content.SyncAdapter): 4 services unchanged 03-20 01:08:31.264: I/AccountTypeManager(501): Loaded meta-data for 1 account types, 0 accounts in 30ms(wall) 6ms(cpu) 03-20 01:08:31.294: I/AccountTypeManager(501): Loaded meta-data for 1 account types, 0 accounts in 24ms(wall) 7ms(cpu) 03-20 01:08:31.564: D/AndroidRuntime(668): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<< 03-20 01:08:31.564: D/AndroidRuntime(668): CheckJNI is ON 03-20 01:08:31.644: D/dalvikvm(668): Trying to load lib libjavacore.so 0x0 03-20 01:08:31.664: D/dalvikvm(668): Added shared lib libjavacore.so 0x0 03-20 01:08:31.734: D/dalvikvm(668): Trying to load lib libnativehelper.so 0x0 03-20 01:08:31.734: D/dalvikvm(668): Added shared lib libnativehelper.so 0x0 03-20 01:08:31.904: D/dalvikvm(163): GC_CONCURRENT freed 404K, 48% free 10005K/18887K, paused 116ms+20ms, total 388ms 03-20 01:08:32.254: D/dalvikvm(501): GC_CONCURRENT freed 203K, 4% free 8205K/8519K, paused 98ms+21ms, total 963ms 03-20 01:08:32.564: D/AlertService(401): No fired or scheduled alerts 03-20 01:08:32.834: D/dalvikvm(469): GC_CONCURRENT freed 232K, 4% free 8181K/8519K, paused 90ms+7ms, total 540ms 03-20 01:08:33.074: I/Choreographer(418): Skipped 1563 frames! The application may be doing too much work on its main thread. 03-20 01:08:33.094: D/AndroidRuntime(668): Calling main entry com.android.commands.am.Am 03-20 01:08:33.164: I/ActivityManager(163): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.clearlight/.HomePage u=0} from pid 668 03-20 01:08:33.214: D/PermissionCache(35): checking android.permission.READ_FRAME_BUFFER for uid=1000 => granted (1103 us) 03-20 01:08:33.224: W/WindowManager(163): Failure taking screenshot for (246x410) to layer 21005 03-20 01:08:33.234: D/AndroidRuntime(668): Shutting down VM 03-20 01:08:33.274: D/dalvikvm(668): GC_CONCURRENT freed 98K, 77% free 483K/2048K, paused 2ms+3ms, total 32ms 03-20 01:08:33.284: I/AndroidRuntime(668): NOTE: attach of thread 'Binder_3' failed 03-20 01:08:33.404: I/ContactDirectoryManager(375): deleted 0 stale rows which don't have any relevant directory 03-20 01:08:33.604: D/dalvikvm(682): Not late-enabling CheckJNI (already on) 03-20 01:08:33.635: I/ActivityManager(163): Start proc com.example.clearlight for activity com.example.clearlight/.HomePage: pid=682 uid=10037 gids={3003, 1028} 03-20 01:08:34.093: E/Trace(682): error opening trace file: No such file or directory (2) 03-20 01:08:34.314: I/ARMAssembler(35): generated scanline__00000077:03515104_00009001_00000000 [131 ipp] (153 ins) at [0x4124a8d0:0x4124ab34] in 736260 ns 03-20 01:08:34.754: D/gralloc_goldfish(682): Emulator without GPU emulation detected. 03-20 01:08:34.824: I/ActivityManager(163): Displayed com.example.clearlight/.HomePage: +1s253ms 03-20 01:08:35.484: I/ContactDirectoryManager(375): Discovered 0 contact directories in 7915ms 03-20 01:08:35.484: I/Launcher(418): setLoadOnResume 03-20 01:08:35.564: I/Launcher(418): setLoadOnResume 03-20 01:08:35.615: W/RecognitionManagerService(163): no available voice recognition services found 03-20 01:08:35.634: I/ContactsDatabaseHelper(375): Switching to locale en_US 03-20 01:08:35.785: D/dalvikvm(418): GREF has increased to 201 03-20 01:08:35.804: I/Launcher(418): setLoadOnResume 03-20 01:08:35.804: I/Launcher(418): setLoadOnResume 03-20 01:08:35.983: W/ActivityManager(163): Permission denied: checkComponentPermission() owningUid=1000 03-20 01:08:35.983: W/BroadcastQueue(163): Permission Denial: broadcasting Intent { act=android.appwidget.action.APPWIDGET_UPDATE_OPTIONS flg=0x10 cmp=com.android.settings/.widget.SettingsAppWidgetProvider (has extras) } from android (pid=418, uid=10014) is not exported from uid 1000 due to receiver com.android.settings/com.android.settings.widget.SettingsAppWidgetProvider 03-20 01:08:36.003: I/Launcher(418): setLoadOnResume 03-20 01:08:36.074: E/WVMExtractor(38): Failed to open libwvm.so 03-20 01:08:36.213: D/dalvikvm(418): GC_CONCURRENT freed 1906K, 14% free 12996K/15047K, paused 36ms+14ms, total 145ms 03-20 01:08:36.613: I/ActivityManager(163): Start proc com.android.quicksearchbox for broadcast com.android.quicksearchbox/.CorporaUpdateReceiver: pid=700 uid=10006 gids={3003, 1028} 03-20 01:08:36.773: E/Trace(700): error opening trace file: No such file or directory (2) 03-20 01:08:36.903: I/ActivityThread(700): Pub com.android.quicksearchbox.google: com.android.quicksearchbox.google.GoogleSuggestionProvider 03-20 01:08:36.993: I/ActivityThread(700): Pub com.android.quicksearchbox.shortcuts: com.android.quicksearchbox.ShortcutsProvider 03-20 01:08:37.363: I/Choreographer(418): Skipped 126 frames! The application may be doing too much work on its main thread. 03-20 01:08:37.373: E/WVMExtractor(38): Failed to open libwvm.so 03-20 01:08:38.434: I/Launcher(418): setLoadOnResume 03-20 01:08:38.454: I/Launcher(418): setLoadOnResume 03-20 01:08:38.543: E/WVMExtractor(38): Failed to open libwvm.so 03-20 01:08:38.603: E/MetadataRetrieverClient(38): failed to extract an album art 03-20 01:08:39.003: D/dalvikvm(375): GC_CONCURRENT freed 387K, 6% free 8414K/8903K, paused 31ms+5ms, total 110ms 03-20 01:08:39.263: I/ContactsDatabaseHelper(375): Locale change completed in 3621ms 03-20 01:08:39.263: I/ContactsDatabaseHelper(375): Switching to locale en_US 03-20 01:08:39.763: I/ContactsDatabaseHelper(375): Locale change completed in 501ms 03-20 01:08:39.773: I/ContactsProvider(375): Upgrading aggregation algorithm 03-20 01:08:39.803: I/ContactAggregator(375): Marked all visible contacts for aggregation: 0 raw contacts, 21 ms 03-20 01:08:39.833: I/ContactsProvider(375): Aggregation algorithm upgraded for 0 raw contacts in 59ms 03-20 01:08:40.263: I/ContactsFTS(375): Rebuild contact search index in 340ms, 0 contacts 03-20 01:08:40.533: D/dalvikvm(375): GC_CONCURRENT freed 447K, 7% free 8413K/8967K, paused 75ms+104ms, total 241ms 03-20 01:08:41.633: I/ActivityManager(163): START {cmp=com.example.clearlight/.MainActivity u=0} from pid 682 03-20 01:08:41.633: W/WindowManager(163): Failure taking screenshot for (246x410) to layer 21010 03-20 01:08:42.063: I/ActivityManager(163): Displayed com.example.clearlight/.MainActivity: +418ms 03-20 01:08:43.843: D/dalvikvm(163): GC_CONCURRENT freed 281K, 47% free 10128K/18887K, paused 123ms+10ms, total 225ms
I'm getting this error while debugging android OCR app
the log is : (you can see the error at the last few lines)
12-27 16:18:01.050: D/TextLayoutCache(4953): Using debug level: 0 - Debug Enabled: 0
12-27 16:18:01.150: D/memalloc(4953): /dev/pmem: Mapped buffer base:0x5c266000 size:16297984 offset:12529664 fd:62
12-27 16:18:01.650: D/memalloc(4953): /dev/pmem: Mapped buffer base:0x5d2f1000 size:20066304 offset:16297984 fd:65
12-27 16:18:02.150: D/memalloc(4953): /dev/pmem: Mapped buffer base:0x5e614000 size:10739712 offset:6971392 fd:68
12-27 16:18:03.910: V/SimpleAndroidOCR.java(4953): Starting Camera app
12-27 16:18:04.310: D/memalloc(4953): /dev/pmem: Unmapping buffer base:0x5c266000 size:16297984 offset:12529664
12-27 16:18:04.310: D/memalloc(4953): /dev/pmem: Unmapping buffer base:0x5e614000 size:10739712 offset:6971392
12-27 16:18:04.320: D/memalloc(4953): /dev/pmem: Unmapping buffer base:0x5d2f1000 size:20066304 offset:16297984
12-27 16:18:05.230: W/IInputConnectionWrapper(4953): showStatusIcon on inactive InputConnection
12-27 16:18:15.730: I/SimpleAndroidOCR.java(4953): resultCode: -1
12-27 16:18:15.770: D/dalvikvm(4953): GC_FOR_ALLOC freed 67K, 7% free 12729K/13599K, paused 33ms
12-27 16:18:15.770: I/dalvikvm-heap(4953): Grow heap (frag case) to 15.359MB for 3000016-byte allocation
12-27 16:18:15.800: D/dalvikvm(4953): GC_FOR_ALLOC freed 4K, 6% free 15654K/16547K, paused 18ms
12-27 16:18:15.830: D/dalvikvm(4953): GC_CONCURRENT freed <1K, 6% free 15654K/16547K, paused 2ms+2ms
12-27 16:18:16.080: V/SimpleAndroidOCR.java(4953): Orient: 6
12-27 16:18:16.080: V/SimpleAndroidOCR.java(4953): Rotation: 90
12-27 16:18:16.100: D/dalvikvm(4953): GC_FOR_ALLOC freed 37K, 6% free 15629K/16547K, paused 20ms
12-27 16:18:16.110: I/dalvikvm-heap(4953): Grow heap (frag case) to 18.191MB for 3000016-byte allocation
12-27 16:18:16.180: D/dalvikvm(4953): GC_FOR_ALLOC freed <1K, 5% free 18559K/19491K, paused 56ms
12-27 16:18:16.240: D/dalvikvm(4953): GC_CONCURRENT freed 0K, 5% free 18559K/19491K, paused 2ms+2ms
12-27 16:18:16.270: D/dalvikvm(4953): GC_FOR_ALLOC freed 2930K, 20% free 15629K/19491K, paused 13ms
12-27 16:18:16.270: I/dalvikvm-heap(4953): Grow heap (frag case) to 18.191MB for 3000016-byte allocation
12-27 16:18:16.310: D/dalvikvm(4953): GC_FOR_ALLOC freed <1K, 5% free 18558K/19491K, paused 25ms
12-27 16:18:16.330: V/SimpleAndroidOCR.java(4953): Before baseApi
(THE ERROR STARTS HERE)
12-27 16:18:16.330: W/dalvikvm(4953): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/googlecode/tesseract/android/TessBaseAPI;
12-27 16:18:16.330: D/AndroidRuntime(4953): Shutting down VM
12-27 16:18:16.330: W/dalvikvm(4953): threadid=1: thread exiting with uncaught exception (group=0x40ab3210)
12-27 16:18:16.340: E/AndroidRuntime(4953): FATAL EXCEPTION: main
the .java file :
Log.v(TAG, "Before baseApi");
// the error starts from here
TessBaseAPI baseApi = new TessBaseAPI();
baseApi.setDebug(true);
baseApi.init(DATA_PATH, lang);
baseApi.setImage(bitmap);
String recognizedText = baseApi.getUTF8Text();
baseApi.end();
// the next line is not exist in the log
Log.v(TAG, "OCRED TEXT: " + recognizedText);
If you knows what this exception for please advice me .... thank you
The problem was with the ndk-build command before debugging the project,
I rebuild the project successfully and the problem gone, thanks for help