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.
Related
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...
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 asked this question a couple of hours ago and I did made some changes in my code as suggested by stack overflow users. However, One more problem started to emerge. The problem is that whenever, I try to go back from the second Screen to the main screen ..The music from second screen doesn't stop.
[ "I am trying to design the app that has 3 buttons on the main screen; when the user presses on the first two buttons it plays the different music located in the raw folder. The third button on the main screen should drive the user to the next screen which also has 2 buttons.
I tried to run my app on the emulator. It plays the music on first two buttons of the main screen, and when I click on the third (Next) button it takes the user to the next screen. However, when I click on 1st or 2nd button of the Second Screen. It says "Unfortunately your app has stopped". I don't now what's wrong with my SecondActivity.Java code .
Any help will be greatly appreciated. Below is my MAIN and Second class JAVA code. I did declare my second Activity in manifest.xml file." ]
Second Activity.Java
import android.app.Activity;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
public class SecondActivity extends Activity implements OnClickListener {
private MediaPlayer mp;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
findViewById(R.id.button_4).setOnClickListener(this);
findViewById(R.id.button_5).setOnClickListener(this);
}
public void onClick(View v) {
int resId = 1;
switch (v.getId()) {
case R.id.button_4: resId = R.raw.button_4; break;
case R.id.button_5: resId = R.raw.button_5; break;
}
// Release any resources from previous MediaPlayer
if (mp != null) {
mp.release();
}
// Create a new MediaPlayer to play this sound
mp = MediaPlayer.create(this, resId);
mp.start();
}
}
Logcat errors..
07-21 18:06:14.898: E/BinaryDictionaryGetter(157): Could not find a dictionary pack
07-21 18:06:22.518: E/SoundPool(89): error loading /system/media/audio/ui/Effect_Tick.ogg
07-21 18:06:22.518: E/SoundPool(89): error loading /system/media/audio/ui/Effect_Tick.ogg
07-21 18:06:22.518: E/SoundPool(89): error loading /system/media/audio/ui/Effect_Tick.ogg
07-21 18:06:22.518: E/SoundPool(89): error loading /system/media/audio/ui/Effect_Tick.ogg
07-21 18:06:22.518: E/SoundPool(89): error loading /system/media/audio/ui/Effect_Tick.ogg
07-21 18:06:22.698: E/SoundPool(89): error loading /system/media/audio/ui/KeypressStandard.ogg
07-21 18:06:22.698: E/SoundPool(89): error loading /system/media/audio/ui/KeypressSpacebar.ogg
07-21 18:06:22.698: E/SoundPool(89): error loading /system/media/audio/ui/KeypressDelete.ogg
07-21 18:06:22.698: E/SoundPool(89): error loading /system/media/audio/ui/KeypressReturn.ogg
07-21 18:06:42.096: E/SurfaceTexture(35): [<pid_66>] dequeueBuffer: SurfaceTexture has been abandoned!
07-21 18:06:47.276: E/ActivityManager(89): ANR in com.android.settings
07-21 18:06:47.276: E/ActivityManager(89): Reason: Broadcast of Intent { act=android.location.PROVIDERS_CHANGED flg=0x10 cmp=com.android.settings/.widget.SettingsAppWidgetProvider }
07-21 18:06:47.276: E/ActivityManager(89): Load: 6.43 / 1.85 / 0.64
07-21 18:06:47.276: E/ActivityManager(89): CPU usage from 47ms to 23826ms later:
07-21 18:06:47.276: E/ActivityManager(89): 30% 35/surfaceflinger: 27% user + 2.6% kernel / faults: 1542 minor
07-21 18:06:47.276: E/ActivityManager(89): 21% 89/system_server: 15% user + 5.2% kernel / faults: 2206 minor 1 major
07-21 18:06:47.276: E/ActivityManager(89): 16% 44/adbd: 2% user + 14% kernel / faults: 32 minor
07-21 18:06:47.276: E/ActivityManager(89): 7.2% 143/com.android.systemui: 5.4% user + 1.7% kernel / faults: 3963 minor 3 major
07-21 18:06:47.276: E/ActivityManager(89): 7.1% 191/com.android.launcher: 6.3% user + 0.8% kernel / faults: 834 minor 2 major
07-21 18:06:47.276: E/ActivityManager(89): 4.6% 176/zygote: 3.4% user + 1.2% kernel / faults: 610 minor 2 major
07-21 18:06:47.276: E/ActivityManager(89): 4.4% 231/android.process.acore: 3.5% user + 0.9% kernel / faults: 2025 minor 1 major
07-21 18:06:47.276: E/ActivityManager(89): 0.3% 212/com.android.settings: 0% user + 0.2% kernel / faults: 377 minor
07-21 18:06:47.276: E/ActivityManager(89): 0.1% 37/mediaserver: 0% user + 0% kernel / faults: 6 minor
07-21 18:06:47.276: E/ActivityManager(89): 0.1% 29/servicemanager: 0% user + 0.1% kernel
07-21 18:06:47.276: E/ActivityManager(89): 0% 34/rild: 0% user + 0% kernel / faults: 2 minor
07-21 18:06:47.276: E/ActivityManager(89): +0% 257/sh: 0% user + 0% kernel
07-21 18:06:47.276: E/ActivityManager(89): +0% 260/logcat: 0% user + 0% kernel
07-21 18:06:47.276: E/ActivityManager(89): 100% TOTAL: 70% user + 27% kernel + 0.2% irq + 1.9% softirq
07-21 18:06:47.276: E/ActivityManager(89): CPU usage from 21060ms to 22770ms later:
07-21 18:06:47.276: E/ActivityManager(89): 36% 89/system_server: 22% user + 13% kernel / faults: 236 minor
07-21 18:06:47.276: E/ActivityManager(89): 8.8% 104/ActivityManager: 3.6% user + 5.1% kernel
07-21 18:06:47.276: E/ActivityManager(89): 8% 255/Error dump: sys: 5.8% user + 2.2% kernel
07-21 18:06:47.276: E/ActivityManager(89): 6.6% 96/Compiler: 5.1% user + 1.4% kernel
07-21 18:06:47.276: E/ActivityManager(89): 2.2% 118/WindowManagerPo: 2.2% user + 0% kernel
07-21 18:06:47.276: E/ActivityManager(89): 1.4% 265/Binder Thread #: 0.7% user + 0.7% kernel
07-21 18:06:47.276: E/ActivityManager(89): 0.7% 264/Binder Thread #: 0% user + 0.7% kernel
07-21 18:06:47.276: E/ActivityManager(89): 29% 35/surfaceflinger: 26% user + 3.5% kernel / faults: 383 minor
07-21 18:06:47.276: E/ActivityManager(89): 26% 63/SurfaceFlinger: 23% user + 3.5% kernel
07-21 18:06:47.276: E/ActivityManager(89): 0.7% 254/Binder Thread #: 0% user + 0.7% kernel
07-21 18:06:47.276: E/ActivityManager(89): 25% 44/adbd: 2.2% user + 23% kernel
07-21 18:06:47.276: E/ActivityManager(89): 9.1% 44/adbd: 0% user + 9.1% kernel
07-21 18:06:47.276: E/ActivityManager(89): 9.1% 79/adbd: 3.8% user + 5.3% kernel
07-21 18:06:47.276: E/ActivityManager(89): 9.1% 249/adbd: 0% user + 9.1% kernel
07-21 18:06:47.276: E/ActivityManager(89): 8.3% 78/adbd: 0% user + 8.3% kernel
07-21 18:06:47.276: E/ActivityManager(89): 9.5% 143/com.android.systemui: 3.9% user + 5.5% kernel / faults: 403 minor
07-21 18:06:47.276: E/ActivityManager(89): 7.9% 143/ndroid.systemui: 3.1% user + 4.7% kernel
07-21 18:06:47.276: E/ActivityManager(89): 1.5% 150/Compiler: 1.5% user + 0% kernel
07-21 18:06:47.276: E/ActivityManager(89): 2.6% 191/com.android.launcher: 1.7% user + 0.8% kernel / faults: 47 minor
07-21 18:06:47.276: E/ActivityManager(89): 2.6% 191/ndroid.launcher: 1.7% user + 0.8% kernel
07-21 18:06:47.276: E/ActivityManager(89): 0.8% 203/Compiler: 0.8% user + 0% kernel
07-21 18:06:47.276: E/ActivityManager(89): 0.8% 229/launcher-loader: 0.8% user + 0% kernel
07-21 18:06:47.276: E/ActivityManager(89): 0.8% 212/com.android.settings: 0.8% user + 0% kernel / faults: 3 minor
07-21 18:06:47.276: E/ActivityManager(89): 100% TOTAL: 56% user + 41% kernel + 1.7% softirq
07-21 18:07:00.696: A/NetworkStats(89): problem reading network stats
07-21 18:07:00.696: A/NetworkStats(89): java.lang.IllegalStateException: problem parsing line: null
07-21 18:07:00.696: A/NetworkStats(89): at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:313)
07-21 18:07:00.696: A/NetworkStats(89): at com.android.server.NetworkManagementService.getNetworkStatsUidDetail(NetworkManagementService.java:1271)
07-21 18:07:00.696: A/NetworkStats(89): at com.android.server.net.NetworkStatsService.performPollLocked(NetworkStatsService.java:810)
07-21 18:07:00.696: A/NetworkStats(89): at com.android.server.net.NetworkStatsService.updateIfacesLocked(NetworkStatsService.java:721)
07-21 18:07:00.696: A/NetworkStats(89): at com.android.server.net.NetworkStatsService.updateIfaces(NetworkStatsService.java:699)
07-21 18:07:00.696: A/NetworkStats(89): at com.android.server.net.NetworkStatsService.access$000(NetworkStatsService.java:128)
07-21 18:07:00.696: A/NetworkStats(89): at com.android.server.net.NetworkStatsService$8.handleMessage(NetworkStatsService.java:1546)
07-21 18:07:00.696: A/NetworkStats(89): at android.os.Handler.dispatchMessage(Handler.java:95)
07-21 18:07:00.696: A/NetworkStats(89): at android.os.Looper.loop(Looper.java:137)
07-21 18:07:00.696: A/NetworkStats(89): at android.os.HandlerThread.run(HandlerThread.java:60)
07-21 18:07:00.696: A/NetworkStats(89): Caused by: java.io.FileNotFoundException: /proc/net/xt_qtaguid/stats: open failed: ENOENT (No such file or directory)
07-21 18:07:00.696: A/NetworkStats(89): at libcore.io.IoBridge.open(IoBridge.java:406)
07-21 18:07:00.696: A/NetworkStats(89): at java.io.FileInputStream.<init>(FileInputStream.java:78)
07-21 18:07:00.696: A/NetworkStats(89): at java.io.FileReader.<init>(FileReader.java:42)
07-21 18:07:00.696: A/NetworkStats(89): at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:272)
07-21 18:07:00.696: A/NetworkStats(89): ... 9 more
07-21 18:07:00.696: A/NetworkStats(89): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
07-21 18:07:00.696: A/NetworkStats(89): at libcore.io.Posix.open(Native Method)
07-21 18:07:00.696: A/NetworkStats(89): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:98)
07-21 18:07:00.696: A/NetworkStats(89): at libcore.io.IoBridge.open(IoBridge.java:390)
07-21 18:07:00.696: A/NetworkStats(89): ... 12 more
07-21 18:07:14.576: E/ActivityManager(89): Start proc android.process.media for content provider com.android.providers.downloads/.DownloadProvider: pid=317 uid=10008 gids={1015, 1023, 1024, 1006, 2001, 3003, 3007}Load: 8.1 / 2.6 / 0.92
07-21 18:07:14.576: E/ActivityManager(89): CPU usage from 574ms to -15561ms ago:
07-21 18:07:14.576: E/ActivityManager(89): 34% 44/adbd: 6.1% user + 28% kernel
07-21 18:07:14.576: E/ActivityManager(89): 28% 89/system_server: 21% user + 7.6% kernel / faults: 1350 minor
07-21 18:07:14.576: E/ActivityManager(89): 7.8% 272/com.android.contacts: 5.2% user + 2.6% kernel / faults: 3192 minor 16 major
07-21 18:07:14.576: E/ActivityManager(89): 7.1% 176/zygote: 5.2% user + 1.9% kernel / faults: 674 minor
07-21 18:07:14.576: E/ActivityManager(89): 4.3% 231/android.process.acore: 3.8% user + 0.4% kernel / faults: 213 minor
07-21 18:07:14.576: E/ActivityManager(89): 3% 36/zygote: 2.6% user + 0.3% kernel / faults: 349 minor
07-21 18:07:14.576: E/ActivityManager(89): 0.9% 143/com.android.systemui: 0.7% user + 0.1% kernel / faults: 70 minor
07-21 18:07:14.576: E/ActivityManager(89): 0.4% 157/com.android.inputmethod.latin: 0.3% user + 0% kernel / faults: 373 minor
07-21 18:07:14.576: E/ActivityManager(89): 0.1% 260/logcat: 0% user + 0.1% kernel
07-21 18:07:14.576: E/ActivityManager(89): 0.1% 29/servicemanager: 0% user + 0.1% kernel
07-21 18:07:14.576: E/ActivityManager(89): 0.1% 34/rild: 0% user + 0.1% kernel
07-21 18:07:14.576: E/ActivityManager(89): 0% 1//init: 0% user + 0% kernel
07-21 18:07:14.576: E/ActivityManager(89): 0% 35/surfaceflinger: 0% user + 0% kernel / faults: 9 minor
07-21 18:07:14.576: E/ActivityManager(89): +0% 304/com.android.providers.calendar: 0% user + 0% kernel
07-21 18:07:14.576: E/ActivityManager(89): +0% 317/android.process.media: 0% user + 0% kernel
07-21 18:07:14.576: E/ActivityManager(89): 100% TOTAL: 53% user + 41% kernel + 0.5% irq + 4.6% softirq
07-21 18:07:14.576: E/ActivityManager(89): CPU usage from 12740ms to 14418ms later with 102% awake:
07-21 18:07:14.576: E/ActivityManager(89): 38% 44/adbd: 10% user + 28% kernel
07-21 18:07:14.576: E/ActivityManager(89): 11% 44/adbd: 3.7% user + 8.1% kernel
07-21 18:07:14.576: E/ActivityManager(89): 11% 78/adbd: 4.3% user + 6.8% kernel
07-21 18:07:14.576: E/ActivityManager(89): 11% 79/adbd: 4.3% user + 6.8% kernel
07-21 18:07:14.576: E/ActivityManager(89): 11% 249/adbd: 0% user + 11% kernel
07-21 18:07:14.576: E/ActivityManager(89): 32% 89/system_server: 26% user + 6.1% kernel / faults: 40 minor
07-21 18:07:14.576: E/ActivityManager(89): 12% 104/ActivityManager: 8.5% user + 3.6% kernel
07-21 18:07:14.576: E/ActivityManager(89): 12% 287/Binder Thread #: 12% user + 0% kernel
07-21 18:07:14.576: E/ActivityManager(89): 3% 91/GC: 1.8% user + 1.2% kernel
07-21 18:07:14.576: E/ActivityManager(89): 0.6% 96/Compiler: 0.6% user + 0% kernel
07-21 18:07:14.576: E/ActivityManager(89): 0.6% 102/SensorService: 0% user + 0.6% kernel
07-21 18:07:14.576: E/ActivityManager(89): 0.6% 121/er$SensorThread: 0.6% user + 0% kernel
07-21 18:07:14.576: E/ActivityManager(89): 0.6% 264/Binder Thread #: 0.6% user + 0% kernel
07-21 18:07:14.576: E/ActivityManager(89): 13% 36/zygote: 13% user + 0% kernel / faults: 47 minor
07-21 18:07:14.576: E/ActivityManager(89): 10% 36/zygote: 10% user + 0% kernel
07-21 18:07:14.576: E/ActivityManager(89): 8.5% 304/com.android.providers.calendar: 6.2% user + 2.3% kernel / faults: 103 minor
07-21 18:07:14.576: E/ActivityManager(89): 6.2% 304/viders.calendar: 4.6% user + 1.5% kernel
07-21 18:07:14.576: E/ActivityManager(89): 3.1% 311/Compiler: 1.5% user + 1.5% kernel
07-21 18:07:14.576: E/ActivityManager(89): 0.7% 231/android.process.acore: 0% user + 0.7% kernel / faults: 2 minor
07-21 18:07:14.576: E/ActivityManager(89): 0.7% 285/ContactsProvide: 0.7% user + 0% kernel
07-21 18:07:14.576: E/ActivityManager(89): 0.7% 317/<pre-initialized>: 0.7% user + 0% kernel / faults: 33 minor
07-21 18:07:14.576: E/ActivityManager(89): 100% TOTAL: 60% user + 34% kernel + 4.9% softirq
07-21 18:07:16.376: E/DefaultVoicemailNotifier(272): No voicemails to notify about: clear the notification.
07-21 18:07:23.277: A/NetworkStats(89): problem reading network stats
07-21 18:07:23.277: A/NetworkStats(89): java.lang.IllegalStateException: problem parsing line: null
07-21 18:07:23.277: A/NetworkStats(89): at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:313)
07-21 18:07:23.277: A/NetworkStats(89): at com.android.server.NetworkManagementService.getNetworkStatsUidDetail(NetworkManagementService.java:1271)
07-21 18:07:23.277: A/NetworkStats(89): at com.android.server.net.NetworkStatsService.performPollLocked(NetworkStatsService.java:810)
07-21 18:07:23.277: A/NetworkStats(89): at com.android.server.net.NetworkStatsService.updateIfacesLocked(NetworkStatsService.java:721)
07-21 18:07:23.277: A/NetworkStats(89): at com.android.server.net.NetworkStatsService.updateIfaces(NetworkStatsService.java:699)
07-21 18:07:23.277: A/NetworkStats(89): at com.android.server.net.NetworkStatsService.access$000(NetworkStatsService.java:128)
07-21 18:07:23.277: A/NetworkStats(89): at com.android.server.net.NetworkStatsService$1.onReceive(NetworkStatsService.java:589)
07-21 18:07:23.277: A/NetworkStats(89): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:728)
07-21 18:07:23.277: A/NetworkStats(89): at android.os.Handler.handleCallback(Handler.java:605)
07-21 18:07:23.277: A/NetworkStats(89): at android.os.Handler.dispatchMessage(Handler.java:92)
07-21 18:07:23.277: A/NetworkStats(89): at android.os.Looper.loop(Looper.java:137)
07-21 18:07:23.277: A/NetworkStats(89): at android.os.HandlerThread.run(HandlerThread.java:60)
07-21 18:07:23.277: A/NetworkStats(89): Caused by: java.io.FileNotFoundException: /proc/net/xt_qtaguid/stats: open failed: ENOENT (No such file or directory)
07-21 18:07:23.277: A/NetworkStats(89): at libcore.io.IoBridge.open(IoBridge.java:406)
07-21 18:07:23.277: A/NetworkStats(89): at java.io.FileInputStream.<init>(FileInputStream.java:78)
07-21 18:07:23.277: A/NetworkStats(89): at java.io.FileReader.<init>(FileReader.java:42)
07-21 18:07:23.277: A/NetworkStats(89): at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:272)
07-21 18:07:23.277: A/NetworkStats(89): ... 11 more
07-21 18:07:23.277: A/NetworkStats(89): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
07-21 18:07:23.277: A/NetworkStats(89): at libcore.io.Posix.open(Native Method)
07-21 18:07:23.277: A/NetworkStats(89): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:98)
07-21 18:07:23.277: A/NetworkStats(89): at libcore.io.IoBridge.open(IoBridge.java:390)
07-21 18:07:23.277: A/NetworkStats(89): ... 14 more
07-21 18:07:28.996: E/ActivityThread(358): Failed to find provider info for com.android.inputmethod.latin.dictionarypack
07-21 18:07:29.116: E/BinaryDictionaryGetter(358): Could not find a dictionary pack
07-21 18:07:49.386: E/ActivityManager(89): Start proc com.android.defcontainer for service com.android.defcontainer/.DefaultContainerService: pid=476 uid=10025 gids={1015, 2001}Load: 12.23 / 4.22 / 1.52
07-21 18:07:49.386: E/ActivityManager(89): CPU usage from 1ms to 6936ms later:
07-21 18:07:49.386: E/ActivityManager(89): 32% 89/system_server: 20% user + 11% kernel / faults: 528 minor 1 major
07-21 18:07:49.386: E/ActivityManager(89): 20% 348/procrank: 7.2% user + 13% kernel / faults: 17 minor
07-21 18:07:49.386: E/ActivityManager(89): 19% 445/app_process: 16% user + 2.4% kernel / faults: 1896 minor 1 major
07-21 18:07:49.386: E/ActivityManager(89): 2% 402/com.android.email: 1.4% user + 0.5% kernel / faults: 50 minor
07-21 18:07:49.386: E/ActivityManager(89): 1.2% 44/adbd: 0% user + 1.2% kernel / faults: 1 minor
07-21 18:07:49.386: E/ActivityManager(89): 1.2% 143/com.android.systemui: 0.8% user + 0.4% kernel / faults: 33 minor
07-21 18:07:49.386: E/ActivityManager(89): 1.1% 176/zygote: 0.4% user + 0.7% kernel / faults: 64 minor
07-21 18:07:49.386: E/ActivityManager(89): 0.7% 36/zygote: 0.1% user + 0.5% kernel / faults: 150 minor
07-21 18:07:49.386: E/ActivityManager(89): 0.7% 317/android.process.media: 0.4% user + 0.2% kernel / faults: 56 minor
07-21 18:07:49.386: E/ActivityManager(89): 0.1% 260/logcat: 0% user + 0.1% kernel
07-21 18:07:49.386: E/ActivityManager(89): 0.1% 304/com.android.providers.calendar: 0.1% user + 0% kernel / faults: 14 minor
07-21 18:07:49.386: E/ActivityManager(89): 0% 35/surfaceflinger: 0% user + 0% kernel
07-21 18:07:49.386: E/ActivityManager(89): 0% 231/android.process.acore: 0% user + 0% kernel / faults: 11 minor
07-21 18:07:49.386: E/ActivityManager(89): 0% 334/com.android.deskclock: 0% user + 0% kernel / faults: 50 minor
07-21 18:07:49.386: E/ActivityManager(89): 0% 374/com.android.mms: 0% user + 0% kernel / faults: 4 minor
07-21 18:07:49.386: E/ActivityManager(89): 0.1% 425/com.android.exchange: 0.1% user + 0% kernel / faults: 12 minor
07-21 18:07:49.386: E/ActivityManager(89): +0% 461/com.android.settings: 0% user + 0% kernel
07-21 18:07:49.386: E/ActivityManager(89): +0% 476/com.android.defcontainer: 0% user + 0% kernel
07-21 18:07:49.386: E/ActivityManager(89): 0.-1% 272/com.android.contacts: 0.-1% user + 0% kernel
07-21 18:07:49.386: E/ActivityManager(89): 100% TOTAL: 60% user + 39% kernel + 0.1% softirq
07-21 18:07:49.386: E/ActivityManager(89): CPU usage from 5260ms to 6361ms later:
07-21 18:07:49.386: E/ActivityManager(89): 23% 461/com.android.settings: 7.2% user + 16% kernel / faults: 1888 minor
07-21 18:07:49.386: E/ActivityManager(89): 19% 461/ndroid.settings: 5.2% user + 14% kernel
07-21 18:07:49.386: E/ActivityManager(89): 21% 89/system_server: 8.6% user + 12% kernel / faults: 11 minor
07-21 18:07:49.386: E/ActivityManager(89): 20% 114/ScreenOffThread: 0% user + 20% kernel
07-21 18:07:49.386: E/ActivityManager(89): 13% 104/ActivityManager: 8.6% user + 4.8% kernel
07-21 18:07:49.386: E/ActivityManager(89): 0.9% 89/system_server: 0.9% user + 0% kernel
07-21 18:07:49.386: E/ActivityManager(89): 0.9% 96/Compiler: 0% user + 0.9% kernel
07-21 18:07:49.386: E/ActivityManager(89): 21% 348/procrank: 7.2% user + 14% kernel / faults: 2 minor
07-21 18:07:49.386: E/ActivityManager(89): 11% 445/app_process: 11% user + 0% kernel / faults: 126 minor
07-21 18:07:49.386: E/ActivityManager(89): 10% 445/app_process: 10% user + 0% kernel
07-21 18:07:49.386: E/ActivityManager(89): 3.1% 457/Compiler: 3.1% user + 0% kernel
07-21 18:07:49.386: E/ActivityManager(89): +0% 474/Binder Thread #: 0% user + 0% kernel
07-21 18:07:49.386: E/ActivityManager(89): +0% 475/Binder Thread #: 0% user + 0% kernel
07-21 18:07:49.386: E/ActivityManager(89): 4.3% 143/com.android.systemui: 4.3% user + 0% kernel / faults: 9 minor
07-21 18:07:49.386: E/ActivityManager(89): 3.2% 143/ndroid.systemui: 3.2% user + 0% kernel
07-21 18:07:49.386: E/ActivityManager(89): 0.9% 44/adbd: 0% user + 0.9% kernel
07-21 18:07:49.386: E/ActivityManager(89): 0.9% 44/adbd: 0% user + 0.9% kernel
07-21 18:07:49.386: E/ActivityManager(89): 1.1% 176/com.android.phone: 0% user + 1.1% kernel / faults: 12 minor
07-21 18:07:49.386: E/ActivityManager(89): 0.3% 304/com.android.providers.calendar: 0.3% user + 0% kernel / faults: 8 minor
07-21 18:07:49.386: E/ActivityManager(89): 0.3% 311/Compiler: 0% user + 0.3% kernel
07-21 18:07:49.386: E/ActivityManager(89): 100% TOTAL: 57% user + 42% kernel
: E/(): Device disconnected
At this stage, you should know something about activity lifecycle:
when you want to leave an activity, and in this case you want to stop music, you must implement onPause() method. Its when your activity is about to go off of your UI, and you want to stop all sounds playing, you should put something in your ALL activities with mediaPlayer like this:
#Override
public void onPause() {
super.onPause(); // Always call the superclass method first
// Release any resources from previous MediaPlayer
if (mp != null) {
mp.release();
}
}
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'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