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
Related
i am making login page so i have connected this app with firebase database there is email and password in database so i am trying to
Signinwithemailandpassword but it doesn't work whenever i try to run the apps it crashes
loginpage.java
public class loginpage extends AppCompatActivity {
ActivityLoginpageBinding binding;
Button loginbtn;
TextView login;
FirebaseAuth auth;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityLoginpageBinding.inflate(getLayoutInflater());
setContentView(R.layout.activity_loginpage);
login=findViewById(R.id.login);
auth=FirebaseAuth.getInstance();
loginbtn=findViewById(R.id.loginbtn);
loginbtn.setOnClickListener(new View.OnClickListener() {
final String email=binding.email.getText().toString();
final String password=binding.pwd.getText().toString();
#Override
public void onClick(View view) {
auth.signInWithEmailAndPassword(binding.email.getText().toString(),binding.pwd.getText().toString()).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
#Override
public void onComplete(#NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
Intent intent=new Intent(loginpage.this,MainActivity.class);
startActivity(intent);
Toast.makeText(loginpage.this, "successfull", Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(loginpage.this, "failed", Toast.LENGTH_SHORT).show();
Log.d("MyTag", task.getException().getMessage());
}
}
});
}
});
login.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent=new Intent(loginpage.this,signup.class);
startActivity(intent);
}
});
}
}
loginpage.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
tools:context=".loginpage">
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:text="Instagram"
android:textSize="30dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="242dp"
android:layout_height="235dp"
android:layout_marginTop="32dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView14"
app:srcCompat="#drawable/instagram" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Welcome to social world"
android:textSize="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView3" />
<EditText
android:id="#+id/email"
android:layout_width="297dp"
android:layout_height="49dp"
android:layout_marginTop="44dp"
android:background="#drawable/inputbg"
android:ems="10"
android:hint="Email"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.491"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView16" />
<EditText
android:id="#+id/pwd"
android:layout_width="297dp"
android:layout_height="49dp"
android:layout_marginTop="16dp"
android:background="#drawable/inputbg"
android:ems="10"
android:hint="Password"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.491"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/email"
app:layout_constraintVertical_bias="0.017" />
<Button
android:id="#+id/loginbtn"
android:layout_width="298dp"
android:layout_height="51dp"
android:layout_marginTop="36dp"
android:text="login"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/pwd" />
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't have a account? "
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/login"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/loginbtn"
app:layout_constraintVertical_bias="0.859" />
<TextView
android:id="#+id/login"
android:layout_width="63dp"
android:layout_height="18dp"
android:text="Sign up!"
android:textColor="#F10606"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/textView15"
app:layout_constraintTop_toBottomOf="#+id/loginbtn"
app:layout_constraintVertical_bias="0.86" />
</androidx.constraintlayout.widget.ConstraintLayout>`
Error
12/24 12:13:07: Launching 'app' on Pixel 5 API 26.
App restart successful without requiring a re-install.
$ adb shell am start -n "com.example.instagram/com.example.instagram.signup" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 28962 on device 'Pixel_5_API_26 [emulator-5554]'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/zygote: Late-enabling -Xcheck:jni
W/zygote: Unexpected CPU variant for X86 using defaults: x86
I/FirebaseApp: Device unlocked: initializing all Firebase APIs for app [DEFAULT]
W/zygote: Skipping duplicate class check due to unrecognized classloader
I/DynamiteModule: Considering local module com.google.android.gms.measurement.dynamite:86 and remote module com.google.android.gms.measurement.dynamite:15
I/DynamiteModule: Selected local version of com.google.android.gms.measurement.dynamite
D/FirebaseAuth: Notifying id token listeners about user ( xmoP2dPpYhUD9acalVCdTqBiJ7e2 ).
I/FirebaseInitProvider: FirebaseApp initialization successful
I/zygote: Background concurrent copying GC freed 5896(1215KB) AllocSpace objects, 2(40KB) LOS objects, 62% free, 910KB/2MB, paused 1.368ms total 117.164ms
V/FA: onActivityCreated
V/FA: App measurement collection enabled
V/FA: App measurement enabled for app package, google app id: com.example.instagram, 1:582042892352:android:f97df8209dee5aa33f87a5
I/FA: App measurement initialized, version: 74029
I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app com.example.instagram
D/FA: Debug-level message logging enabled
D/FA: Resetting session stitching token to not null
I/zygote: NativeAllocBackground concurrent copying GC freed 4528(591KB) AllocSpace objects, 7(140KB) LOS objects, 59% free, 1046KB/2MB, paused 3.590ms total 105.851ms
V/FA: Connecting to remote service
V/FA: Detected application was in foreground
V/FA: Session started, time: 37468155
I/zygote: Do partial code cache collection, code=30KB, data=30KB
V/FA: Connection attempt already in progress
I/zygote: After code cache collection, code=24KB, data=28KB
I/zygote: Increasing code cache capacity to 128KB
I/FA: Tag Manager is not found and thus will not be used
I/zygote: Do partial code cache collection, code=24KB, data=46KB
I/zygote: After code cache collection, code=24KB, data=46KB
I/zygote: Increasing code cache capacity to 256KB
I/zygote: JIT allocated 71KB for compiled code of void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int)
I/zygote: Compiler allocated 4MB to compile void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int)
D/OpenGLRenderer: HWUI GL Pipeline
V/FA: Connection attempt already in progress
I/chatty: uid=10097(u0_a97) Measurement Wor identical 1 line
V/FA: Connection attempt already in progress
V/FA: Activity resumed, time: 37468263
V/FA: Connection attempt already in progress
V/FA: Connection attempt already in progress
D/: HostConnection::get() New Host Connection established 0x9f3f98c0, tid 29000
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
D/EGL_emulation: eglCreateContext: 0x9f4d4620: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0x9f4d4620: ver 2 0 (tinfo 0x9f6ff450)
D/EGL_emulation: eglMakeCurrent: 0x9f4d4620: ver 2 0 (tinfo 0x9f6ff450)
I/Choreographer: Skipped 51 frames! The application may be doing too much work on its main thread.
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 7
W/View: dispatchProvideAutofillStructure(): not laid out, ignoring
I/AssistStructure: Flattened final assist data: 3448 bytes, containing 1 windows, 12 views
I/zygote: Do full code cache collection, code=124KB, data=61KB
I/zygote: After code cache collection, code=120KB, data=46KB
V/FA: Inactivity, disconnecting from the service
I/zygote: Do partial code cache collection, code=122KB, data=50KB
I/zygote: After code cache collection, code=122KB, data=50KB
I/zygote: Increasing code cache capacity to 512KB
V/FA: Recording user engagement, ms: 54118
V/FA: onActivityCreated
V/FA: Connecting to remote service
V/FA: Connection attempt already in progress
V/FA: Activity paused, time: 37522383
V/FA: Activity resumed, time: 37522548
V/FA: Connection attempt already in progress
V/FA: Connection attempt already in progress
D/EGL_emulation: eglMakeCurrent: 0x9f4d4620: ver 2 0 (tinfo 0x9f6ff450)
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 4
W/View: dispatchProvideAutofillStructure(): not laid out, ignoring
I/AssistStructure: Flattened final assist data: 2780 bytes, containing 1 windows, 10 views
I/zygote: Do full code cache collection, code=249KB, data=167KB
I/zygote: After code cache collection, code=249KB, data=134KB
V/FA: Inactivity, disconnecting from the service
I/zygote: Do partial code cache collection, code=249KB, data=139KB
I/zygote: After code cache collection, code=249KB, data=139KB
I/zygote: Increasing code cache capacity to 1024KB
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.instagram, PID: 28962
java.lang.IllegalArgumentException: Given String is empty or null
at com.google.android.gms.common.internal.Preconditions.checkNotEmpty(com.google.android.gms:play-services-basement##18.1.0:2)
at com.google.firebase.auth.FirebaseAuth.signInWithEmailAndPassword(com.google.firebase:firebase-auth##21.1.0:1)
at com.example.instagram.loginpage$1.onClick(loginpage.java:44)
at android.view.View.performClick(View.java:6256)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1219)
at android.view.View$PerformClick.run(View.java:24701)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
need to find out the mistake and why app crashes
Where have you set the values for the email and password when you are authenticating with firebase?
In your code, you are doing binding.email.getText().toString() and binding.pwd.getText().toString(). These are potentially empty as I am not seeing you set the value of those views either in your xml or in your code and hence the exception is being thrown.
Just try setting those in your xml or via code and try authentication, it should work.
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 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.
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