NPE on onTouchEvent in MMAdView - android

I have followed all the steps described here
add doesn't appear but when i touch the add area it gives me NPE
07-10 15:37:20.564: E/AndroidRuntime(715): FATAL EXCEPTION: main
07-10 15:37:20.564: E/AndroidRuntime(715): java.lang.NullPointerException
07-10 15:37:20.564: E/AndroidRuntime(715): at com.millennialmedia.android.MMAdView.onTouchEvent(MMAdView.java:631)
07-10 15:37:20.564: E/AndroidRuntime(715): at android.view.View.dispatchTouchEvent(View.java:3766)
07-10 15:37:20.564: E/AndroidRuntime(715): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:897)
07-10 15:37:20.564: E/AndroidRuntime(715): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
07-10 15:37:20.564: E/AndroidRuntime(715): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
07-10 15:37:20.564: E/AndroidRuntime(715): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
07-10 15:37:20.564: E/AndroidRuntime(715): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
07-10 15:37:20.564: E/AndroidRuntime(715): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1671)
07-10 15:37:20.564: E/AndroidRuntime(715): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
07-10 15:37:20.564: E/AndroidRuntime(715): at android.app.Activity.dispatchTouchEvent(Activity.java:2086)
07-10 15:37:20.564: E/AndroidRuntime(715): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1655)
07-10 15:37:20.564: E/AndroidRuntime(715): at android.view.ViewRoot.handleMessage(ViewRoot.java:1785)
07-10 15:37:20.564: E/AndroidRuntime(715): at android.os.Handler.dispatchMessage(Handler.java:99)
07-10 15:37:20.564: E/AndroidRuntime(715): at android.os.Looper.loop(Looper.java:123)
07-10 15:37:20.564: E/AndroidRuntime(715): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-10 15:37:20.564: E/AndroidRuntime(715): at java.lang.reflect.Method.invokeNative(Native Method)
07-10 15:37:20.564: E/AndroidRuntime(715): at java.lang.reflect.Method.invoke(Method.java:521)
07-10 15:37:20.564: E/AndroidRuntime(715): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-10 15:37:20.564: E/AndroidRuntime(715): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-10 15:37:20.564: E/AndroidRuntime(715): at dalvik.system.NativeStart.main(Native Method)
calling my add from onCreate
Hashtable<String, String> map = new Hashtable<String, String>();
map.put("age", "45");
map.put("zip", "90210");
map.put("income", "50000");
LinearLayout myLayout = (LinearLayout) findViewById(R.id.layoutadd);
adview = new MMAdView(Result.this, MYAPID, MMAdView.BANNER_AD_BOTTOM, 30,map);//(Result.this, MYAPID,"MMBannerAdBottom", 30,false);
adview.setId(MMAdViewSDK.DEFAULT_VIEWID + 1);
myLayout.addView(adview, new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));
MMAdListener listener = new MyAdListener();
adview.setListener(new com.millennialmedia.android.BasicMMAdListener());//listener);
adview.callForAd();
Note: this thing happens with latest millennial media only. older version says no add return in logcat and continues to work.
EDIT: after lots of things i moved to xml and it was working like champ. now i think problem with java code is adview was not added to view properly and hence touching the space of ad was giving the NPE. Can any one tell more about this?

Related

AndroidRunTime error, application has stopped unexpectedly

07-10 08:32:43.863: E/AndroidRuntime(718): FATAL EXCEPTION: main
07-10 08:32:43.863: E/AndroidRuntime(718): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.burp/com.example.burp.MainActivity}: java.lang.ClassNotFoundException: com.example.burp.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.burp-2.apk]
07-10 08:32:43.863: E/AndroidRuntime(718): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
07-10 08:32:43.863: E/AndroidRuntime(718): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
07-10 08:32:43.863: E/AndroidRuntime(718): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
07-10 08:32:43.863: E/AndroidRuntime(718): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
07-10 08:32:43.863: E/AndroidRuntime(718): at android.os.Handler.dispatchMessage(Handler.java:99)
07-10 08:32:43.863: E/AndroidRuntime(718): at android.os.Looper.loop(Looper.java:123)
07-10 08:32:43.863: E/AndroidRuntime(718): at android.app.ActivityThread.main(ActivityThread.java:3683)
07-10 08:32:43.863: E/AndroidRuntime(718): at java.lang.reflect.Method.invokeNative(Native Method)
07-10 08:32:43.863: E/AndroidRuntime(718): at java.lang.reflect.Method.invoke(Method.java:507)
07-10 08:32:43.863: E/AndroidRuntime(718): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-10 08:32:43.863: E/AndroidRuntime(718): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-10 08:32:43.863: E/AndroidRuntime(718): at dalvik.system.NativeStart.main(Native Method)
07-10 08:32:43.863: E/AndroidRuntime(718): Caused by: java.lang.ClassNotFoundException: com.example.burp.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.burp-2.apk]
07-10 08:32:43.863: E/AndroidRuntime(718): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
07-10 08:32:43.863: E/AndroidRuntime(718): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
07-10 08:32:43.863: E/AndroidRuntime(718): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
07-10 08:32:43.863: E/AndroidRuntime(718): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
07-10 08:32:43.863: E/AndroidRuntime(718): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
07-10 08:32:43.863: E/AndroidRuntime(718): ... 11 more
how do I solve this problem? I am using Windows 7
Include your Activity in Manifest file. Like this
<activity
android:name=".application's starting activity" <!-- (.)dot means current dir, if your activity is in another package then give full package name ex: com.xxx.Activity -->
android:label="LABEL FOR ACTIVITY "
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

Device does not respond in android

My App is run correctly in simulator but when i try to run in device .i will not give me error
please try to solve this problem
07-10 02:56:34.022: D/AndroidRuntime(28052): Shutting down VM
07-10 02:56:34.022: W/dalvikvm(28052): threadid=1: thread exiting with uncaught exception (group=0x40a551f8)
07-10 02:56:34.022: E/AndroidRuntime(28052): FATAL EXCEPTION: main
07-10 02:56:34.022: E/AndroidRuntime(28052): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.mobileTimerClock/com.android.mobileTimerClock.TimeClockDashBoard}: java.lang.NullPointerException: println needs a message
07-10 02:56:34.022: E/AndroidRuntime(28052): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
07-10 02:56:34.022: E/AndroidRuntime(28052): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
07-10 02:56:34.022: E/AndroidRuntime(28052): at android.app.ActivityThread.access$600(ActivityThread.java:123)
07-10 02:56:34.022: E/AndroidRuntime(28052): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
07-10 02:56:34.022: E/AndroidRuntime(28052): at android.os.Handler.dispatchMessage(Handler.java:99)
07-10 02:56:34.022: E/AndroidRuntime(28052): at android.os.Looper.loop(Looper.java:137)
07-10 02:56:34.022: E/AndroidRuntime(28052): at android.app.ActivityThread.main(ActivityThread.java:4424)
07-10 02:56:34.022: E/AndroidRuntime(28052): at java.lang.reflect.Method.invokeNative(Native Method)
07-10 02:56:34.022: E/AndroidRuntime(28052): at java.lang.reflect.Method.invoke(Method.java:511)
07-10 02:56:34.022: E/AndroidRuntime(28052): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-10 02:56:34.022: E/AndroidRuntime(28052): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-10 02:56:34.022: E/AndroidRuntime(28052): at dalvik.system.NativeStart.main(Native Method)
07-10 02:56:34.022: E/AndroidRuntime(28052): Caused by: java.lang.NullPointerException: println needs a message
07-10 02:56:34.022: E/AndroidRuntime(28052): at android.util.Log.println_native(Native Method)
07-10 02:56:34.022: E/AndroidRuntime(28052): at android.util.Log.i(Log.java:159)
07-10 02:56:34.022: E/AndroidRuntime(28052): at com.android.mobileTimerClock.TimeClockDashBoard.onCreate(TimeClockDashBoard.java:394)
07-10 02:56:34.022: E/AndroidRuntime(28052): at android.app.Activity.performCreate(Activity.java:4465)
07-10 02:56:34.022: E/AndroidRuntime(28052): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
07-10 02:56:34.022: E/AndroidRuntime(28052): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
07-10 02:56:34.022: E/AndroidRuntime(28052): ... 11 more
07-10 02:56:34.022: W/ActivityManager(177): Force finishing activity com.android.mobileTimerClock/.TimeClockDashBoard
07-10 02:56:34.030: W/ActivityManager(177): Force finishing activity com.android.mobileTimerClock/.DashBoard
07-10 02:56:34.530: W/ActivityManager(177): Activity pause timeout for ActivityRecord{41d0a690 com.android.mobileTimerClock/.TimeClockDashBoard}
My guess would be that you're passing null as the second parameter to a Log.i(String, String) call (or similar Log.*() method):
java.lang.NullPointerException: println needs a message

Android unable to install the application on emulator

I have an android application and am trying to test the installation by downloading from a URL. The app is developed by me and I can load the app into emulator using eclipse and run it properly.
I uploaded the apk to webserver and point the emulators android browser to the location http://localhost:9080/myapp.apk. Emulator downloads the app properly. When I try to click on the downloaded file to install, it throws an error saying Unfortunately the process android.process.media has stopped. I am not sure how to proceed further to resolve this issue
Emulator Configuration: Android avd running on API 14, ICS 4.0.0 with 1GB sdcard.iso
Appreciate any insights.
Logcat shows the following:
07-10 19:17:19.195: I/qtaguid(380): Untagging socket 65 failed errno=-2
07-10 19:17:19.195: W/NetworkManagementSocketTagger(380): untagSocket(65) failed with errno -2
07-10 19:17:19.624: D/dalvikvm(80): GC_CONCURRENT freed 398K, 10% free 12133K/13383K, paused 10ms+10ms
07-10 19:17:20.174: D/dalvikvm(147): GC_CONCURRENT freed 699K, 31% free 11440K/16455K, paused 4ms+8ms
07-10 19:17:20.734: D/dalvikvm(147): GC_CONCURRENT freed 535K, 32% free 11325K/16455K, paused 3ms+7ms
07-10 19:17:21.025: D/dalvikvm(80): GC_EXPLICIT freed 105K, 10% free 12084K/13383K, paused 5ms+11ms
07-10 19:17:21.484: D/dalvikvm(380): GC_CONCURRENT freed 373K, 5% free 10112K/10631K, paused 4ms+5ms
07-10 19:17:24.464: W/KeyguardViewMediator(80): verifyUnlock called when not externally disabled
07-10 19:17:24.594: W/dalvikvm(380): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Landroid/drm/DrmManagerClient;
07-10 19:17:24.604: D/AndroidRuntime(380): Shutting down VM
07-10 19:17:24.614: W/dalvikvm(380): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
07-10 19:17:24.654: E/AndroidRuntime(380): FATAL EXCEPTION: main
07-10 19:17:24.654: E/AndroidRuntime(380): java.lang.ExceptionInInitializerError
07-10 19:17:24.654: E/AndroidRuntime(380): at com.android.providers.downloads.DownloadDrmHelper.getOriginalMimeType(DownloadDrmHelper.java:97)
07-10 19:17:24.654: E/AndroidRuntime(380): at com.android.providers.downloads.DownloadReceiver.openDownload(DownloadReceiver.java:153)
07-10 19:17:24.654: E/AndroidRuntime(380): at com.android.providers.downloads.DownloadReceiver.handleNotificationBroadcast(DownloadReceiver.java:104)
07-10 19:17:24.654: E/AndroidRuntime(380): at com.android.providers.downloads.DownloadReceiver.onReceive(DownloadReceiver.java:74)
07-10 19:17:24.654: E/AndroidRuntime(380): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2118)
07-10 19:17:24.654: E/AndroidRuntime(380): at android.app.ActivityThread.access$1500(ActivityThread.java:122)
07-10 19:17:24.654: E/AndroidRuntime(380): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
07-10 19:17:24.654: E/AndroidRuntime(380): at android.os.Handler.dispatchMessage(Handler.java:99)
07-10 19:17:24.654: E/AndroidRuntime(380): at android.os.Looper.loop(Looper.java:137)
07-10 19:17:24.654: E/AndroidRuntime(380): at android.app.ActivityThread.main(ActivityThread.java:4340)
07-10 19:17:24.654: E/AndroidRuntime(380): at java.lang.reflect.Method.invokeNative(Native Method)
07-10 19:17:24.654: E/AndroidRuntime(380): at java.lang.reflect.Method.invoke(Method.java:511)
07-10 19:17:24.654: E/AndroidRuntime(380): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-10 19:17:24.654: E/AndroidRuntime(380): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-10 19:17:24.654: E/AndroidRuntime(380): at dalvik.system.NativeStart.main(Native Method)
07-10 19:17:24.654: E/AndroidRuntime(380): Caused by: java.lang.UnsatisfiedLinkError: Library drmframework_jni not found; tried [/vendor/lib/libdrmframework_jni.so, /system/lib/libdrmframework_jni.so]
07-10 19:17:24.654: E/AndroidRuntime(380): at java.lang.Runtime.loadLibrary(Runtime.java:393)
07-10 19:17:24.654: E/AndroidRuntime(380): at java.lang.System.loadLibrary(System.java:535)
07-10 19:17:24.654: E/AndroidRuntime(380): at android.drm.DrmManagerClient.<clinit>(DrmManagerClient.java:56)
07-10 19:17:24.654: E/AndroidRuntime(380): ... 15 more
07-10 19:17:24.804: W/InputManagerService(80): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#41647c30
07-10 19:17:25.044: I/WindowManager(80): createSurface Window{415ef168 paused=false}: DRAW NOW PENDING
Apparently its a bug in Android as pointed by #SevaAlekseyev above
code.google.com/p/android/issues/detail?id=21173
I was able to install by clicking on the app from downloads
Resolved in 4.1 (API 16). I get the same error because of an unsatisfied link error, libdrmframework_jni.so. Works well on a device.

Unable to run my Sencha Touch 2 using PhoneGap (FileNotFound on Dispatcher.js)(White Screen)

I've made a trial app using ST2, it works just fine while using only ST2 but when i try to use PhoneGap to run this app on an android emulator it seems to fail at loading my html5/JS ST2 files and throws java.io.FileNotFoundException: www/event/Dispatcher.js ...
Result -> White Screen
Stacktrace:
07-10 12:15:52.701: I/CordovaLog(536): Changing log level to DEBUG(3)
07-10 12:15:52.701: I/CordovaLog(536): Found preference for useBrowserHistory=false
07-10 12:15:52.711: D/CordovaLog(536): Found preference for useBrowserHistory=false
07-10 12:15:52.721: D/DroidGap(536): DroidGap.init()
07-10 12:15:52.771: I/dalvikvm(536): threadid=3: reacting to signal 3
07-10 12:15:52.841: D/CordovaWebView(536): >>>loadUrl(file:///android_asset/www/index.html)
07-10 12:15:52.841: D/PluginManager(536): init()
07-10 12:15:52.871: I/dalvikvm(536): Wrote stack traces to '/data/anr/traces.txt'
07-10 12:15:52.891: D/CordovaWebView(536): >>> loadUrlNow()
07-10 12:15:52.921: D/SoftKeyboardDetect(536): Ignore this event
07-10 12:15:53.011: W/webcore(536): java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.
07-10 12:15:53.011: W/webcore(536): at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:1683)
07-10 12:15:53.011: W/webcore(536): at android.webkit.WebViewCore$EventHub.access$7900(WebViewCore.java:926)
07-10 12:15:53.011: W/webcore(536): at android.webkit.WebViewCore.removeMessages(WebViewCore.java:1795)
07-10 12:15:53.011: W/webcore(536): at android.webkit.WebView.sendOurVisibleRect(WebView.java:2917)
07-10 12:15:53.011: W/webcore(536): at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:593)
07-10 12:15:53.011: W/webcore(536): at android.webkit.ZoomManager.access$1700(ZoomManager.java:49)
07-10 12:15:53.011: W/webcore(536): at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:984)
07-10 12:15:53.011: W/webcore(536): at android.os.Handler.handleCallback(Handler.java:605)
07-10 12:15:53.011: W/webcore(536): at android.os.Handler.dispatchMessage(Handler.java:92)
07-10 12:15:53.011: W/webcore(536): at android.os.Looper.loop(Looper.java:137)
07-10 12:15:53.011: W/webcore(536): at android.app.ActivityThread.main(ActivityThread.java:4424)
07-10 12:15:53.011: W/webcore(536): at java.lang.reflect.Method.invokeNative(Native Method)
07-10 12:15:53.011: W/webcore(536): at java.lang.reflect.Method.invoke(Method.java:511)
07-10 12:15:53.011: W/webcore(536): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-10 12:15:53.011: W/webcore(536): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-10 12:15:53.011: W/webcore(536): at dalvik.system.NativeStart.main(Native Method)
07-10 12:15:53.011: D/SoftKeyboardDetect(536): Ignore this event
07-10 12:15:53.041: D/gralloc_goldfish(536): Emulator without GPU emulation detected.
07-10 12:15:53.441: D/DroidGap(536): onMessage(onPageStarted,file:///android_asset/www/index.html)
07-10 12:15:53.631: D/dalvikvm(536): GC_CONCURRENT freed 181K, 4% free 9316K/9607K, paused 6ms+4ms
07-10 12:15:56.681: E/generateWebResourceResponse(536): www/event/Dispatcher.js
07-10 12:15:56.681: E/generateWebResourceResponse(536): java.io.FileNotFoundException: www/event/Dispatcher.js
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.content.res.AssetManager.openAsset(Native Method)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.content.res.AssetManager.open(AssetManager.java:315)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at org.apache.cordova.CordovaWebViewClient.generateWebResourceResponse(CordovaWebViewClient.java:492)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at org.apache.cordova.CordovaWebViewClient.shouldInterceptRequest(CordovaWebViewClient.java:465)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.webkit.CallbackProxy.shouldInterceptRequest(CallbackProxy.java:1078)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.webkit.BrowserFrame.shouldInterceptRequest(BrowserFrame.java:951)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.webkit.JWebCoreJavaBridge.nativeServiceFuncPtrQueue(Native Method)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.webkit.JWebCoreJavaBridge.handleMessage(JWebCoreJavaBridge.java:113)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.os.Handler.dispatchMessage(Handler.java:99)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.os.Looper.loop(Looper.java:137)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:728)
07-10 12:15:56.681: E/generateWebResourceResponse(536): at java.lang.Thread.run(Thread.java:856)
07-10 12:15:56.721: E/generateWebResourceResponse(536): www/event/publisher/Dom.js
07-10 12:15:56.721: E/generateWebResourceResponse(536): java.io.FileNotFoundException: www/event/publisher/Dom.js
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.content.res.AssetManager.openAsset(Native Method)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.content.res.AssetManager.open(AssetManager.java:315)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at org.apache.cordova.CordovaWebViewClient.generateWebResourceResponse(CordovaWebViewClient.java:492)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at org.apache.cordova.CordovaWebViewClient.shouldInterceptRequest(CordovaWebViewClient.java:465)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.webkit.CallbackProxy.shouldInterceptRequest(CallbackProxy.java:1078)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.webkit.BrowserFrame.shouldInterceptRequest(BrowserFrame.java:951)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.webkit.JWebCoreJavaBridge.nativeServiceFuncPtrQueue(Native Method)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.webkit.JWebCoreJavaBridge.handleMessage(JWebCoreJavaBridge.java:113)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.os.Handler.dispatchMessage(Handler.java:99)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.os.Looper.loop(Looper.java:137)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:728)
07-10 12:15:56.721: E/generateWebResourceResponse(536): at java.lang.Thread.run(Thread.java:856)
07-10 12:15:56.731: D/chromium(536): Unknown chromium error: -6
07-10 12:15:56.731: D/chromium(536): Unknown chromium error: -6
07-10 12:15:56.731: D/Cordova(536): onPageFinished(file:///android_asset/www/index.html)
07-10 12:15:56.731: D/CordovaWebView(536): >>> loadUrlNow()
07-10 12:15:56.731: D/DroidGap(536): onMessage(onNativeReady,null)
07-10 12:15:56.731: D/DroidGap(536): onMessage(onPageFinished,file:///android_asset/www/index.html)
07-10 12:15:56.911: I/SqliteDatabaseCpp(536): sqlite returned: error code = 14, msg = cannot open file at line 27701 of [8609a15dfa], db=/data/data/clearitm.mobility.hellosenchacordova/databases/webview.db
07-10 12:15:56.911: I/SqliteDatabaseCpp(536): sqlite returned: error code = 14, msg = os_unix.c: open() at line 27701 - "" errno=2 path=/CachedGeoposition.db, db=/data/data/clearitm.mobility.hellosenchacordova/databases/webview.db
07-10 12:15:57.042: D/DroidGap(536): onMessage(networkconnection,3g)
07-10 12:15:58.789: D/DroidGap(536): onMessage(spinner,stop)
index.html code:
<!DOCTYPE html>
<html>
<header>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sencha Touch 2 Teste</title>
<link rel="stylesheet" href="sencha-touch.css" type="text/css">
<script type="text/javascript" src="sencha-touch.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"></script>
<script type="text/javascript" charset="utf-8" src="app/app.js"></script>
</header>
<body>
</body>
</html>
app.js:
Ext.Loader.setConfig({
enable: true
});
Ext.application({
name:'Touch2Demo',
views: [
'ContatosList',
'ContatosForm'
],
models: [
'Contato'
],
controllers: [
'Main'
],
stores: [
'Contatos'
],
viewport:{
layout:{
type: 'card',
animation: {
type: 'slide',
duration: 1000
}
}
},
launch: function(){
}
});
main java class:
import org.apache.cordova.DroidGap;
import android.os.Bundle;
public class HelloSenchaCordovaActivity extends DroidGap {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
assets folder structure :
assets>
www>
app>
app.js
controller
data
model
profile
store
view
sencha>
resources>
sencha-touch.js
cordova-1.9.0.js
sencha-touch.js
sencha-touch.css
index.html
I've searched other questions regarding this kind of problem but none of those solutions managed to solve my problem :/ Any clues on whats wrong here ?
Thanks !
Managed to make it work, the problem was that I was using sencha-touch.js when i should use sencha-touch-all.js :) It's working like a charm now, I hope this helps others having problems like this.

Getting the Runtime exception in the application

I am getting the Run time exception in my application and I have tried a lot to sort it out but couldn't do it.
Here is the code where I am getting the error:
public class FirstDemo extends ListActivity
{
private ListView Lv02;
private String Lv_Arr02[]={ "darshan", "sunil", "viral", "jaimin", "aashish", "jaydev", "bhavesh"};
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.mylistview); ( Here I am getting the Exception )
Lv02=(ListView) findViewById(R.id.lstvw_mylist);
}
}
My Stack Trace is as under:
12-30 11:21:09.525: ERROR/AndroidRuntime(517): FATAL EXCEPTION: main
12-30 11:21:09.525: ERROR/AndroidRuntime(517): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.mytabhostdemo/com.android.mytabhostdemo.FirstDemo}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.ActivityThread.startActivityNow(ActivityThread.java:2503)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:651)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.widget.TabHost.setCurrentTab(TabHost.java:323)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:129)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:453)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.view.View.performClick(View.java:2408)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.view.View$PerformClick.run(View.java:8816)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.os.Handler.handleCallback(Handler.java:587)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.os.Handler.dispatchMessage(Handler.java:92)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.os.Looper.loop(Looper.java:123)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at java.lang.reflect.Method.invokeNative(Native Method)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at java.lang.reflect.Method.invoke(Method.java:521)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at dalvik.system.NativeStart.main(Native Method)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.ListActivity.onContentChanged(ListActivity.java:245)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.Activity.setContentView(Activity.java:1647)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at com.android.mytabhostdemo.FirstDemo.onCreate(FirstDemo.java:17) (Here I think)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): ... 18 more
It would be great if anybody could help me.
Thanks,
david
In your XML file your top element must be a ListView since you derive from ListActivity.
example:
<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/list">
</ListView>
When deriving from specific activities Android expects there to be a specific definition in your layout XML file with a predefined ID.
If you post your XML we can fix it for you.

Categories

Resources