open a new version with the same package name android studio - android

I would like to add code to my app but I would like to do that on a new version in case so that i can always get back to my older version which worked.
I need the package name to be the same cause i'm using google services like :JSON and firebase which are relies on the package name.
Could someone please advise step by step?
when I tried to open a new project and copy the files to that new project got warnings like INSTALL_FAILED_INVALID_APK and Gridle not imported. for example:
"Installation failed with message Failed to finalize session : INSTALL_FAILED_INVALID_APK: Split lib_slice_2_apk was defined multiple times.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
WARNING: Uninstalling will remove the application data!
Do you want to uninstall the existing application?"

Related

Import error while uploading app bundle to Play Console

I have refactored my app by splitting into modules (:app, core and features). It works correctly on emulator so I decided to upload to the internal test track on Play Console but it shows an error during importation :
The screencap is in french but it says basically "An error occurred during importation of Android App Bundle package. Please try again later. If the problem persists, contact Google Play assistance service for developers"
This message doesn't give any clue about what the problem is !
The previous uploaded version of this app was already an App Bundle and is currently released successfully.
The big difference between both versions is that the new one is split into modules (but no dynamic features or anything). I have added android:hasCode=true to :app module manifest.
I have retried after invalidate, restart, clean, rebuild and regenerate bundle. I have retried on another day.
I have downgraded from Android Studio 3.4 to 3.3.2 (and Gradle as well) to be sure that R8 is disabled.
No luck... Any idea ?
After many tries, it occurred to me that maybe I would get a more explicit message by uploading an APK instead of a Bundle.
And I did !
Failed to run aapt dump badging:
AndroidManifest.xml:63: error: ERROR getting 'android:name' attribute: attribute is not a string value
Because I had an #string for a intent name instead of an hardcoded string (-shame-)
Anyway, to be remembered : When Bundle importation doesn't work, try uploading a simple APK to get a more explicit error message !

Install two versions of an apk (with different applicationIds)

How much do I have to change in an android project for it to be installed as a new app?
I thought that it would be enough to change the applicationId in the build.gradle file, but I am not able to install the second version of the app without uninstalling the first version. In the play store I get error 910 or error -505 and when installing it manually I get:
Installation failed with message Failed to finalize session : INSTALL_FAILED_CONFLICTING_PROVIDER: Package couldn't be installed in /data/app/net.mindlevel-1: Can't install because provider name net.mindlevel (in package net.mindlevel) is already used by net.veglevel.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
Do I have to change the package name in AndroidManifest.xml too?
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.mindlevel">
And if I have change that, I have to change every single source file to use that package right?
In your manifest, there is a <provider> element with a hardcoded android:authorities attribute. That needs to be changed as well as your applicationId, as there can only be one provider installed for each unique authority.

Signing The App Bundle Base Module And Dynamic Feature Module

In the Google official guide for App Bundle: https://developer.android.com/guide/app-bundle/configure#base_build_config it said that signing information only needs to be specified in the base module build.config file. The dynamic module signing info goes with base module.
I am using my own keystore file, so I only include the signingConfig in the base module. However, when I build and run the app on a device, it always pop up the error:
Installation failed with message Failed to finalize session :
INSTALL_FAILED_INVALID_APK:
/data/app/vmdl538875391.tmp/1_feature_-debug signatures are
inconsistent. It is possible that this issue is resolved by
uninstalling an existing version of the apk if it is present, and then
re-installing.
When I include the signing info in the dynamic module, the error goes away.
So does this conflict with the official guide? Or did I do anything incorrect here?
The problem is caused by a setting in Edit Configuration.. In order to only include signing info in the base module of a bundle, I need to choose 'APK from app bundle', not the 'default APK'. Otherwise, Android Studio will use the signing info to sign the APK instead of the bundle.
Do it like this
menu "Build"
run "Rebuild Project".
Then run app on device or emulator
or if the above solution doesn't work.
Then try this
Disable the Instant run in Android Studio and then Clean, Rebuild and Run, It should fix this issue.

Creating a debug app

Okay so i have an application, put up on the playstore.
What i want now, it to create the same application but with debug postfix in the name and it must have everything same.
I want to do this, because i do not want to disturb my original project when i am experimenting stuff,
So what i did was, i copied the project folder from wherever it was to the desktop, original one had the package name com.femindharamshi.spa so i refactored the whole thing to com.femindharamshidebug.spadebug and all changed the app_name in string
but when i try to open this app in the emulator, Android Studio Gives me the following error :
Installation failed with message Failed to finalize session :
INSTALL_FAILED_INVALID_APK: Split_lib_slice_4_apk was defined multiple
times. It is possible that this issue is resolved by uninstalling an
existing version of the apk, if it is present, and then re-installing
Also i do not want to uninstall the original app from the emulator/physical device, i just want to add this app for testing purposes. What should i do ?
Try closing the Android Studio and giving clean and build to the project.
change you application ID in app level build.gradle file and sync the project
applicationId "//pkg id here"

Refactor/rename steps to fix ""com.google" is restricted"" error

When I attempt to upload my apk then everytime I get the following error:
"Upload error
UPLOAD NEW APK TO PRODUCTION
Upload failed
You need to use a different package name because "com.google" is restricted."
When I rename or refactor based on the multiple different steps suggested on this site to change "com.google.samples.apps.myapp" it breaks the program in a manner which then prevents it from a successful "build"
I have read and reread: "com.example restricted" Google Play error; even when changing the package name AND also
Android Studio Rename Package
I suspect that the refactor does not correct the links I need to the R file? Any help would be appreciated.
If you're using Android Studio / Gradle you don't need to change your package name (as it impacts your resources) but only the "applicationId" which is whats used for publishing.
Details here: http://tools.android.com/tech-docs/new-build-system/applicationid-vs-packagename

Categories

Resources