I have developed two android apps...when i install them on my phone to test them.. they overwrite each other. I do not want this to happen. The intent is to have both installed on the phone as separate apps.. how do i fix this? I developed them with eclipse.
I had the same problem despite the fact that package names were different between both APKs.
At the end I had to modify a GRADLE file:
\app\build.gradle
the following line:
applicationId "name.to.change"
In Android Studio 3 you will find this configuration in:
I had the same issue, turned out that I had copied one project to another to save time, and the package setting in the Manifest tag inside the AndroidManifest.xml file was the same for both apps.
Once I changed this and resolved any imports errors, the apps stopped overwriting one another on the phone.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="xxx.yyy"
android:versionCode="1"
android:versionName="1.0" >
Do the apps share the same namespace? Verify that they have their own packages in Eclipse.
also share the same user id, modify it in the manifest.
Related
I am working on an android application. Meanwhile i got chance to work on another application similar to first. I have just copy my previous code to new
project.
1) src files
2) res files
3) manifest
4) build.gradle
and then I change packagename from com.abc to com.xyz in
1) build.gradle
2) Manifest
3) src files
Now i have installed first app in my device and try to install second one but it does not work.
Same error also occur when i have installed second app and try to install first one.
Here is the error
Is there any other thing i need to change apart from packagename??
There may be different issues, but try this:
go to gradle and change applicationId, another reason could be conflicting of authorithies in apps, refer to these:
Install shows error in console: INSTALL FAILED CONFLICTING PROVIDER
INSTALL_FAILED_CONFLICTING_PROVIDER in Android
http://gradlewhy.ghost.io/overcoming-install-failed-conflicting-provider/
I have the same issue in the same case and I solved it by adding applicationId. In my case problem was in permission.MAPS_RECEIVE, I saw that in error logs. So I did next:
AndroidManifest.xml:
<permission
android:name="${applicationId}.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
I don't use Android Studio nor Eclipse, but I just got into Android development.
I wrote an app, named project A here. It works just fine!
I wanted to write a similar app, so I copied the whole A project and made the B. I changed the name labels in the manifest, I changed the project name in build.xml, but when I install B it actually overwrites A!
What am I missing? How to install A and B, without removing one another?
The package name/application id (in the manifest manifest tag package=...) are still the same probably.
Example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bimjay.timerflow"
android:versionCode="100"
...
I'd like to know if there is a way to add certain permissions (or anything) to an android manifest file, but so that its only used during test runs - not production. I'm looking for something programmatic, not cutting and pasting when I'm testing.
Here's the context:
I'm reading this article: http://developer.android.com/training/location/location-testing.html, the best practice for test running an app used to be creating a 'test-app' however with android studio we now are not meant to create a new app - all testing should be done through the app. (Thank you gradle)
The issue is that this article is written with a testing permission (ACCESS_MOCK_LOCATION) in it, and I don't want that sitting in my app - and if there's a good way of doing it, I'd like to do that.
UPDATE: The reason I had this problem was because of a misunderstanding of the set up of android studio architecture since the migration to Gradle.
I didn't realize that the build types shared the 'androidTest' and 'main' source folders. And so when testing or running the unfinished app, it takes the debug files (if any) and adds all the production stuff to it. So in my case, I added a empty manifest file in debug and simply added the two permissions to it. When I run or test, gradle adds all of my apps things from its other manifest to it this skeletal file (or vice versa, I'm uncertain).
So in the end we don't need to modify the androidTest folder (in fact I don't think we are allowed to add a manifest here) as its completely generated based off of whether a user is running on debug or deployment. Cheers! :-)
Let's say you use the default debug and release build types and you run your tests against the debug build type.
In this case you can create a src/debug/AndroidManifest.xml and add the additional permissions you need in your debug builds:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.package">
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
</manifest>
If your project does not follow the default folder hierarchy and you want to add permissions to the debug build add the following block.
sourceSets {
debug {
manifest.srcFile '<your folder>/AndroidManifest.xml'
}
}
I have already published an app called com.mycompany.mygame on google play.
I then decided to publish an ad free version of it. I did not change the package name in eclipse because I noticed that in the "export" process you have the opportunity to have the final apk set as anything you like. So I set it there as com.mycompany.mygameaf - note the additional "af" on the end. But then when tried to upload it to the market, google said:
You need to use a different package name because "com.mycompany.mygame" is already used by one of your other applications
So now I'm confused. Is the complaint because I'm not allowed to have an apk that is a name which is and extension of a previous app? Or does the final apk somehow have knowledge of what the original name was?
What is the easiest way to resolve this?
Apart from correcting app name in the Manifest I also had to change applicationId in the app's gradle.build file.
defaultConfig {
applicationId "com.example.changednameofmyapp"
...
}
Also, if you're using ProGuard, do not forget to change appropriate rules in your proguard-rules.pro
Just search the old package name in the whole project and change it.
Regardless of the name of the .apk file, the package name of the Application contents inside it must be unique.
You can use refactor-rename to change this, though make sure that the change penetrates to the manifest file, proguard configuration, etc.
The name of the APK doesn't matter, its the package name within the AndroidManifest file that counts.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourcompany.yourapp"
There can only be one app on the market with that package name so in order to publish your ad free version you would have to change the package name in the manifest file, e.g. add the af onto the end of the package name within your manifest.
As mentioned in other answers, you're development would be simpler if you put all the shared code and assets a common library project that is a dependency of your paid and free versions.
You may also wish to play with the new Gradle build system (in Android Studio) which allows you to dynamically set things like the package name at runtime. It also allows you to switch resources during build time, which is extremely convenient; You could have a boolean resource that represents whether the current app is the paid version. This allows you to enable/disable app features based on a check to that value.
The filename of the APK is irrelevant, the package name of your app is used as a unique identifier - it is in the root element in the AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.packagename"
android:versionCode="1"
android:versionName="1.0" >
When you initially create your project in Eclipse it creates an actual package structure which matches this package name for you to put your source files in.
You can actually chnage your package name by modifiying this manifest value and you can just keep the folder/package structure as is - it does not need to match your actual application package name.
Alternatively, right click your project in Eclipse, go to "Android Tools" and then select "Rename Application Package"
After you do this you should be able to submit your binary
The package name in the manifest is used to identify the application within Android and within Google Play. So different apps need different names.
The easiest workaround might be to just create a new package, with no code in it, and use that as the app's package name in the manifest.
What I've done to solve my many-apps-from-one-codebase problem is put all the apps' code in a library project, and then I have several app projects that use that library. The app projects contain no code, just a manifest and custom resources.
So today I had a bright idea to rename my packages, now my android application which I have schedule for release on thursday is not working.
I am getting a similar error as follows:
Error: Activity class {org.me.androidapplication2/com.albertrosa.DEMO.MainActivity} does not exist.
I have modified the manifest to reflect the change:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.albertrosa.DEMO"
android:versionCode="1"
android:versionName="1.0"
there is more to the manifest but this is all that I have changed. is there something I am missing or doing wrong. I am using netbeans to build this app.
This is an old topic but someone may find it useful to know when you refactor your package you are required to edit the manifest file but you also need to refactor the generated java files package.
As you can see, there is a wrong package path here: org.me.androidapplication2/com.albertrosa.DEMO.MainActivity
Have you tried to clean the project? Rebuild? Try to search for the old package name, maybe it is hard coded somewhere?!
Exactly this just happened to me. Uninstalling the application from the device fixed the problem.