0

I want to change the package name com.blah.blah to something different, but I don't want to use eclipse because it says I have errors when I don't, and doesn't build.

I was checking to do it using APKtool, by changing the manifest.xml, and the package values in each smalis. I looked if there was any more, and there wasn't.

It may sound foolish, but I really need it, because this app I want to run two copies of the same app. I've seen people doing this with apps that are blocked often, such as gameguardian and gamecih (Memory Hacking programs).

Thanks!

BY THE WAY: this question hasn't been asked before as long as i'm concerned, and most of the similar ones required using eclipse.

  • "it says I have errors when I don't" - that sounds unlikely to me. When it comes to trusting an IDE or trusting a developer's view of their own code, in my experience the IDE is almost always right. I suggest you concentrate on fixing the errors in Eclipse. – Jon Skeet Jan 04 '14 at 09:37
  • @JonSkeet I entirely agree with your viewpoint. However, I also include solution for what the OP is asking because there is value in manual solution also. E.g. if you want to build multiple applications with same code base, but different configuration, for instance using automatic build. – Boris Strandjev Jan 04 '14 at 09:54
  • @JonSkeet This application is imported from my friend's work, and it works fine in the phone. Eclipse says it has errors when its imported, when there really isn't any errors in the actual program. – sunnymoonlight Jan 04 '14 at 09:56
  • So you say - but that sounds the way you've imported the project is broken, or that you just don't understand the errors enough to fix them. I've seen lots of people claim that their code is fine and that it's the tool that's broken - they're almost always wrong. You'll have a *much* better time of it if you can work out what's wrong and fix it. – Jon Skeet Jan 04 '14 at 09:59
  • @JonSkeet I don't know really, but my point is not really about the app, because I'm not the developer. My purpose is to run two instances of the same app. But, i'll note that anytime when I have to do projects. – sunnymoonlight Jan 04 '14 at 10:07
  • As I keep saying, you should just fix the problems. You need to understand them first, which may well require the help of the original developer - or asking a separate question on Stack Overflow. But ignoring the problem and *assuming* that it's Eclipse which is at fault is not a good idea. – Jon Skeet Jan 04 '14 at 10:09

2 Answers2

0

If i am not mistaken you can do it by:

Workspace>Project>.project

Change the name in content.

Umit Kaya
  • 5,771
  • 3
  • 38
  • 52
  • The package name is not included there – Boris Strandjev Jan 04 '14 at 09:38
  • Actually since you have application package in your all Java classes, you need to change your package name through Eclipse which will re-factor/modify your entire package. Be careful to not loose interaction within project. So that is why first try to solve your existing errors or publish your errors and get solutions before you try to change your name. – Umit Kaya Jan 04 '14 at 09:43
  • @BorisStrandjev see this link. You can do it manually is explained here: http://stackoverflow.com/questions/4025369/how-to-change-package-name-of-an-android-application – Umit Kaya Jan 04 '14 at 09:49
  • oh, of course, sure I have done it multiple times, always worked for me. However, note that I am not the OP. I am answering the direct question just because I see value in it also. E.g. if you use continuous integration build to produce different packages. I have done that and then Eclipse refactoring is not an option. – Boris Strandjev Jan 04 '14 at 09:52
  • @Umitk I'm afraid your answer isn't applicable because I specify the 'WITHOUT ECLIPSE' part. – sunnymoonlight Jan 04 '14 at 09:59
0

Changing the package name of an application you will have to:

  • Modify the package name in the manifest
  • Change the packages of all your Activities, Services and BroadcastReceivers you have declared in your manifest without specifying their fully qualified names. that is:

    <activity android:name=".LoginActivity">

    Must have its package changed, whilst:

    <activity android:name="com.example.LoginActivity">

    Can stay with the initial package.

  • I recommend also to change the application name, so that you will be able to distinguish between the two applications while using the application as Android user.

NOTE: Note that if you change the package of all the classes included in the application project structure all together you risk you might change the packages of some objects that would require further modification in the code. E.g. if you change the package of custom widget you will need to change the hardcoded package in the xml files that refer to it also.

Boris Strandjev
  • 46,145
  • 15
  • 108
  • 135
  • in the manifest, , has to be changed? I used notepad++ to find all occurences of the package name, to be replaced with the new package name. I checked again, i changed one database directory, but it would crash after installing. – sunnymoonlight Jan 04 '14 at 10:02
  • @sunnymoonlight Nope, not in the manifest, but `.LoginActivity` actually specifies that the package of the activity is relative to the application's package name. That is why you have to change the directory in which the activity is defined if you change the package name. I can not think of a reason why you would change database directory, how does it relate you your package, where do you access this directory? – Boris Strandjev Jan 04 '14 at 10:19
  • it's a part of the app. not too important. this app fetches data from the database. Changed that directory. – sunnymoonlight Jan 04 '14 at 10:23