I try to implement bluetooth communication for my application but I'm still stuck on the discover devices part.
So, I try to implement the Bluetooth Chat example provided by google but I get some errors.
Indeed, Ecplise tells me that I have to import android.R
but I know that it is an error from Eclipse. It seems that the major issue is that xml layout files are not recognized.
I got some erros from my console:
[2011-05-26 15:30:46 - androidBthChat] E:\DATA\Simon\simon\Travail\Workspace_Eclipse\androidBthChat\res\layout\device_list.xml:8: error: Error: No resource found that matches the given name (at 'text' with value '@string/title_paired_devices').
[2011-05-26 15:30:46 - androidBthChat] E:\DATA\Simon\simon\Travail\Workspace_Eclipse\androidBthChat\res\layout\device_list.xml:23: error: Error: No resource found that matches the given name (at 'text' with value '@string/title_other_devices').
[2011-05-26 15:30:46 - androidBthChat] E:\DATA\Simon\simon\Travail\Workspace_Eclipse\androidBthChat\res\layout\device_list.xml:38: error: Error: No resource found that matches the given name (at 'text' with value '@string/button_scan').
[2011-05-26 15:30:46 - androidBthChat] E:\DATA\Simon\simon\Travail\Workspace_Eclipse\androidBthChat\res\layout\main.xml:26: error: Error: No resource found that matches the given name (at 'text' with value '@string/send').
[2011-05-26 15:30:46 - androidBthChat] E:\DATA\Simon\simon\Travail\Workspace_Eclipse\androidBthChat\res\menu\option_menu.xml:4: error: Error: No resource found that matches the given name (at 'title' with value '@string/secure_connect').
[2011-05-26 15:30:46 - androidBthChat] E:\DATA\Simon\simon\Travail\Workspace_Eclipse\androidBthChat\res\menu\option_menu.xml:8: error: Error: No resource found that matches the given name (at 'title' with value '@string/insecure_connect').
[2011-05-26 15:30:46 - androidBthChat] E:\DATA\Simon\simon\Travail\Workspace_Eclipse\androidBthChat\res\menu\option_menu.xml:12: error: Error: No resource found that matches the given name (at 'title' with value '@string/discoverable').
Then, using directly the API in the android files, I was surprised when Eclipse offered me to import com.example.android.BluetoothChat.R
. I did it and all the previous errors disappeared. I compiled and the application crash directly on the emuator and on my Desire.
So, do you have any clues for my problem? Is it android version issue? Missing package? Eclipse error?
For your concern, I didn't touch the code of Bluetooth Chat example and I tried to compile with 2.1 and 3.0 android version.
So, I want to thank you, in advance, for your help, whatever it is: clues or easiest tutorial to learn Bluetooth API.
Regards.
Thanks Lister but I have already written the two bluetooth permissions in the Android Manifest. This is not the cause of my issue.
I just read this: android.R cannot be resolved
And I check:
- Package path in the manifest
- Package path in the java files
I wrote com.androidBthChat
in the files concerned.
Then, I tried to compile, to run the application in the emulator and I just got the same crashed error with wrong path package:
The application Bluetooth Chat(process com.example.anndroid.BluetoothChat) has stopped unexpectedly.
Please try again.
So, we can see that the application is searching the wrong path package. Do i have to recreate the samed path package using android example?
Do you have an idea? Do you want others precisions regarding my code?
Thank you for your answers.
Hi All,
I have nearly resolved my problem. Now, I can:
- compile the Bth Chat android project without errors,
- launch without crash,
- and discover devices (my nokia cellphone for example).
But I can not connect the nokia to the htc desire. I assume that I have to use an other android phone with the same application. I will do it soon.
To get this result, I have first recreated the whole project and got advices from the author of this: Oscilo_Bth. Cf. UUID_issue.
I change the UUID to 00001101-0000-1000-8000-00805F9B34FB
.
I will get back soon with new results.