Really stupid question I know. I am trying to upload my first application to Google Play and I am having issues uploading the APK. I get an error message saying:
Upload failed
You uploaded a debuggable APK.
For security reasons you need to disable debugging before it can be published in Google Play.
Learn more about debuggable APKs.
You need to use a different package name because "com.example" is restricted.
Does anybody know the package I need to use? And also will this be the case in all files in my Android Studio Project?
Sorry for my ignorance but it is my first time uploading and I am fairly new to this. I would really appreciate advice. Thanking you.
Debuggable APK - If you're using the default Android Studio/Gradle setup, you have both a "debug" and "release" variant of your app build. You need to upload the "release" variant. If you haven't set up and backed up your release signing keychain yet, do so first.
Package name - this refers to the <manifest> element in AndroidManifest.xml. It has a similar format to Java package naming, and a few things are a little more convenient if it matches the package your source code is in, but it doesn't need to. Just change
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example"
android:versionCode="1"
android:versionName="1.0">
(where it says com.example) to something unique, and if you have any relative references elsewhere in the manifest (e.g. <activity android:name=".MainActivity"> etc) you'll need to make them fully qualified or move the Java class. Every app must have a different package name.
Related
I'm currently trying to publish my app on huawei appgallery.
for in app purchases the package name of the app has to end with ".huawei".
so I added a flavor to the build.gradle as they suggested.
flavorDimensions "default"
productFlavors {
google {
dimension "default"
}
huawei {
dimension "default"
applicationIdSuffix ".huawei"
}
}
I was also able to publish my app. but updates are now getting rejected.
the message is that there is malware inside.
I first thought it is a problem on their side when creating the apk from the app bundle
but then the message also appeared when using apk files.
I then installed TotalAV and started scanning the apk files after the build.
no matter what I changed the ".huawei" build always had this message.
I also tried to remove as many dependencies as possible - no change.
the google release apk has no problem!
I also added another flavor with some different suffix - this also had the malware.
the only difference to the google build is the suffix to the applicationId.
I'm pretty sure this is only a false negative but it would be nice to get rid of this message.
any help is appreciated :)
The possible causes are as follows:
To support multiple channels, you need to add the agconnect-services.json file to the flavor folder of only the Huawei channel and ensure that the AppGallery Connect plug-in version in the project is 1.2.1.301 or later classpath'com.huawei.agconnect:agcp:1.2.1.301').
If the plug-in version is earlier than 1.2.1.301, upgrade it to 1.2.1.301 or later. To obtain the latest AppGallery Connect plug-in version, please refer to Configuring Address Information for the AppGallery Connect SDK.
Modify configuration files to adapt to multiple flavors.
Configure the gradle.properties file. Add the following configuration at the end of the file:
org.gradle.jvmargs=-Dfile.encoding=UTF-8
Supporting Multiple Channels
If your project needs to support different app packages for different channels, the package name needs to vary depending on the channel. Change the package name in productFlavor in the build.gradle file under the app directory. If the same agconnect-services.json file is used for the two channels, the package name verification fails.
For more details, see docs.
Similar question: Different module file by flavor
I have now found the source of this problem.
some years ago I tested a feature that used device admin functionality.
there was still a xml file present in the res folder.
it looked like this
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
<limit-password />
<watch-login />
<reset-password />
<force-lock />
<wipe-data />
</uses-policies>
I have now removed this file and the malware message is gone.
But still strange that it only happened with the huawei build.
I uploaded my first app to Google Play some weeks back, and everything works fine. However I have an update and need to push it to Google Play. I've done research and found that I needed to add the following to my manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.shouttag.mothership"
android:versionCode="2"
android:versionName="1.1" >
However, when I try to upload the signed APK file, I keep getting the dreaded "You need to use a different version code for your APK because you already have one with version code 1." error. Is this because in the first version, I didn't have the versionCode or versionName attributes?
Any guidance on how I can resolve this sitch?
If you're using Android Studio, make sure to also change the version in the build.gradle.
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.
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.