Android Search Interface Tutorial - android

I did the first part of this tutorial...
http://developer.android.com/training/search/setup.html
I made the options_menu.xml and added the code to the onCreateOptionsMenu() method. After I run my app on my device it turns on and automatically crashes. Sorry I don't know if I formatted the LogCat message below properly but I copy / pasted into here so it may help determine what the problem is, I'm not sure how to read it or fix the issue. Let me know if I can format it more properly or maybe export other error messages if needed. Under "Problems" I have two...
the import android.os Build is never used
The import android.support.v7.app.ActionBar is never used
not sure if thats important...Thanks!
03-30 19:13:06.266: W/ApplicationPackageManager(17378): getCSCPackageItemText()
03-30 19:13:06.326: E/MoreInfoHPW_ViewGroup(17378): Parent view is not a TextView
03-30 19:13:06.436: I/Adreno-EGL(17378): <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: ()
03-30 19:13:06.436: I/Adreno-EGL(17378): OpenGL ES Shader Compiler Version: E031.24.00.07
03-30 19:13:06.436: I/Adreno-EGL(17378): Build Date: 01/22/14 Wed
03-30 19:13:06.436: I/Adreno-EGL(17378): Local Branch: base_au149_adreno_au169_patches
03-30 19:13:06.436: I/Adreno-EGL(17378): Remote Branch:
03-30 19:13:06.436: I/Adreno-EGL(17378): Local Patches:
03-30 19:13:06.436: I/Adreno-EGL(17378): Reconstruct Branch:
03-30 19:13:06.466: D/OpenGLRenderer(17378): Enabling debug mode 0
03-30 19:13:06.496: W/ResourceType(17378): getEntry failing because entryIndex 1 is beyond type entryCount 1
03-30 19:13:06.496: W/ResourceType(17378): Failure getting entry for 0x7f0c0001 (t=11 e=1) in package 0 (error -2147483647)
03-30 19:13:06.496: D/AndroidRuntime(17378): Shutting down VM
03-30 19:13:06.496: W/dalvikvm(17378): threadid=1: thread exiting with uncaught exception (group=0x417adda0)
03-30 19:13:06.506: E/AndroidRuntime(17378): FATAL EXCEPTION: main
03-30 19:13:06.506: E/AndroidRuntime(17378): Process: com.example.csbizsearch, PID: 17378
03-30 19:13:06.506: E/AndroidRuntime(17378): android.content.res.Resources$NotFoundException: Resource ID #0x7f0c0001
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.content.res.Resources.getValue(Resources.java:2009)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.content.res.Resources.loadXmlResourceParser(Resources.java:3224)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.content.res.Resources.getLayout(Resources.java:1825)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.support.v7.internal.view.SupportMenuInflater.inflate(SupportMenuInflater.java:115)
03-30 19:13:06.506: E/AndroidRuntime(17378): at com.example.csbizsearch.MainActivity.onCreateOptionsMenu(MainActivity.java:30)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.app.Activity.onCreatePanelMenu(Activity.java:2588)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.support.v4.app.FragmentActivity.onCreatePanelMenu(FragmentActivity.java:224)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.support.v7.app.ActionBarActivity.superOnCreatePanelMenu(ActionBarActivity.java:232)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.support.v7.app.ActionBarActivityDelegateICS.onCreatePanelMenu(ActionBarActivityDelegateICS.java:146)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.support.v7.app.ActionBarActivity.onCreatePanelMenu(ActionBarActivity.java:199)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.support.v7.app.ActionBarActivityDelegateICS$WindowCallbackWrapper.onCreatePanelMenu(ActionBarActivityDelegateICS.java:293)
03-30 19:13:06.506: E/AndroidRuntime(17378): at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:486)
03-30 19:13:06.506: E/AndroidRuntime(17378): at com.android.internal.policy.impl.PhoneWindow.doInvalidatePanelMenu(PhoneWindow.java:855)
03-30 19:13:06.506: E/AndroidRuntime(17378): at com.android.internal.policy.impl.PhoneWindow$1.run(PhoneWindow.java:271)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.view.Choreographer.doCallbacks(Choreographer.java:603)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.view.Choreographer.doFrame(Choreographer.java:572)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.os.Handler.handleCallback(Handler.java:733)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.os.Handler.dispatchMessage(Handler.java:95)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.os.Looper.loop(Looper.java:157)
03-30 19:13:06.506: E/AndroidRuntime(17378): at android.app.ActivityThread.main(ActivityThread.java:5293)
03-30 19:13:06.506: E/AndroidRuntime(17378): at java.lang.reflect.Method.invokeNative(Native Method)
03-30 19:13:06.506: E/AndroidRuntime(17378): at java.lang.reflect.Method.invoke(Method.java:515)
03-30 19:13:06.506: E/AndroidRuntime(17378): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
03-30 19:13:06.506: E/AndroidRuntime(17378): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
03-30 19:13:06.506: E/AndroidRuntime(17378): at dalvik.system.NativeStart.main(Native Method)
03-30 19:13:09.836: I/Process(17378): Sending signal. PID: 17378 SIG: 9

I've havent got this error in Android Studio so I will continue to use this instead of eclipse...If anyone finds the a solution to this that would be great though!!

Related

AVD crashes saying 'Unfortunately, libcocos2dx has crashed'

I just loaded my app created by cocos2dx-3.10 and when I open with it an AVD (again I haven't done any modifications to the app) the app crashes and gives the error: Unfortunately, libcocos2dx has crashed.
here is what I get in my android Monitor:
03-05 18:34:56.668 1435-1435/? D/dalvikvm: Not late-enabling CheckJNI (already on)
03-05 18:34:56.989 1435-1435/com.trying.name E/Trace: error opening trace file: No such file or directory (2)
03-05 18:34:57.419 1435-1435/com.trying.name D/AndroidRuntime: Shutting down VM
03-05 18:34:57.419 1435-1435/com.trying.name W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xb2f2b288)
03-05 18:34:57.518 1435-1435/com.trying.name E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.UnsatisfiedLinkError: Couldn't load cocos2dcpp: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:365)
at java.lang.System.loadLibrary(System.java:535)
at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:248)
at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:263)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
03-05 18:35:11.559 1435-1435/? I/Process: Sending signal. PID: 1435 SIG: 9

Android Google Analytics compile error "Could not find class"

I have called:
compile 'com.google.android.gms:play-services-analytics:7.5.0'
When I run project I get an error:
Log cat :
06-26 15:39:17.563 2415-2415/com.demo E/dalvikvm﹕ Could not find class 'com.demo.utils.logger.ChainedLogNode', referenced from
method com.demo.utils.logger.Logger.initialize.
When I remove compile 'com.google.android.gms:play-services-analytics:7.5.0', it runs ok.
Stop app :
6-26 15:39:17.579 2415-2415/com.demo.app E/AndroidRuntime﹕ FATAL
EXCEPTION: main
java.lang.NoClassDefFoundError: com.demo.utils.logger.ChainedLogNode
at com.demo.utils.logger.Logger.initialize(Logger.java:150)
at com.demo.utils.CommonUtil.setupLoggers(CommonUtil.java:3215)
at com.demo.DemoApplication.onCreate(DemoApplication.java:103)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:999)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4151)
at android.app.ActivityThread.access$1300(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)

Android Application running perfectly in device but crashing in emulator

I have developed an android application. This application runs perfectly in my device but crashes in emulator.
Since in my college we have to present the application in emulator, this error is creating a lot of problem.
Logcat
03-30 10:52:52.633: E/AndroidRuntime(257): Uncaught handler: thread main exiting due to uncaught exception
03-30 10:52:52.653: E/AndroidRuntime(257): java.lang.NoSuchMethodError: com.example.festipedia_logo.main.getActionBar
03-30 10:52:52.653: E/AndroidRuntime(257): at com.example.festipedia_logo.main.onCreate(main.java:51)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.os.Handler.dispatchMessage(Handler.java:99)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.os.Looper.loop(Looper.java:123)
03-30 10:52:52.653: E/AndroidRuntime(257): at android.app.ActivityThread.main(ActivityThread.java:4363)
03-30 10:52:52.653: E/AndroidRuntime(257): at java.lang.reflect.Method.invokeNative(Native Method)
03-30 10:52:52.653: E/AndroidRuntime(257): at java.lang.reflect.Method.invoke(Method.java:521)
03-30 10:52:52.653: E/AndroidRuntime(257): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-30 10:52:52.653: E/AndroidRuntime(257): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-30 10:52:52.653: E/AndroidRuntime(257): at dalvik.system.NativeStart.main(Native Method)
03-30 10:52:52.693: E/dalvikvm(257): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
It is because your emaluator is not supporting action bar. Try either of these
1 - use action bar sherlock instead of action bar. Google it for its implementation.
2 - try increasing the android version of emaluator to ICS or more.
I recommend using action bar sherlock
From official documentation, try following it and see if the error is gone.
The ActionBar APIs were first added in Android 3.0 (API level 11) but
they are also available in the Support Library for compatibility with
Android 2.1 (API level 7) and above.
This guide focuses on how to use the support library's action bar, but
if your app supports only Android 3.0 or higher, you should use the
ActionBar APIs in the framework. Most of the APIs are the same—but
reside in a different package namespace—with a few exceptions to
method names or signatures that are noted in the sections below.
Caution: Be certain you import the ActionBar class (and related APIs)
from the appropriate package:
If supporting API levels lower than 11:
import android.support.v7.app.ActionBar
If supporting only API level 11 and higher:
import android.app.ActionBar
More At: http://developer.android.com/guide/topics/ui/actionbar.html
You can also check http://actionbarsherlock.com/
Just tell your emulator to support the same API level as your device and the problem should magically vanish. It's a configuration setting in the emulator.

Error scaning QR codes with zxing for android

I'm trying to do something similar to this post. But when I try it it throws a fatal exception.
03-06 16:48:23.421: W/dalvikvm(2300): VFY: unable to resolve exception class 748 (Lcom/google/zxing/ChecksumException;)
03-06 16:48:23.421: W/dalvikvm(2300): VFY: unable to find exception handler at addr 0xc
03-06 16:48:23.421: W/dalvikvm(2300): VFY: rejected Lcom/example/pfc/MainActivity;.onCameraFrame (Lorg/opencv/android/CameraBridgeViewBase$CvCameraViewFrame;)Lorg/opencv/core/Mat;
03-06 16:48:23.421: W/dalvikvm(2300): VFY: rejecting opcode 0x0d at 0x000c
03-06 16:48:23.421: W/dalvikvm(2300): VFY: rejected Lcom/example/pfc/MainActivity;.onCameraFrame (Lorg/opencv/android/CameraBridgeViewBase$CvCameraViewFrame;)Lorg/opencv/core/Mat;
03-06 16:48:23.421: W/dalvikvm(2300): Verifier rejected class Lcom/example/pfc/MainActivity;
03-06 16:48:23.421: W/dalvikvm(2300): Class init failed in newInstance call (Lcom/example/pfc/MainActivity;)
03-06 16:48:23.421: W/dalvikvm(2300): threadid=1: thread exiting with uncaught exception (group=0x416efd40)
03-06 16:48:23.424: E/AndroidRuntime(2300): FATAL EXCEPTION: main
03-06 16:48:23.424: E/AndroidRuntime(2300): Process: com.example.pfc, PID: 2300
03-06 16:48:23.424: E/AndroidRuntime(2300): java.lang.VerifyError: com/example/pfc/MainActivity
03-06 16:48:23.424: E/AndroidRuntime(2300): at java.lang.Class.newInstanceImpl(Native Method)
03-06 16:48:23.424: E/AndroidRuntime(2300): at java.lang.Class.newInstance(Class.java:1208)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.app.Instrumentation.newActivity(Instrumentation.java:1084)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2126)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.app.ActivityThread.access$800(ActivityThread.java:139)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.os.Handler.dispatchMessage(Handler.java:102)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.os.Looper.loop(Looper.java:136)
03-06 16:48:23.424: E/AndroidRuntime(2300): at android.app.ActivityThread.main(ActivityThread.java:5102)
03-06 16:48:23.424: E/AndroidRuntime(2300): at java.lang.reflect.Method.invokeNative(Native Method)
03-06 16:48:23.424: E/AndroidRuntime(2300): at java.lang.reflect.Method.invoke(Method.java:515)
03-06 16:48:23.424: E/AndroidRuntime(2300): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
03-06 16:48:23.424: E/AndroidRuntime(2300): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
03-06 16:48:23.424: E/AndroidRuntime(2300): at dalvik.system.NativeStart.main(Native Method)
I though it was becase of minimun SDK version but no... Also I know the problem is in the onCameraFrame, because when I comment the try/catch, I can run the app. Any ideas?
Thanks.
Solved, the core.jar must be in the Libs folder...

Android setdrawable from another class

Here's my code. I am trying to set background of a linear layout. But this xml (rowback) is not my main activity content, so gives errors. how can I set some XML from the class which doesn't have that XML in its content?
setContentView(R.layout.activity_quick_search_products);
...
rowb = (LinearLayout)findViewById(R.id.rowback);
...
final Drawable d = getResources().getDrawable(R.drawable.denemebut3);
d.setAlpha(100);
rowb.setBackgroundDrawable(d);
Logcat:
03-30 02:52:50.822: D/AndroidRuntime(14677): Shutting down VM
03-30 02:52:50.822: W/dalvikvm(14677): threadid=1: thread exiting with uncaught exception (group=0x40c841f8)
03-30 02:52:50.822: E/AndroidRuntime(14677): FATAL EXCEPTION: main
03-30 02:52:50.822: E/AndroidRuntime(14677): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vitrinn/com.vitrinn.QuickSearchProducts}: java.lang.NullPointerException
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1968)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.ActivityThread.access$600(ActivityThread.java:127)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.os.Handler.dispatchMessage(Handler.java:99)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.os.Looper.loop(Looper.java:137)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.ActivityThread.main(ActivityThread.java:4507)
03-30 02:52:50.822: E/AndroidRuntime(14677): at java.lang.reflect.Method.invokeNative(Native Method)
03-30 02:52:50.822: E/AndroidRuntime(14677): at java.lang.reflect.Method.invoke(Method.java:511)
03-30 02:52:50.822: E/AndroidRuntime(14677): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:978)
03-30 02:52:50.822: E/AndroidRuntime(14677): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
03-30 02:52:50.822: E/AndroidRuntime(14677): at dalvik.system.NativeStart.main(Native Method)
03-30 02:52:50.822: E/AndroidRuntime(14677): Caused by: java.lang.NullPointerException
03-30 02:52:50.822: E/AndroidRuntime(14677): at com.vitrinn.QuickSearchProducts.onCreate(QuickSearchProducts.java:69)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.Activity.performCreate(Activity.java:4469)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
03-30 02:52:50.822: E/AndroidRuntime(14677): ... 11 more
If R.id.rowback doesn't belong to your main activity xml resource, then you should inflate that resource manually using:
LinearLayout rowb = (LinearLayout) getLayoutInflater().inflate(XML file that contains R.id.rowback, null);
then you can safely do
rowb.setBackgroundDrawable(d);
As an extra, if you have nested elements in rowback then you can invoke:
rowb.findViewById(R.id.Something) safely.
Or if your class is not exteding from any Activity, you can always receive a Context object in its constructor, and then use
LayoutInflater.from(context)
to get a LayoutInflater object so you can inflate any XML resource you need that is not actually in your main content.
Hope this clarifies...

Categories

Resources