[Q] Problem with package name, <service android:name=".Some Name">, etcetera - Java for Android App Development

[Q] Problem with package name, <service android:name=".Some Name">, etcetera
I started a project with Android Studio 1.2.
The wizard asked for a project name and I put some name, for example SomeName as a name.
The wizard asked for a company name and I put, for example, SomeCompanyName, BUT I DID NOT PUT com.SomeCompanyName because this generates lots of com.'s etcetera with the project.
However, when I attempt to rebuilt, the compiler gives a lot of errors everywhere where I want to reference SomeName, as for example in <service android:name=".SomeName>
I suspect the main reason is because I did NOT put com. in the wizard before SomeCompanyName.
AM I RIGHT? IS THIS THE REASON? IN CASE SO, HOW CAN I RENAME THE PROJECT OTHER THAN TO CREATE A NEW PROJECT AND COPY AND PASTE FILES?
PLEASE, HELP AND ADVISE.

Why are you linking a case in your "CASE" word????? If you are logged out there is a link there! What is this??
On your left in your project tree, right click on your package (SomeCompanyName) and click Refactor->Rename and press "rename package".
in your manifest, in the top, what do you have to
Code:
package= "..."
?
What kind of errors you have? Can you share them?
Generally you need to have the com.example.mypackagename format. (as a convention)
Especially if you are going to publish it!!! Strongly recommended!!! (you do not need to own the example.com domain name, just make sure it is unique)

mmdeveloper10 said:
Why are you linking a case in your "CASE" word????? If you are logged out there is a link there! What is this??
On your left in your project tree, right click on your package (SomeCompanyName) and click Refactor->Rename and press "rename package".
in your manifest, in the top, what do you have to
Code:
package= "..."
?
What kind of errors you have? Can you share them?
Generally you need to have the com.example.mypackagename format. (as a convention)
Especially if you are going to publish it!!! Strongly recommended!!! (you do not need to own the example.com domain name, just make sure it is unique)
Click to expand...
Click to collapse
Tried. Does not work. Does not replace the name of the package. Does not insert com. Did not work before. Did not work now. Still does not want to name the service.
I do not know why " case " was displayed as a link. May be automatic. I may have pressed wrong buttons on the keyboard.

StevenStanleyBayes said:
Tried. Does not work. Does not replace the name of the package. Does not insert com. Did not work before. Did not work now. Still does not want to name the service.
I do not know why " case " was displayed as a link. May be automatic. I may have pressed wrong buttons on the keyboard.
Click to expand...
Click to collapse
PROBLEM SOLVED. MIXED UP CLASS DECLARATIONS ( A CLASS MUST BE DECLARED IN JAVA AND NO AUTOMATIC SCRIPT IS GENERATED ) AND PLACES WHERE TO PUT RELEVANT CLASSES. HERE IS AN EXCELLEBT GUIDE : http://glennsayers.com/backgroundservice/
Thanks.

Related

Application Black Lists again

Hi All,
Wouldn't it be great to be able to control which applications ran on your PDA...Ensuring that your users could not run certain apps would be a real bonus.
So I came across a URL that explained just how to do this...
http://www.satter.org/2007/03/lets_shell_some.html#comment-74156022
Sadly, for me I am on WM6 but only have access to the WM5 SDK and when I tried to carry out the suggestions I failed with the SMS text error:
Change of Device Settings Unsuccessful
Your device settings cannot be changed by Test.cpf
So I am at a dead end. Can anyone else who has interest step in and assist this beginner to get this function working?
I ran the SDKCerts.Cab on my device and the SecurityOff.CPF file. They were successful and I got the SMS message telling me that the changes in SecurityOff.cpf were successful.
I am probably close to a solution but don't have the background to make the last few steps. Can anyone else assist me please?
Have I just a typo in my test.cpf file (on the URL there is a message about the script containing a typo error - I couldn't spot it though...was it fixed?)
All help is greatly appreciated and would deserve a beer or a cyber equivalent.
Many thanks,
PianoSam.
Could you post the wap-provisioning source you used? So I could check for a typo or sumthin.. I've done the same thing as the blogg describes, and it works fine with me..
I on the other hand, wanted to restrict wceload being loaded via Activesync->Add/Remove programs.. but it seems like RAPI doesn't use the same disallowrun settings etc..
But post you cpf file or you code.. and i'll take a look at it.
Hi,
Thanks for the assistance. I have attached a small zip with the various bits and pieces that I have.
My file is the test.cpf file. What I actually wish to do is to prevent Pocket IE from loading...although my test tried to control the clock.exe file.
all assistance is greatly appreciated and you have already renewed my hope that I might be able to do what is needed...
Thanks,
PianoSam
I'll have a look at it.. but it seems that the Test.cpf is just a doc or a rtf file you've renamed? You know this isn't a "cpf" file that wceload.exe can recognize?
I'll have a look at the registry settings within the file and build a cab/cpf file .. so i can test it... i'll let you know how this goes.. unfortunately, i can't reply before tomorrow.
I didn't realise...
Thanks for your help. I just created my test.cpf in word by cutting and pasting the xml script from the url.
I saved as utf-8 and thought job done. Sadly not.
So what should I do instead? forgive me but I don't know the steps to make a suitable cpf/cab file.
Once again THANK YOU for your kindness,
Sam.

[DEV-UTIL][19.03.2009]DriverWiz - Make signed CABs from driver DLLs that work

Intro
Lately I've seen a lot of posts by people who are trying to replace WM internal or driver DLLs, either for hacking/testing or to release. Aside from the possibility they are just doing something that won't work in the first place, I've seen failure a lot of times because files aren't properly signed, or if they are, the certificate in question not being in the right certificate stores for it to have any effect. On some ROMs it will still work due to patched NK.EXE, on others it won't, its just not very reliable.
So, I present you with the correct way of doing this by means of a small tool that will do this for you: DriverWiz. It will take care of most of the stuff, and leave you room for additions. You will however still need some basic knowledge of the command line, if you don't have that, you have no business doing anything like this anyways.
Background
I use this technique myself all the time. When just hacking away, replacing system DLLs to trace calls, etc. It's also the same method used for the HTC-CA drivers and the ICS installer. This method works on most stock ROMs as well, though not on all of them (in rare cases some security policies are set that will prevent CAB installation)
Usage
It's fairly simple to use. Just extract the attached zip file somewhere, open the command promt, and change directory to where the zip was extracted. That's the installation part.
Now when you actually want to build a CAB file from a DLL, you use the DriverWiz.bat file.
DriverWiz v1.0 by Chainfire
Usage:
DriverWiz.bat "Description" "CAB-name" "DLL-name-1" ["DLL-name-2" ...]
Examples:
DriverWiz.bat "New DDI" "ddi.cab" "ddi.dll"
DriverWiz.bat "Two DDIs" "ddi.cab" "ddi.dll" "ddiaux.dll"
Click to expand...
Click to collapse
DriverWiz will take care of signing the DLLs, inserting the certificate, etc, and you will end up with a proper CAB file for this kind of thing. Just copy it to your device and run it to install.
#1. You need to put the DLL files in the same folder as DriverWiz. Do NOT include paths in your DLL names
#2. Include the quotes in the command like in the examples!
#3. The first time you install a CAB made by DriverWiz, your phone may still give you a certificate warning. This is normal, don't worry about it.
Caveats
While this method has never failed me yet, it is possible that some files cannot be replaced this way. Just a disclaimer
Modifying
DriverWiz bases the inf file it will create to build a CAB from on DriverWiz.tpl. If you need to add registry entries to your CAB file, modify DriverWiz.tpl before you run the batch file. You can make other modifications too, add files, etc. Just take care that you don't break it
You can use your own certificates as well, instead of the supplied "Dummy" certificate that comes with DriverWiz. The files you will want to modify/replace are DriverWiz.pfx (used for signing) and DriverWiz.xml (used for injecting the certificate). I'll see about finding a reference for how to do that online and posting the URL here (someday). Creating a new certificate from scratch can be a frustrating effort - make sure you got openssl handy
Changelog
19.03.2009 - 1.1 - Added some file exists checks and attribute changes
Download
Temporary PlaceHolder for more Info.
Whoo this is hot from the plate, looks very promising!
Driver testing withoud cooking! joohie
Well if you replace the wrong files you're still going to need to hard-reset to boot. I advise KITL before you do
Works flawless. You tha man.
Didn't work for me trying to cab up No2Chems Fast Charge battery divers.
ruskiyab said:
Didn't work for me trying to cab up No2Chems Fast Charge battery divers.
Click to expand...
Click to collapse
What exactly happened? Attach the files and such
It made the cab and all, but when I went to install it, the unsigned error message popped up just like when I tried it with WinCE cab manager.
That is perfectly normal behavior. The first time you install a CAB with this certificate it will not know the certificate. However, once you install it, the certificate will be injected in the right place, and the files signed with the certificate (the driver files in the CAB) will be allowed to be run.
It won't happen the second time you try it
So if I try to install it again, it'll work fine? is there aa soft reset required in between? I can replace these drivers manually by renaming the old ones and copying them over, the whole reason I want a cab in the first place is to facilitate the UC process when I flash a different rom
ruskiyab said:
So if I try to install it again, it'll work fine? is there aa soft reset required in between? I can replace these drivers manually by renaming the old ones and copying them over, the whole reason I want a cab in the first place is to facilitate the UC process when I flash a different rom
Click to expand...
Click to collapse
Actually it should just work the first time. Just click OK when the certificate error appears.
Nice nice nice work!
error message
I got error messages when creating a cab from a rilphone.dll. Does it mean anything, or are these errors okay? I guess I'm specifically wondering about the SignTool error. If its okay, then my cab should be good.
EDIT: I think I found the problem. I didn't have UAC disabled in Windows 7. I tried it again, after disabling it, and it works fine now. Thanks for the easy to use tool!
syntax for registry entries?
I was experimenting with creating a cab for the Rogers folks who need a specific rilphone for their Caller ID to work. There are some registry entries associated with this feature, so I was wondering what the correct syntax is for putting the registry entries into the .tpl file. I've tried a few different ways, and I've either a gotten a 'Registry section is empty' message, or a 'Registry has an unsupported registry root key' error. I'm sure its something really simple I'm missing, so any help you can offer is appreciated.
It just seems that since we now have this easy method to sign these dlls, so that they can be used in any ROM, that the Rogers people shouldn't have to jump through so many hoops to get it to work.
EDIT: Nevermind. I'm an idiot that didn't do a little bit of research. All is well now.
Excellent stuff, Microsoft may rant about this way of distributing signtool and cabwiz though.
Chainfire said:
You can use your own certificates as well, instead of the supplied "Dummy" certificate that comes with DriverWiz. The files you will want to modify/replace are DriverWiz.pfx (used for signing) and DriverWiz.xml (used for injecting the certificate). I'll see about finding a reference for how to do that online and posting the URL here (someday). Creating a new certificate from scratch can be a frustrating effort - make sure you got openssl handy
Click to expand...
Click to collapse
Here's an intro to cert stores for WM:
http://msdn.microsoft.com/en-us/library/aa458010.aspx
pfx generation is a 2-liner with openssl:
# Generate a CA certificate
openssl req -new -nodes -x509 -days 9999 -newkey rsa:1024 -md5 -keyout cert.key -out cert.cer -subj "/CN=DriverWiz"
# Convert to pkcs12/PFX format
openssl pkcs12 -export -in cert.cer -out cert.pfx -inkey cert.key
got error messages under vista sp2, any ideas?
I also get an error saying that the latest version of CAPICOM.dll is missing. The ones I can find for download from the internet are version 2.0.0, and the tool requires 2.1.0.1 or later.
Does anyone have the needed version of the dll?
EDIT: Found it, 2.1.0.2 version of the dll is in the attachment.
Time Saver !
Many thanks; DriverWiz /w the CAPICOM.DLL saved me about an hour of troubleshooting.
Cheers,
Thanks for the capicom.dll Even after disabling UAC in W7Rc1 it wouldn't go, so great to have it posted to.
Chainfire, which format should the Reg's be added?
I tried the default .reg formating just under:
[Registry]
[HKEY_CURRENT_USER\ControlPanel\Profiles]
@=""
"ActiveProfile"="Normal"
?
Scrap that i found the .inf format
[AddRegistry]
HKCU,"New Key","",0x00010001,1
Many thanks for this, i'll try to Point Driver replacing Sinners from now on to here.
Well INF files are a regular female dog.
If you rather use WinCE CAB Manager, the trick is easily done as well. I do not have it handy right here (I'm not at dev box), but it goes like this.
Put the DLL's and EXE's that need to go in the CAB into the same folder as DriverWiz
Execute the following command from the command prompt in the DriverWiz folder: signtool sign /f DriverWiz.pfx *.exe *.dll
Open your WCM/CAB with CM
Somewhere is an option for "Pre XML" (main screen IIRC).. click to add/edit, and load the DriverWiz.xml file
Save
signtool sign /f DriverWiz.pfx *.cab
Et voila. I should really make an update to DriverWiz to include CAPICOM and write a proper guide on how to do all this manually (including making your own certificates and such). It's easy if you know how
If you could insert another empty post for me at the top, that'd be great.

Problem with ressources

Hi, I want to write an application for Android, but I have a Problem with my ressources.
For example it say that "menu cannot be resolved or is not a field" at the line "setContentView(R.layout.menu);" and I don't know why, because the menu.xml file is there.
All the IDs are unknown too!
At the top of your activity check the package used to import "R". If it says android.R you should delete that line and re-import using ctrl+shift+o
Thank you! After trying this some times now all works fine.

[JAR][frameworks] A little program to automate changing all those ids

Don't you wish smalis referenced xml by their tag name instead of those hex numbers? It would be so much easier to port smalis from one framework to another.
Changing every id that is different from the original fw to the destination fw by hand is feasible, but very time consuming. Thus, I made this little java program to automate the task. It runs in the command line, and takes four arguments: the smali you want to change, the smali to be created, the original public.xml, and the target public.xml
It is meant to be used with the script that is also attached, to change all the smali files in any directory. It should work also in windows, but I don't include a .bat file since I only tested this in ubuntu.
the idea is to use it like this:
Code:
./changeAllIds.sh in/ out/ original.xml target.xml > log 2 > err.log
Known issues/bugs/TODO-list:
- The bad news is that the program will throw an exception if there is an id in the smali file that is present in the original.xml but not in the target.xml. The good news is that it will output to stderr the name of the smali file and the line that has that reference, so you can immediately know which one is and add it to the target fw.
- For some reason, the ids 'ok' and 'cancel' will make this program crash. It was for me faster to temporally remove those references in the smali file and continue (adding them back later) rather than fixing the code. You're welcome to fix it if you feel like.
Source code can be found here:
https://github.com/aleadam/xml_id_changer
Well, thank you Sine for linking me to another post in the Vibrant forum.
There is a java program made by untermensch posted 3 days ago that does the same. Except, as judging by the description and the comments, that it's well done, as opposed to the crude and amateur code I posted above
http://forum.xda-developers.com/showthread.php?t=945637

(Q) mapping hardware keyboard, polish layout

Hello everyone
I am trying to acheive the right method for mapping hardware keyboard. Usb host works perfectly, always does what it should on firmware 1.21 with nook manager, kernel version 176. I found some polish keychar kcm file on the net, then I renamed that file with right vendor and product id for my keyboard (terminal, keyboard connected in host mode, typed: lsusb) and placed it in system/usr/keychars... But that didn't make any effect on keyboard mapping, looks like that file is ignored. I could try to edit qwerty.kl in system/usr/keylayouts but from what I know, you cant add there symbols like "ą" or "ś". What I am going for is just these few polish letters : Ą,Ę,Ś,Ó,Ż,Ź. Normally you get them by pressing modifier (alt) and for example, " A", what gives you "Ą" etc. Usb mode ultilty, and little app avaible on net - Key Test, both will show you the same keycode when you pressing a letter or letter+modifier. That makes hard to find out how to edit keylayout file (qwerty.kl) as you cant guess that needed keycode. I was looking quite a lot for answers on xda before I decided to ask, but what I finds does'nt look like exact sollutions. Hopefully I didn't miss anything. Adb is working fine for me, any hints appreciated, Thanks
Step one, determine what .kl and kcm.bin the Nook is trying to load.
You will see this if you have ADB and logcat running when you connect.
It will try to load one based on the VID/PID.
It will tell you the exact name of the file.
Probably your naming is different.
I ran into this already.
I didn't bother, I just use qwerty.kl and qwerty.kcm.bin
These are the defaults when there is no VID/PID specific files.
If your kcm.bin is correct it should have the UTF-16 values inside.
The format is pretty simple. After the header (32 bytes) it's like:
Code:
{
uint32 keycode;
uint16 label;
uint16 keypad;
uint16 normal;
uint16 shifted;
uint16 alt;
uint16 altshifted;
}
You can just enter the little-endian UTF-16 values using a hex editor.
Ok I got it! It is easy to find some proper tutorials for hex editing qwerty.kcm. But before I did that effort and started learning about it, I searched for some very lazy sollution: qwerty.kcm.bin already prepared by someone else. I found one (obviosly with polish layout),I swapped the original file with it, set the permissions to be the same as in original file, reboot (don't know if absolutely necessary)... thats it, easy. All that thanks to some hard working man who (as he has mentioned on other forum) spent the whole night learning on how to edit qwerty.kcm in hex editor.
Anyway, thank you very much for directing me in the right way. Knowing which files should be edited helped me to resolve the problem. Also logcat is very interesting tool, as it might give some image of how the system works. Thanks
hi, I have the same problem but i can't find the qwerty.kcm.bin with polish letters. Could you provide the file ??
bartbrudz said:
hi, I have the same problem but i can't find the qwerty.kcm.bin with polish letters. Could you provide the file ??
Click to expand...
Click to collapse
Hi, I'll try to copy it from my nook directory, once I have some time.
hi, here is my whole keychars folder (/system/usr/keychars). You can make a backup of your keychars forder and then overwrite it with mine. You can let me know if it works for you. Find attachment below. Powodzonka.
Awesome!!! works perfectly. :victory: Thank U !!!
bartbrudz said:
Awesome!!! works perfectly. :victory: Thank U !!!
Click to expand...
Click to collapse
cool, I am glad I could help! : ) (although real credits goes to someone who created this qwerty.kcm file)

Categories

Resources