Why is Android studio having problems with capitalized package names? - android

I have an app that started in eclipse. The package name starts with a capital, and it always compiled and installed correctly. Now that I have moved the project into android studio, while the app will compile, it won't install due to a malformed manifest. I looked up this problem, and the suggestion was to lowercase the package name. This dose solve the problem, and the app installs, but this makes no sense. Why would apps compiled in eclipse be fine with it, but the same code in Android Studio not work? This is a large problem, as the app is already in the play store, and I can't lowercase the package name, so I'm stuck in eclipse. Dose anyone know a work around?

Maybe google play is not case sensitive and thats why it doesn't recognize the upercase package name, you might be able to post an update with the same package name but lowercase. Have you tried it?

Had the same problem with capitals in old package name. In studio simply rename the package in build.gradle (Module:app) from com.abc.example to com.ABC.example sync the project and all should be well.

In Android Studio rename the package name and in build.gradle leave old applicationId.
Although your project's package name matches the application ID by default, you can change it. You should never change the application ID.
More: https://developer.android.com/studio/build/application-id.html#change_the.package_name

Related

App is not installed after changed applicationId

I'm new to Android development.
I finally finished up my first android application and
tried to upload on google play.
then I found out I can't use com."example" package name for uploading.
so I already changed all my package name to com."◯◯◯" and it worked fine.
but once I changed applicationId in gradle app file which corresponds to the package name, my app is not installed any more...
there's no error message in android studio and seems to fine.
I did clean and rebuild, invalidate caches/restart, uninstall existing app on my device, etc..but any of them not working.
I couldn't find any solution for it. please help me to fix this problem.
thank you
---update. case solved---
It was because if you change the applicationId, the installed app is brand new one(doesn't have any data in the database). so the problem was null variable which I didn't make it nullable.
thank you for your help.
change all place-name where package name use it then try

Android Studio - APK with capitalized package name - INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

I know that almost identical question was asked here, but accepted answer doesn't work for me.
Make apk with Capitalized package name in android studio
Let me explain.
Our Android app was developed in Xamarin.Android, we did a mistake with package naming - Visual Studio and Xamarin configured our's app manifest with uppercased package name (this was a mistake which now I pay with my sanity). It worked for Xamarin version, but we decided to rewrite that app in Android Studio after some releases. Now the problem begins...
We are not able to directly deploy/install apk on devices older than Android 8.0, we get following error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
It's funny that issue does not exists on devices with newest API.
It's clearly issue with our package name which is something like:
YES_We_Failed_On_It.We_Failed_Very_Badly
If I change it to lowercased everything works, but the case is we can't release another application with different package name.
Is there any possibility to fix this?
It will be self answer question.
If anyone else will be at my position, fix is quite simple.
As mentioned in docs: https://developer.android.com/studio/build/application-id.html
When you create a new project in Android Studio, the applicationId exactly matches the Java-style package name you chose during setup. However, the application ID and package name are independent of each other beyond this point. You can change your code's package name (your code namespace) and it will not affect the application ID, and vice versa (though, again, you should not change your application ID once you publish your app).
Application ID and Java package name are not the same.
So to fix this I renamed my package to be lowercased and stayed with uppercased Application ID. Problem disappeared.
At the end of build, build tools copy our Application ID into final APK's manifest, that's why it's still the same package I think.
Also from docs:
One more thing to know: Although you may have a different name for the manifest package and the Gradle applicationId, the build tools copy the application ID into your APK's final manifest file at the end of the build.

Install few APK files on phone - different versions of the same app.

I decided to have few versions of the same app on the phone.
I clicked 'run' on first version of app in eclipse and apk was installed with the name: 'p2'. Then I changed package statement in Manifest to 'p5' , and changed all links in application classes and xmls, rebuilded app and clicked 'run' again to install next apk on the same phone.
To my astonishment I have two applications with name 'p2'.
I expected to see 'p2' and 'p5'.
I was looking for an occurence of 'p2' in my code but there was no such place.
Can you guide me to solve this?
To install the same application on the same device do followed steps:
change Application package (where your main Activity is located)
change Application Name (optional, doesn't seem good two equal names on the same device)
If you compile applications from Eclipse, you must change also .project file:
<projectDescription>
<name>Appl</name>
otherwise you can't import second application with the same name

building android lite version - full and lite versions get mixed on emulator

I'm trying to build lite version of an android project..so far, I've read that renaming application package (I've used eclipse option for renaming app package) should be enough. I've checked in manifest.xml, package is renamed, but when I install my app on phone (or on a emulator) it seams to mix somehow versions, specially after pressing home button and then re-entering the application (it switches to previously installed full version).
what am I missing? Is there something else to change in order to get different version of application? Should I change application name or maybe source packages?
When changing a package name you also need to change the name of your files. So if your app was originally my.app.full then the files under src will be my/app/full. If you change your package name to my.app.lite then you need to change the film names under src to my/app/lite.
Also at the top of all your classes you should have a package declaration ie. package my.app.full, which also needs to be changed to your new package name - package my.app.lite
If you are still having problems, try refreshing the build, and then if that doesn't work delete the gen file (don't worry it will reappear when you build your project)

How to properly change the package name in AndroidManifest.xml (e.g. in project zxing/barcodescanner)

I'm pretty new to android development, so I hope my question is easy, but not completely stupid. I'm using Eclipse to build an android application. It is based on the barcode-scanner of the ingenious guys from zxing. I already did quite some changes to the original code and everything works fine. But I still have the problem, that the original barcode-scanner and my app cannot run simultaneously on one mobile device. As far as I could find out, the problem is the package name. So I tried to change it to something else. But that srew up my entire project, because I can't access my resources anymore (e.g. findViewById(R.id.btDone); <-- R cannot be resolved to a variable).
Can anyone tell me what else I have to change to make my code work again?
This the beginning of my AndroidManifest.xml where I tried to change the package name:
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.zxing.client.android"
...
I also found an interesting entry in build.properties: (?!)
application-package=com.google.zxing.client.android
Thanks you guys!
This should do it: Right Click on project -> Android Tools -> Rename Application Package
Android - Package Name convention
The package refers to the file directory you made. If you still have problems, especially with android, sometimes doing project->clean and then rebuilding fixes some of the linking problems with resources
Assuming you choose to go with the new package name:
com.superscanner.android
And with the old package name being (for example):
com.google.zxing.client.android
Go through all the source code and change:
import com.google.zxing.client.android.R;
To:
import com.superscanner.android.R;
You'll also have to rename all your directories to match your new package structure, and change your import and package statements throughout, but this should get you going.

Categories

Resources