"Unfortunately, MainScreenActivity has stopped" ERROR message in Android Emulator - android

I tried doing this code from this site: http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/ . Everything worked out properly but when i tried to VIEW and ADD products the emulator goes "Unfortunately, MainScreenActivity has stopped.
help please?? :D
here is my logcat file:
06-26 15:53:16.227: E/AndroidRuntime(1396): FATAL EXCEPTION: AsyncTask #1
06-26 15:53:16.227: E/AndroidRuntime(1396): java.lang.RuntimeException: An error occured while executing doInBackground()
06-26 15:53:16.227: E/AndroidRuntime(1396): at android.os.AsyncTask$3.done(AsyncTask.java:299)
06-26 15:53:16.227: E/AndroidRuntime(1396): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
06-26 15:53:16.227: E/AndroidRuntime(1396): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
06-26 15:53:16.227: E/AndroidRuntime(1396): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
06-26 15:53:16.227: E/AndroidRuntime(1396): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-26 15:53:16.227: E/AndroidRuntime(1396): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-26 15:53:16.227: E/AndroidRuntime(1396): at java.lang.Thread.run(Thread.java:856)
06-26 15:53:16.227: E/AndroidRuntime(1396): Caused by: java.lang.IllegalArgumentException: Illegal character in authority at index 15: http://10.0.2.2 /try/get_all_products.php?
06-26 15:53:16.227: E/AndroidRuntime(1396): at java.net.URI.create(URI.java:727)
06-26 15:53:16.227: E/AndroidRuntime(1396): at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:75)
06-26 15:53:16.227: E/AndroidRuntime(1396): at com.example.mainscreenactivity.JSONParser.makeHttpRequest(JSONParser.java:60)
06-26 15:53:16.227: E/AndroidRuntime(1396): at com.example.mainscreenactivity.AllProductsActivity$LoadAllProducts.doInBackground(AllProductsActivity.java:128)
06-26 15:53:16.227: E/AndroidRuntime(1396): at com.example.mainscreenactivity.AllProductsActivity$LoadAllProducts.doInBackground(AllProductsActivity.java:1)
06-26 15:53:16.227: E/AndroidRuntime(1396): at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-26 15:53:16.227: E/AndroidRuntime(1396): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
06-26 15:53:16.227: E/AndroidRuntime(1396): ... 3 more
06-26 15:53:16.570: W/ActivityManager(276): Force finishing activity com.example.mainscreenactivity/.AllProductsActivity
06-26 15:53:16.737: W/WindowManager(276): Failure taking screenshot for (266x425) to layer 21020

You have a space character after the ip address: http://10.0.2.2*/

Related

What does this Android Runtime logCat error mean?

I'm new to android programming and especially eclipse. I have a very hard time undersanding what the LogCat errors mean and where to look to fix them. I'm used to Visual Studios so it usually tells me where the error is located at. All of the classes it shows me arent even classes that I have created, but built in ones so I'm just confused..
LogCat:
06-26 09:03:56.201: E/AndroidRuntime(3428): FATAL EXCEPTION: main
06-26 09:03:56.201: E/AndroidRuntime(3428): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.basicscanner/com.example.basicscanner.MainActivity}: java.lang.ClassNotFoundException: com.example.basicscanner.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.basicscanner-1.apk]
06-26 09:03:56.201: E/AndroidRuntime(3428): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
06-26 09:03:56.201: E/AndroidRuntime(3428): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-26 09:03:56.201: E/AndroidRuntime(3428): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-26 09:03:56.201: E/AndroidRuntime(3428): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-26 09:03:56.201: E/AndroidRuntime(3428): at android.os.Handler.dispatchMessage(Handler.java:99)
06-26 09:03:56.201: E/AndroidRuntime(3428): at android.os.Looper.loop(Looper.java:130)
06-26 09:03:56.201: E/AndroidRuntime(3428): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-26 09:03:56.201: E/AndroidRuntime(3428): at java.lang.reflect.Method.invokeNative(Native Method)
06-26 09:03:56.201: E/AndroidRuntime(3428): at java.lang.reflect.Method.invoke(Method.java:507)
06-26 09:03:56.201: E/AndroidRuntime(3428): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-26 09:03:56.201: E/AndroidRuntime(3428): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-26 09:03:56.201: E/AndroidRuntime(3428): at dalvik.system.NativeStart.main(Native Method)
06-26 09:03:56.201: E/AndroidRuntime(3428): Caused by: java.lang.ClassNotFoundException: com.example.basicscanner.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.basicscanner-1.apk]
06-26 09:03:56.201: E/AndroidRuntime(3428): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
06-26 09:03:56.201: E/AndroidRuntime(3428): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
06-26 09:03:56.201: E/AndroidRuntime(3428): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
06-26 09:03:56.201: E/AndroidRuntime(3428): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
06-26 09:03:56.201: E/AndroidRuntime(3428): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
It means that the compiler is not able to find your class, maybe because you haven't defined it in your android manifest or maybe the path to your class is not right;)
It is a problem of your Intent.
Please add your Activity in your AndroidManifest.xml.
When you want to making new activity, you should register it in your AndroidManifest.xml.

NoClassFoundError MultipartEntity error in android

I am not able to figure this problem out.I added the following jars.
httpClient-4.2.5.jar
httpcore-4.2.4.jar
httpmime-4.2.5.jar
I added these jar through Add External JARs option in Build Paths and then added them manually in the libs folder of my eclipse project still it gives me the following error while debugging the following line.
MultipartEntity multipartEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
Actually I am trying to upload multiple images to my php server using this.
Logcat:
06-26 02:06:08.082: E/AndroidRuntime(20389): FATAL EXCEPTION: IntentService[SyncService]
06-26 02:06:08.082: E/AndroidRuntime(20389): java.lang.NoClassDefFoundError: org.apache.http.entity.mime.MultipartEntity
06-26 02:06:08.082: E/AndroidRuntime(20389): at com.example.cameralibrary.ServerCommunication.uploadUserPhoto(ServerCommunication.java:43)
06-26 02:06:08.082: E/AndroidRuntime(20389): at com.example.cameralibrary.SyncService.onHandleIntent(SyncService.java:38)
06-26 02:06:08.082: E/AndroidRuntime(20389): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:59)
06-26 02:06:08.082: E/AndroidRuntime(20389): at android.os.Handler.dispatchMessage(Handler.java:99)
06-26 02:06:08.082: E/AndroidRuntime(20389): at android.os.Looper.loop(Looper.java:138)
06-26 02:06:08.082: E/AndroidRuntime(20389): at android.os.HandlerThread.run(HandlerThread.java:60)
06-26 02:06:08.082: E/AndroidRuntime(20389): Caused by: java.lang.ClassNotFoundException: org.apache.http.entity.mime.MultipartEntity in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/data/app/com.example.cameralibrary-2.apk]
06-26 02:06:08.082: E/AndroidRuntime(20389): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
06-26 02:06:08.082: E/AndroidRuntime(20389): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
06-26 02:06:08.082: E/AndroidRuntime(20389): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
Found out myself.The problem was that I didn't include the READ_EXTERNAL_STORAGE permission.
I added the following line in my manifest and it worked.
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Source Attachment does not contain the source for the file ThreadPoolExecutor.class

I am working on an android project which uses the webservice I have created. It was working fine few minutes earlier but suddenly it started to give below error.
the source attachment does not contain the source for the file threadpoolexecutor.class
Logcat error is :
07-10 11:30:22.844: E/AndroidRuntime(1707): FATAL EXCEPTION: AsyncTask #1
07-10 11:30:22.844: E/AndroidRuntime(1707): java.lang.RuntimeException: An error occured while executing doInBackground()
07-10 11:30:22.844: E/AndroidRuntime(1707): at android.os.AsyncTask$3.done(AsyncTask.java:299)
07-10 11:30:22.844: E/AndroidRuntime(1707): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
07-10 11:30:22.844: E/AndroidRuntime(1707): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
07-10 11:30:22.844: E/AndroidRuntime(1707): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
07-10 11:30:22.844: E/AndroidRuntime(1707): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
07-10 11:30:22.844: E/AndroidRuntime(1707): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
07-10 11:30:22.844: E/AndroidRuntime(1707): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
07-10 11:30:22.844: E/AndroidRuntime(1707): at java.lang.Thread.run(Thread.java:856)
07-10 11:30:22.844: E/AndroidRuntime(1707): Caused by: java.lang.NullPointerException
07-10 11:30:22.844: E/AndroidRuntime(1707): at com.example.backgroundTask.BackgroundTask.RegisterUser(BackgroundTask.java:125)
07-10 11:30:22.844: E/AndroidRuntime(1707): at com.example.backgroundTask.BackgroundTask.doInBackground(BackgroundTask.java:65)
07-10 11:30:22.844: E/AndroidRuntime(1707): at com.example.backgroundTask.BackgroundTask.doInBackground(BackgroundTask.java:1)
07-10 11:30:22.844: E/AndroidRuntime(1707): at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-10 11:30:22.844: E/AndroidRuntime(1707): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
07-10 11:30:22.844: E/AndroidRuntime(1707): ... 4 more
07-10 11:30:23.174: W/Trace(1707): Unexpected value from nativeGetEnabledTags: 0
Please tell me what may cause this error or let me know if more information required.
Thanks & Regards..
Sourabh
I found it. I was checking the value and if everything if fine it will return null from the web service. and that null value I was trying to convert to string value and hence geting the above error.
Thanks CommonsWare.

pull to refresh example, error

I'm trying to add the "pull to refresh" widget to my code, I'm just using this example:
https://github.com/johannilsson/android-pulltorefresh
So, I create the pullToRefresh package, generate a jar file with eclipse and import it in other package, I got this error:
06-26 10:55:05.482: E/AndroidRuntime(508): FATAL EXCEPTION: main
06-26 10:55:05.482: E/AndroidRuntime(508): java.lang.RuntimeException: Unable to start activity ComponentInfo{example.pull/example.pull.PullToRefreshExampleActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class com.pull.widget.pullToRefresh
06-26 10:55:05.482: E/AndroidRuntime(508): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1815)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.app.ActivityThread.access$500(ActivityThread.java:122)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.os.Handler.dispatchMessage(Handler.java:99)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.os.Looper.loop(Looper.java:132)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.app.ActivityThread.main(ActivityThread.java:4123)
06-26 10:55:05.482: E/AndroidRuntime(508): at java.lang.reflect.Method.invokeNative(Native Method)
06-26 10:55:05.482: E/AndroidRuntime(508): at java.lang.reflect.Method.invoke(Method.java:491)
06-26 10:55:05.482: E/AndroidRuntime(508): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
06-26 10:55:05.482: E/AndroidRuntime(508): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
06-26 10:55:05.482: E/AndroidRuntime(508): at dalvik.system.NativeStart.main(Native Method)
06-26 10:55:05.482: E/AndroidRuntime(508): Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class com.pull.widget.pullToRefresh
06-26 10:55:05.482: E/AndroidRuntime(508): at android.view.LayoutInflater.createView(LayoutInflater.java:596)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:671)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.view.LayoutInflater.rInflate(LayoutInflater.java:724)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.view.LayoutInflater.inflate(LayoutInflater.java:347)
06-26 10:55:05.482: E/AndroidRuntime(508): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:223)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.app.Activity.setContentView(Activity.java:1786)
06-26 10:55:05.482: E/AndroidRuntime(508): at example.pull.PullToRefreshExampleActivity.onCreate(PullToRefreshExampleActivity.java:21)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.app.Activity.performCreate(Activity.java:4397)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1779)
06-26 10:55:05.482: E/AndroidRuntime(508): ... 11 more
06-26 10:55:05.482: E/AndroidRuntime(508): Caused by: java.lang.reflect.InvocationTargetException
06-26 10:55:05.482: E/AndroidRuntime(508): at java.lang.reflect.Constructor.constructNative(Native Method)
06-26 10:55:05.482: E/AndroidRuntime(508): at java.lang.reflect.Constructor.newInstance(Constructor.java:416)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.view.LayoutInflater.createView(LayoutInflater.java:576)
06-26 10:55:05.482: E/AndroidRuntime(508): ... 22 more
06-26 10:55:05.482: E/AndroidRuntime(508): Caused by: android.content.res.Resources$NotFoundException: File pulltorefresh from xml type layout resource ID #0x7f030000
06-26 10:55:05.482: E/AndroidRuntime(508): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2135)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2090)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.content.res.Resources.getLayout(Resources.java:849)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.view.LayoutInflater.inflate(LayoutInflater.java:389)
06-26 10:55:05.482: E/AndroidRuntime(508): at com.pull.widget.pullToRefresh.init(pullToRefresh.java:92)
06-26 10:55:05.482: E/AndroidRuntime(508): at com.pull.widget.pullToRefresh.<init>(pullToRefresh.java:66)
06-26 10:55:05.482: E/AndroidRuntime(508): ... 25 more
06-26 10:55:05.482: E/AndroidRuntime(508): Caused by: java.io.FileNotFoundException: pulltorefresh
06-26 10:55:05.482: E/AndroidRuntime(508): at android.content.res.AssetManager.openXmlAssetNative(Native Method)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:487)
06-26 10:55:05.482: E/AndroidRuntime(508): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2117)
06-26 10:55:05.482: E/AndroidRuntime(508): ... 30 more
what I see more important:-
06-26 10:55:05.482: E/AndroidRuntime(508): at com.pull.widget.pullToRefresh.init(pullToRefresh.java:92)
Is this line:
mRefreshViewText = (TextView) mRefreshView.findViewById(R.id.pull_to_refresh_text);
in "pullToRefresh.java" in the package created.
From the package, what could it be happening??
Thanks in advance

please can anyone explain this error in logcat

06-26 17:07:09.898: E/AndroidRuntime(380): FATAL EXCEPTION: main
06-26 17:07:09.898: E/AndroidRuntime(380): java.lang.NoClassDefFoundError: org.mythrii.email.Mail
06-26 17:07:09.898: E/AndroidRuntime(380): at org.mythrii.email.Email$1.onClick(Email.java:19)
06-26 17:07:09.898: E/AndroidRuntime(380): at android.view.View.performClick(View.java:2485)
06-26 17:07:09.898: E/AndroidRuntime(380): at android.view.View$PerformClick.run(View.java:9080)
06-26 17:07:09.898: E/AndroidRuntime(380): at android.os.Handler.handleCallback(Handler.java:587)
06-26 17:07:09.898: E/AndroidRuntime(380): at android.os.Handler.dispatchMessage(Handler.java:92)
06-26 17:07:09.898: E/AndroidRuntime(380): at android.os.Looper.loop(Looper.java:123)
06-26 17:07:09.898: E/AndroidRuntime(380): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-26 17:07:09.898: E/AndroidRuntime(380): at java.lang.reflect.Method.invokeNative(Native Method)
06-26 17:07:09.898: E/AndroidRuntime(380): at java.lang.reflect.Method.invoke(Method.java:507)
06-26 17:07:09.898: E/AndroidRuntime(380): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-26 17:07:09.898: E/AndroidRuntime(380): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-26 17:07:09.898: E/AndroidRuntime(380): at dalvik.system.NativeStart.main(Native Method)
The solution to this problem is to create a folder named "libs" in the project directory and copying all the external jar files there.
For further explanation, you can refer to this link.
http://tools.android.com/recent/dealingwithdependenciesinandroidprojects
I think what you face is that your code compiles , but # run time it crashes . How do i solve this , create a libs folder in your project inside eclipse(if its not exist) and add the jar file that contains the org.mythrii.email.Mail class inside the libs folder , Then run you app .

Categories

Resources