I have tried the sample code of Bluetooth chat from Android SDK. The code has no errors, Installed the APK on device, while opening the Bluetooth chat, Force close is thrown.
I used a real device to debug, i.e. Galaxy Nexus S.
Please help me .
. Thanks in advance.
I managed to fix it by:
Changing the AndroidManifest.xml: Basically upgrading the versions where it works <uses-sdk android:maxSdkVersion="17" android:targetSdkVersion="11" android:minSdkVersion="11"/> the 11th version is Android 3.0 (Honeycomb).
Also deleted the line in the AndroidManifest.xml referring to the style android:theme="#android:style/Theme.Holo.Dialog"
The main activity is BluetoothChat, so looking in the logCat I could see what else is throwing exceptions, the method setStatus around 233 is throwing a NullPointerEception due that the onCreate method needs the following code just bellow the super.onCreate call. Thanks to this post
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
I'm not sure if this still applies for you, but i encountered the same problem.
I downloaded the sample, loaded it on a Samsung S3(jellybean) and it kept crashing after the prompt for Bluetooth. There wasn't any error at first. So i tried using your method of removing
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter()
in the code (on eclipse) and was prompted that it was read only and whether i want to make it writable. Upon doing that a few error came up and that was a prompt to say getDefaultAdapter is for API 5 and current minSdk is 1. Hence i looked up into the manifest file to see why it would be a problem since i put it as minSdkVersion=5.
Upon making the manifest file writable as previously mentioned for the java file, i realized the error was due to this line
android:theme="#android:style/Theme.Holo.Dialog"
it requires an API of 11. Hence i changed to android:minSdkVersion="11" and now it works perfectly.
Related
I'm trying to open the Android app, it is crashed immediately after opening the page.
I am using the android P version on(Redmi note 7 pro phone) its crashed only for P version.
Its showing ClipboardService error and the error is like the following.
E/ClipboardService: Denying clipboard access to com.google.android.as,
application is not in focus neither is a system service for user 0
Please help me to handle this error. Thanks in advance.
Found a solution to this issue.
Here is the detail.
Device : Pixel 2
OS : Android 10
Actual issue that led me to the solution was a closer look in the Logcat where I found a Deprecation of HTTP client, which has already happened in Android Pie. Documentation LINK
Solution as per Doc is to add following line inside the application tag in the manifest.
<application
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
.
.
.
</application>
This fixed the issue for me, not just in one but more than one places, each one displayed a different error in the logcat.
Additional SOF Reference Thanks to #wongk
i have a weired problem.
I want to install a app that i made on a Nexus 5 Phone and getting the LogCat error that i postetd below.
The funny think is, if i install this app on my Samsung Galaxy S3 it works fine. Just on my nexus 5 i get those errors and warnings.
And maybe i have to mention that the same OS is installed on both phones, CyanogenMod...
LogCat
http://pastebin.com/5dqdkKPY
android manifest:
http://pastebin.com/rtkeyVw5
Thanks for your help!
I think the reason is you lack of permissions. try add this code to your AndroidManifest.xml:
<uses-permission android:name="android.permission.INSTALL_LOCATION_PROVIDER"/>
Every major android component must be declared appropriately on your applications manifest file. It seems like you are using a Content Provider. Is it a provider you implement? Or is it one of the Android's build-in? In any case you have to declare your "intentions" at the manifest. Take a look here:
http://developer.android.com/guide/topics/providers/content-provider-creating.html#ProviderElement
Blockquote
I am creating my first application with successfully. But now one problem which i facing is when I run my application in android 2.2 then its successfully work. But when I start it with 3.0 or 4.0 its become crash.
I am finding on google but not get perfect idea about this. So that I asking help here.
Please help me to find this.
Thanks in advance.
-Mayank
when run my application in 4.0 version my application stopped and when run 2.2 run successfully... what the problem..
in 4.0 unfortunetely your application has been stopped and application close what the problem help me...
You have to give permission on manifest or not.if not then
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="15" />
give this permission.
You first read this for creating application with multiple support. You can declare in menifeast file like
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="15" />
This question is of 7 months old. still if some body came to this page by goggling about NetworkOnMainThreadException on android, this is the answer.
If your application have network actions like sending HTTPGet / HTTPPost calls, from Android 3.0 (Honey Comb) sending network calls directly on main thread was not supported as it may stop main thread (UI thread) execution until network call response as the network call may take a long time and UI can't be loaded which is annoying to user experience.
So, sending network calls can be either on separate thread or Android API providing class (AsyncTask).
one more suggestion for android developers is
Start coding on latest version and keep min sdk version to as low as possible (I personally use min SDK- 8 & Target SDK - latest), so that you will get deprecation warnings and your application can run on latest android devices (at least till latest devices at time of development).
I am trying to run the example application in the networkusage.zip file on the Android Developers website (location: http://developer.android.com/training/basics/network-ops/index.html).
I have not made any changes to the code whatsoever. However, it crashes immediately on startup. I have tried setting a breakpoint in the onCreate method of the main activity, but it never gets there....just crashes right away.
I am just starting with Android, but I been able to complete other training sessions and run other example apps, so I believe my configuration works. I am running Windows 7, with Eclipse Juno and the very latest JDK and Android SDK/ADT (both downloaded about a week ago).
I am using an emulator targeting Android 4.1 (API 16).
The emulator shows a messages that says Unfortunately, NetWork Usage has stopped working.
Any help would be greatly appreciated!!
In AndroidManifest.xml file, for this project, substitute absolute android:name for NetworkActivity with relative one.
In other words, change this line:
android:name="com.example.networkusage.NetworkActivity"
to look like this:
android:name=".NetworkActivity"
The problem was that NetworkActivity is not in com.example.networkusage (as was in AndroidManifest.xml file), but in com.example.android.networkusage package. Thus, Android couldn't find the class on runtime.
I am new to Android and I am trying a few small apps (like Compass). When I run the app in the emulator, it gives the message Unfortunately, Compass has Stopped.
I have no compile time errors.
How do I solve this, and what is causing this?
Thanks in advance.
I had the same error message and found that, in commenting out uses-permission nodes in AndroidManifest.xml I had commented out one that was needed. When I put it back in the app ran fine. I was able to reproduce the error. I needed:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
This was for a barebones index.html, single page app, that displays Hello World.
And the permission above was the only one I needed to do Run As/ Android Application and get it to run in an emulator.
HTH
You have posted no code so it's difficult to see what your problem is. However I had the same issue which has been sorted out here Unfortunately HelloListView has stopped
It probably due to the fact that you don't have accelerometer and magnetic field support.
Go to your AVD configuration and add the following hardware: Magnetic Field Support and accelerometer
First check your AndroidManifest.xml file and write activity tag
For example, you have DisplayMessageActivity.class and package is me.user_interface
tag is:
<activity android:name="me.user_interface.DisplayMessageActivity"/>
You can write this after </activity> tag in AndroidManifest.xml file. Check the path carefully.